mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
6/15
This commit is contained in:
1 parent
6956dc04f6
commit
570edcffc0
3 files changed
+35
-21
No files matched your search
@@ -1,10 +1,8 @@
|
||||
package net.draycia.carbon.commands;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Dependency;
|
||||
|
||||
import dev.jorel.commandapi.CommandAPICommand;
|
||||
import dev.jorel.commandapi.CommandPermission;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -12,15 +10,26 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandAlias("clearchat|cc")
|
||||
@CommandPermission("carbonchat.clearchat.clear")
|
||||
public class ClearChatCommand extends BaseCommand {
|
||||
import java.util.List;
|
||||
|
||||
@Dependency
|
||||
private CarbonChat carbonChat;
|
||||
public class ClearChatCommand {
|
||||
|
||||
@Default
|
||||
public void baseCommand(CommandSender issuer) {
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ClearChatCommand(CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
String commandName = carbonChat.getConfig().getString("commands.clearchat.name", "clearchat");
|
||||
List<String> commandAliases = carbonChat.getConfig().getStringList("commands.clearchat.aliases");
|
||||
|
||||
new CommandAPICommand(commandName)
|
||||
.withAliases(commandAliases.toArray(new String[0]))
|
||||
.withPermission(CommandPermission.fromString("carbonchat.clearchat.clear"))
|
||||
.executes(this::execute)
|
||||
.register();
|
||||
}
|
||||
|
||||
private void execute(CommandSender sender, Object[] args) {
|
||||
String format = carbonChat.getModConfig().getString("clear-chat.message", "");
|
||||
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n");
|
||||
|
||||
@@ -37,12 +46,12 @@ public class ClearChatCommand extends BaseCommand {
|
||||
|
||||
if (player.hasPermission("carbonchat.clearchat.notify")) {
|
||||
String message = carbonChat.getLanguage().getString("clear-notify");
|
||||
audience.sendMessage(carbonChat.getAdventureManager().processMessage(message, "player", issuer.getName()));
|
||||
audience.sendMessage(carbonChat.getAdventureManager().processMessage(message, "player", sender.getName()));
|
||||
}
|
||||
|
||||
if (player.hasPermission("carbonchat.clearchat.exempt")) {
|
||||
String message = carbonChat.getLanguage().getString("clear-exempt");
|
||||
audience.sendMessage(carbonChat.getAdventureManager().processMessage(message, "player", issuer.getName()));
|
||||
audience.sendMessage(carbonChat.getAdventureManager().processMessage(message, "player", sender.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,21 +81,20 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
public void reloadCommands(CarbonChat carbonChat) {
|
||||
this.commandManager.registerCommand(new ToggleCommand());
|
||||
this.commandManager.registerCommand(new ChannelCommand());
|
||||
this.commandManager.registerCommand(new ChannelListCommand());
|
||||
this.commandManager.registerCommand(new IgnoreCommand());
|
||||
this.commandManager.registerCommand(new ChatReloadCommand());
|
||||
new ClearChatCommand(carbonChat);
|
||||
this.commandManager.registerCommand(new IgnoreCommand());
|
||||
this.commandManager.registerCommand(new MeCommand());
|
||||
this.commandManager.registerCommand(new MessageCommand());
|
||||
new MuteCommand(carbonChat);
|
||||
new NicknameCommand(carbonChat);
|
||||
new ReplyCommand(carbonChat);
|
||||
new SetColorCommand(carbonChat);
|
||||
this.commandManager.registerCommand(new SpyChannelCommand());
|
||||
|
||||
this.commandManager.registerCommand(new ClearChatCommand());
|
||||
new MuteCommand(carbonChat);
|
||||
new ShadowMuteCommand(carbonChat);
|
||||
this.commandManager.registerCommand(new SpyChannelCommand());
|
||||
this.commandManager.registerCommand(new ToggleCommand());
|
||||
}
|
||||
|
||||
public BukkitCommandManager getCommandManager() {
|
||||
|
||||
Reference in new issue
Block a user