Begin (broken) modularization

This commit is contained in:
Draycia committed 2020-07-12 04:25:33 -07:00
1 parent b3a0d71ba8
commit ad8089855c
56 files changed
+553 -369

No files matched your search

@@ -0,0 +1,60 @@
package net.draycia.simplechat.commands;
import co.aikar.commands.BaseCommand;
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;
@CommandAlias("spych|spychannel|spy")
@CommandPermission("simplechat.spy")
public class SpyChannelCommand extends BaseCommand {
private SimpleChat simpleChat;
public SpyChannelCommand(SimpleChat simpleChat) {
this.simpleChat = simpleChat;
}
@Default
@CommandCompletion("@channel")
public void baseCommand(Player player, @Conditions("exists:true") ChatChannel channel) {
ChatUser user = simpleChat.getUserService().wrap(player);
String message;
UserChannelSettings settings = user.getChannelSettings(channel);
if (settings.isSpying()) {
settings.setSpying(false);
message = simpleChat.getConfig().getString("language.spy-toggled-off");
} else {
settings.setSpying(true);
message = simpleChat.getConfig().getString("language.spy-toggled-on");
}
user.sendMessage(MiniMessage.get().parse(message, "br", "\n",
"color", "<color:" + channel.getColor().toString() + ">", "channel", channel.getName()));
}
@Subcommand("whispers")
public void whispersCommand(Player player) {
ChatUser user = simpleChat.getUserService().wrap(player);
String message;
if (user.isSpyingWhispers()) {
user.setSpyingWhispers(false);
message = simpleChat.getConfig().getString("language.spy-whispers-off");
} else {
user.setSpyingWhispers(true);
message = simpleChat.getConfig().getString("language.spy-whispers-on");
}
user.sendMessage(MiniMessage.get().parse(message, "br", "\n"));
}
}