mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Attempt to fix duplicate command names
This commit is contained in:
1 parent
ed3a41bcfa
commit
c8beb402a3
16 files changed
+61
No files matched your search
@@ -9,6 +9,7 @@ import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -25,6 +26,8 @@ public class ChannelCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> setChannelArguments = new LinkedHashMap<>();
|
||||
setChannelArguments.put("channel", CarbonUtils.channelArgument());
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
@@ -31,6 +32,8 @@ public class ChannelListCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
|
||||
|
||||
new CommandAPICommand(commandSettings.getName())
|
||||
|
||||
@@ -6,6 +6,7 @@ import dev.jorel.commandapi.arguments.Argument;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@@ -22,6 +23,8 @@ public class ChatReloadCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
new CommandAPICommand(commandSettings.getName())
|
||||
.withAliases(commandSettings.getAliasesArray())
|
||||
.withPermission(CommandPermission.fromString("carbonchat.reload"))
|
||||
|
||||
@@ -6,6 +6,7 @@ import dev.jorel.commandapi.CommandPermission;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -22,6 +23,8 @@ public class ClearChatCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
new CommandAPICommand(commandSettings.getName())
|
||||
.withAliases(commandSettings.getAliasesArray())
|
||||
.withPermission(CommandPermission.fromString("carbonchat.clearchat.clear"))
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -25,6 +26,8 @@ public class IgnoreCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
|
||||
channelArguments.put("player", CarbonUtils.chatUserArgument());
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -25,6 +26,8 @@ public class MeCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
|
||||
channelArguments.put("message", new GreedyStringArgument());
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -22,6 +23,8 @@ public class MessageCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
|
||||
channelArguments.put("player", CarbonUtils.chatUserArgument());
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
@@ -26,6 +27,8 @@ public class MuteCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> arguments = new LinkedHashMap<>();
|
||||
arguments.put("player", CarbonUtils.chatUserArgument());
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -25,6 +26,8 @@ public class NicknameCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> selfArguments = new LinkedHashMap<>();
|
||||
selfArguments.put("nickname", new StringArgument());
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import dev.jorel.commandapi.arguments.GreedyStringArgument;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -23,6 +24,8 @@ public class ReplyCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> arguments = new LinkedHashMap<>();
|
||||
arguments.put("message", new GreedyStringArgument());
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.storage.UserChannelSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -24,6 +25,8 @@ public class SetColorCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
for (ChatChannel channel : carbonChat.getChannelManager().getRegistry().values()) {
|
||||
LinkedHashMap<String, Argument> arguments = new LinkedHashMap<>();
|
||||
arguments.put("channel", new LiteralArgument(channel.getKey()));
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
@@ -26,6 +27,8 @@ public class ShadowMuteCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> arguments = new LinkedHashMap<>();
|
||||
arguments.put("player", CarbonUtils.chatUserArgument());
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.storage.UserChannelSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -26,6 +27,8 @@ public class SpyChannelCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
|
||||
channelArguments.put("channel", CarbonUtils.channelArgument());
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@@ -25,6 +26,8 @@ public class SudoChannelCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> setOtherChannelArguments = new LinkedHashMap<>();
|
||||
setOtherChannelArguments.put("player", CarbonUtils.onlineChatUserArgument());
|
||||
setOtherChannelArguments.put("channel", CarbonUtils.channelArgument());
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.draycia.carbon.storage.ChatUser;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
import net.draycia.carbon.storage.UserChannelSettings;
|
||||
import net.draycia.carbon.util.CarbonUtils;
|
||||
import net.draycia.carbon.util.CommandUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -25,6 +26,8 @@ public class ToggleCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandUtils.handleDuplicateCommands(commandSettings);
|
||||
|
||||
LinkedHashMap<String, Argument> channelArguments = new LinkedHashMap<>();
|
||||
channelArguments.put("channel", CarbonUtils.channelArgument());
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.draycia.carbon.util;
|
||||
|
||||
import dev.jorel.commandapi.CommandAPI;
|
||||
import net.draycia.carbon.storage.CommandSettings;
|
||||
|
||||
public class CommandUtils {
|
||||
|
||||
public static void handleDuplicateCommands(CommandSettings settings) {
|
||||
CommandAPI.unregister(settings.getName());
|
||||
|
||||
for (String command : settings.getAliases()) {
|
||||
CommandAPI.unregister(command);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user