mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Add SudoChannel command
This commit is contained in:
1 parent
c234dfe5e5
commit
349fa385e8
5 files changed
+81
-99
No files matched your search
@@ -8,7 +8,6 @@ import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -33,15 +32,6 @@ public class AliasedChannelCommand {
|
||||
.executesPlayer(this::setChannel)
|
||||
.register();
|
||||
|
||||
// LinkedHashMap<String, Argument> setOtherChannelArguments = new LinkedHashMap<>();
|
||||
// setOtherChannelArguments.put("player", CarbonUtils.chatUserArgument());
|
||||
//
|
||||
// new CommandAPICommand(commandName)
|
||||
// .withArguments(setOtherChannelArguments)
|
||||
// .withPermission(dev.jorel.commandapi.CommandPermission.fromString("carbonchat.channel.others"))
|
||||
// .executes(this::setOtherChannel)
|
||||
// .register();
|
||||
|
||||
LinkedHashMap<String, Argument> sendMessageArguments = new LinkedHashMap<>();
|
||||
sendMessageArguments.put("message", new GreedyStringArgument());
|
||||
|
||||
@@ -50,16 +40,6 @@ public class AliasedChannelCommand {
|
||||
.withPermission(CommandPermission.fromString("carbonchat.channel.message"))
|
||||
.executesPlayer(this::sendMessage)
|
||||
.register();
|
||||
|
||||
// LinkedHashMap<String, Argument> sendMessageOtherArguments = new LinkedHashMap<>();
|
||||
// sendMessageOtherArguments.put("player", CarbonUtils.onlineChatUserArgument());
|
||||
// sendMessageOtherArguments.put("message", new GreedyStringArgument());
|
||||
//
|
||||
// new CommandAPICommand(commandName)
|
||||
// .withArguments(sendMessageOtherArguments)
|
||||
// .withPermission(dev.jorel.commandapi.CommandPermission.fromString("carbonchat.channel.others.message"))
|
||||
// .executes(this::sendMessageOther)
|
||||
// .register();
|
||||
}
|
||||
|
||||
private void setChannel(Player player, Object[] args) {
|
||||
@@ -82,22 +62,6 @@ public class AliasedChannelCommand {
|
||||
"channel", getChatChannel().getName()));
|
||||
}
|
||||
|
||||
private void setOtherChannel(CommandSender sender, Object[] args) {
|
||||
ChatUser user = (ChatUser) args[0];
|
||||
|
||||
user.setSelectedChannel(getChatChannel());
|
||||
|
||||
String message = getChatChannel().getSwitchMessage();
|
||||
String otherMessage = getChatChannel().getSwitchOtherMessage();
|
||||
|
||||
user.sendMessage(carbonChat.getAdventureManager().processMessage(message, "br", "\n",
|
||||
"color", "<color:" + getChatChannel().getChannelColor(user).toString() + ">", "channel", getChatChannel().getName()));
|
||||
|
||||
carbonChat.getAdventureManager().getAudiences().audience(sender).sendMessage(carbonChat.getAdventureManager().processMessage(otherMessage, "br", "\n",
|
||||
"color", "<color:" + getChatChannel().getChannelColor(user).toString() + ">", "channel", getChatChannel().getName(),
|
||||
"player", user.asOfflinePlayer().getName()));
|
||||
}
|
||||
|
||||
private void sendMessage(Player player, Object[] args) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
String message = (String) args[0];
|
||||
@@ -108,16 +72,6 @@ public class AliasedChannelCommand {
|
||||
.replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%"));
|
||||
}
|
||||
|
||||
private void sendMessageOther(CommandSender sender, Object[] args) {
|
||||
ChatUser user = (ChatUser) args[0];
|
||||
String message = (String) args[1];
|
||||
|
||||
Component component = getChatChannel().sendMessage(user, message, false);
|
||||
|
||||
carbonChat.getLogger().info(CarbonChat.LEGACY.serialize(component)
|
||||
.replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%"));
|
||||
}
|
||||
|
||||
public ChatChannel getChatChannel() {
|
||||
return chatChannel;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user