Refactor settings and fix stuff

This commit is contained in:
Draycia authored and Josh (Vicarious) committed 2020-07-07 05:05:11 -07:00
1 parent 2fb43df8ad
commit 6530c8d026
10 files changed
+182 -48

No files matched your search

@@ -0,0 +1,29 @@
package net.draycia.simplechat.commands;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandCompletion;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Default;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.kyori.adventure.text.format.TextColor;
@CommandAlias("chcolor|channelcolor")
@CommandPermission("simplechat.setcolor")
public class ChannelColorCommand extends BaseCommand {
private SimpleChat simpleChat;
public ChannelColorCommand(SimpleChat simpleChat) {
this.simpleChat = simpleChat;
}
@Default
@CommandCompletion("@chatchannel @chatcolors")
public void baseCommand(ChatUser user, ChatChannel chatChannel, String color) {
user.getChannelSettings(chatChannel).setColor(TextColor.fromHexString(color));
}
}
@@ -5,6 +5,7 @@ import co.aikar.commands.annotation.*;
import net.draycia.simplechat.SimpleChat;
import net.draycia.simplechat.channels.ChatChannel;
import net.draycia.simplechat.storage.ChatUser;
import net.draycia.simplechat.storage.UserChannelSettings;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.entity.Player;
@@ -25,11 +26,13 @@ public class ToggleCommand extends BaseCommand {
String message;
if (user.ignoringChannel(channel)) {
user.setIgnoringChannel(channel, true);
UserChannelSettings settings = user.getChannelSettings(channel);
if (settings.isIgnored()) {
settings.setIgnoring(true);
message = channel.getToggleOffMessage();
} else {
user.setIgnoringChannel(channel, false);
settings.setIgnoring(false);
message = channel.getToggleOnMessage();
}