mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-03 22:15:45 +00:00
Human pass over commands
This commit is contained in:
16 files changed
+68
-50
No files matched your search
@@ -15,11 +15,16 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class AliasedChannelCommand {
|
public class AliasedChannelCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
private final @NonNull ChatChannel chatChannel;
|
|
||||||
|
@NonNull
|
||||||
|
private final ChatChannel chatChannel;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final String commandName;
|
private final String commandName;
|
||||||
|
|
||||||
public AliasedChannelCommand(CarbonChat carbonChat, @NonNull ChatChannel chatChannel) {
|
public AliasedChannelCommand(@NonNull CarbonChat carbonChat, @NonNull ChatChannel chatChannel) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
this.chatChannel = chatChannel;
|
this.chatChannel = chatChannel;
|
||||||
|
|
||||||
@@ -43,7 +48,7 @@ public class AliasedChannelCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setChannel(Player player, Object[] args) {
|
private void setChannel(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
if (user.getChannelSettings(getChatChannel()).isIgnored()) {
|
if (user.getChannelSettings(getChatChannel()).isIgnored()) {
|
||||||
@@ -63,7 +68,7 @@ public class AliasedChannelCommand {
|
|||||||
"channel", getChatChannel().getName()));
|
"channel", getChatChannel().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(Player player, Object[] args) {
|
private void sendMessage(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
String message = (String) args[0];
|
String message = (String) args[0];
|
||||||
|
|
||||||
@@ -72,10 +77,12 @@ public class AliasedChannelCommand {
|
|||||||
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull ChatChannel getChatChannel() {
|
@NonNull
|
||||||
|
public ChatChannel getChatChannel() {
|
||||||
return chatChannel;
|
return chatChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
public String getCommandName() {
|
public String getCommandName() {
|
||||||
return commandName;
|
return commandName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class ChannelCommand {
|
public class ChannelCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ChannelCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ChannelCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -51,7 +52,7 @@ public class ChannelCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setChannel(Player player, Object[] args) {
|
private void setChannel(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
ChatChannel channel = (ChatChannel) args[0];
|
ChatChannel channel = (ChatChannel) args[0];
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ public class ChannelCommand {
|
|||||||
"channel", channel.getName()));
|
"channel", channel.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(Player player, Object[] args) {
|
private void sendMessage(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
ChatChannel channel = (ChatChannel) args[0];
|
ChatChannel channel = (ChatChannel) args[0];
|
||||||
String message = (String) args[1];
|
String message = (String) args[1];
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class ChannelListCommand {
|
public class ChannelListCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ChannelListCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ChannelListCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -55,14 +56,14 @@ public class ChannelListCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeSelf(@NonNull Player player, Object[] args) {
|
public void executeSelf(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
Iterator<ChatChannel> allChannels = carbonChat.getChannelManager().getRegistry().values().iterator();
|
Iterator<ChatChannel> allChannels = carbonChat.getChannelManager().getRegistry().values().iterator();
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
getListAndSend(player, user, allChannels);
|
getListAndSend(player, user, allChannels);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeOther(@NonNull CommandSender sender, Object[] args) {
|
public void executeOther(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
Audience cmdSender = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
Audience cmdSender = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
ChatUser user = (ChatUser) args[0];
|
ChatUser user = (ChatUser) args[0];
|
||||||
|
|
||||||
@@ -76,7 +77,7 @@ public class ChannelListCommand {
|
|||||||
getListAndSend(sender, user, allChannels);
|
getListAndSend(sender, user, allChannels);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getListAndSend(@NonNull CommandSender sender, ChatUser user, @NonNull Iterator<ChatChannel> allChannels) {
|
private void getListAndSend(@NonNull CommandSender sender, @NonNull ChatUser user, @NonNull Iterator<ChatChannel> allChannels) {
|
||||||
ChatChannel channel;
|
ChatChannel channel;
|
||||||
List<ChatChannel> canSee = new ArrayList<>();
|
List<ChatChannel> canSee = new ArrayList<>();
|
||||||
List<ChatChannel> cannotSee = new ArrayList<>();
|
List<ChatChannel> cannotSee = new ArrayList<>();
|
||||||
@@ -98,7 +99,7 @@ public class ChannelListCommand {
|
|||||||
|
|
||||||
String availableFormat = carbonChat.getLanguage().getString("available-channels-list");
|
String availableFormat = carbonChat.getLanguage().getString("available-channels-list");
|
||||||
Component availableComponent = carbonChat.getAdventureManager().processMessage(availableFormat, "br", "\n");
|
Component availableComponent = carbonChat.getAdventureManager().processMessage(availableFormat, "br", "\n");
|
||||||
availableComponent = availableComponent.replaceFirstText(Pattern.compile(Pattern.quote("<list>")), (ac) -> availableList);
|
availableComponent = availableComponent.replaceFirstText(Pattern.compile(Pattern.quote("<list>")), (ac) -> availableList);
|
||||||
|
|
||||||
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
|
|
||||||
@@ -113,13 +114,13 @@ public class ChannelListCommand {
|
|||||||
|
|
||||||
String unavailableFormat = carbonChat.getLanguage().getString("unavailable-channels-list");
|
String unavailableFormat = carbonChat.getLanguage().getString("unavailable-channels-list");
|
||||||
Component unavailableComponent = carbonChat.getAdventureManager().processMessage(unavailableFormat, "br", "\n");
|
Component unavailableComponent = carbonChat.getAdventureManager().processMessage(unavailableFormat, "br", "\n");
|
||||||
unavailableComponent = unavailableComponent.replaceFirstText(Pattern.compile(Pattern.quote("<list>")), (uac) -> unavailableList);
|
unavailableComponent = unavailableComponent.replaceFirstText(Pattern.compile(Pattern.quote("<list>")), (uac) -> unavailableList);
|
||||||
|
|
||||||
audience.sendMessage(unavailableComponent);
|
audience.sendMessage(unavailableComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeList(@NonNull Iterator<ChatChannel> iterator, TextComponent.@NonNull Builder list) {
|
private void makeList(@NonNull Iterator<@NonNull ChatChannel> iterator, TextComponent.@NonNull Builder list) {
|
||||||
String listSeparator = carbonChat.getLanguage().getString("channel-list-separator", ", ");
|
String listSeparator = carbonChat.getLanguage().getString("channel-list-separator", ", ");
|
||||||
// TODO: Larry, why did you double assign the listSeparatorComponent?
|
// TODO: Larry, why did you double assign the listSeparatorComponent?
|
||||||
Component listSeparatorComponent = TextComponent.of(listSeparator);
|
Component listSeparatorComponent = TextComponent.of(listSeparator);
|
||||||
@@ -128,7 +129,7 @@ public class ChannelListCommand {
|
|||||||
ChatChannel channel = iterator.next();
|
ChatChannel channel = iterator.next();
|
||||||
list.append(TextComponent.of(channel.getName()));
|
list.append(TextComponent.of(channel.getName()));
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
list.append(listSeparatorComponent);
|
list.append(listSeparatorComponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,19 @@ package net.draycia.carbon.commands;
|
|||||||
|
|
||||||
import dev.jorel.commandapi.CommandAPICommand;
|
import dev.jorel.commandapi.CommandAPICommand;
|
||||||
import dev.jorel.commandapi.CommandPermission;
|
import dev.jorel.commandapi.CommandPermission;
|
||||||
import dev.jorel.commandapi.arguments.Argument;
|
|
||||||
import net.draycia.carbon.CarbonChat;
|
import net.draycia.carbon.CarbonChat;
|
||||||
import net.draycia.carbon.storage.CommandSettings;
|
import net.draycia.carbon.storage.CommandSettings;
|
||||||
import net.draycia.carbon.util.CarbonUtils;
|
|
||||||
import net.draycia.carbon.util.CommandUtils;
|
import net.draycia.carbon.util.CommandUtils;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
public class ChatReloadCommand {
|
public class ChatReloadCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ChatReloadCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ChatReloadCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -33,7 +30,7 @@ public class ChatReloadCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
private void execute(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
carbonChat.reloadConfig();
|
carbonChat.reloadConfig();
|
||||||
carbonChat.reloadFilters();
|
carbonChat.reloadFilters();
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
|
|
||||||
public class ClearChatCommand {
|
public class ClearChatCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ClearChatCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ClearChatCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -33,7 +34,7 @@ public class ClearChatCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
private void execute(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
String format = carbonChat.getModConfig().getString("clear-chat.message", "");
|
String format = carbonChat.getModConfig().getString("clear-chat.message", "");
|
||||||
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n");
|
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n");
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class IgnoreCommand {
|
public class IgnoreCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public IgnoreCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public IgnoreCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -40,7 +41,7 @@ public class IgnoreCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(@NonNull Player player, Object[] args) {
|
private void execute(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser targetUser = (ChatUser) args[0];
|
ChatUser targetUser = (ChatUser) args[0];
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class MeCommand {
|
public class MeCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public MeCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public MeCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -40,7 +41,7 @@ public class MeCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(@NonNull Player player, Object[] args) {
|
private void execute(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
String message = ((String) args[0]).replace("</pre>", "");
|
String message = ((String) args[0]).replace("</pre>", "");
|
||||||
String format = PlaceholderAPI.setPlaceholders(player, carbonChat.getLanguage().getString("me"));
|
String format = PlaceholderAPI.setPlaceholders(player, carbonChat.getLanguage().getString("me"));
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public class MeCommand {
|
|||||||
format = format.replace("<message>", "<pre><message></pre>");
|
format = format.replace("<message>", "<pre><message></pre>");
|
||||||
}
|
}
|
||||||
|
|
||||||
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n",
|
Component component = carbonChat.getAdventureManager().processMessage(format, "br", "\n",
|
||||||
"displayname", player.getDisplayName(), "message", message);
|
"displayname", player.getDisplayName(), "message", message);
|
||||||
|
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class MessageCommand {
|
public class MessageCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public MessageCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public MessageCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -39,7 +40,7 @@ public class MessageCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(Player player, Object[] args) {
|
private void execute(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser targetUser = (ChatUser) args[0];
|
ChatUser targetUser = (ChatUser) args[0];
|
||||||
String message = (String) args[1];
|
String message = (String) args[1];
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class MuteCommand {
|
public class MuteCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public MuteCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public MuteCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -41,7 +42,7 @@ public class MuteCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
private void execute(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = (ChatUser) args[0];
|
ChatUser user = (ChatUser) args[0];
|
||||||
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class NicknameCommand {
|
public class NicknameCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public NicknameCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public NicknameCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -51,7 +52,7 @@ public class NicknameCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeSelf(@NonNull Player player, Object[] args) {
|
private void executeSelf(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
String nickname = (String) args[0];
|
String nickname = (String) args[0];
|
||||||
ChatUser sender = carbonChat.getUserService().wrap(player);
|
ChatUser sender = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ public class NicknameCommand {
|
|||||||
"user", sender.asOfflinePlayer().getName()));
|
"user", sender.asOfflinePlayer().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeOther(@NonNull CommandSender sender, Object[] args) {
|
private void executeOther(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
Audience user = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
Audience user = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
ChatUser target = (ChatUser) args[0];
|
ChatUser target = (ChatUser) args[0];
|
||||||
String nickname = (String) args[1];
|
String nickname = (String) args[1];
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class ReplyCommand {
|
public class ReplyCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ReplyCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ReplyCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -38,7 +39,7 @@ public class ReplyCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(Player player, Object[] args) {
|
private void execute(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
String input = (String) args[0];
|
String input = (String) args[0];
|
||||||
|
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class SetColorCommand {
|
public class SetColorCommand {
|
||||||
|
|
||||||
private final @NonNull CarbonChat carbonChat;
|
@NonNull
|
||||||
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public SetColorCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public SetColorCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class ShadowMuteCommand {
|
public class ShadowMuteCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ShadowMuteCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ShadowMuteCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -41,7 +42,7 @@ public class ShadowMuteCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(@NonNull CommandSender sender, Object[] args) {
|
private void execute(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = (ChatUser) args[0];
|
ChatUser user = (ChatUser) args[0];
|
||||||
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
Audience audience = carbonChat.getAdventureManager().getAudiences().audience(sender);
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class SpyChannelCommand {
|
public class SpyChannelCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public SpyChannelCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public SpyChannelCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -62,7 +63,7 @@ public class SpyChannelCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(Player player, Object[] args) {
|
private void execute(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatChannel chatChannel = (ChatChannel) args[0];
|
ChatChannel chatChannel = (ChatChannel) args[0];
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ public class SpyChannelCommand {
|
|||||||
"color", "<color:" + chatChannel.getChannelColor(user).toString() + ">", "channel", chatChannel.getName()));
|
"color", "<color:" + chatChannel.getChannelColor(user).toString() + ">", "channel", chatChannel.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeWhispers(Player player, Object[] args) {
|
private void executeWhispers(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
@@ -98,7 +99,7 @@ public class SpyChannelCommand {
|
|||||||
user.sendMessage(carbonChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n"));
|
user.sendMessage(carbonChat.getAdventureManager().processMessageWithPapi(player, message, "br", "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeEverything(Player player, Object[] args) {
|
private void executeEverything(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
Boolean shouldSpy = (Boolean) args[0];
|
Boolean shouldSpy = (Boolean) args[0];
|
||||||
|
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class SudoChannelCommand {
|
public class SudoChannelCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public SudoChannelCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public SudoChannelCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -67,7 +68,7 @@ public class SudoChannelCommand {
|
|||||||
"player", user.asOfflinePlayer().getName()));
|
"player", user.asOfflinePlayer().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessageOther(CommandSender sender, ChatUser user, @NonNull ChatChannel channel, String message) {
|
private void sendMessageOther(@NonNull CommandSender sender, @NonNull ChatUser user, @NonNull ChatChannel channel, @NonNull String message) {
|
||||||
Component component = channel.sendMessage(user, message, false);
|
Component component = channel.sendMessage(user, message, false);
|
||||||
|
|
||||||
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
public class ToggleCommand {
|
public class ToggleCommand {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
private final CarbonChat carbonChat;
|
private final CarbonChat carbonChat;
|
||||||
|
|
||||||
public ToggleCommand(CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
public ToggleCommand(@NonNull CarbonChat carbonChat, @NonNull CommandSettings commandSettings) {
|
||||||
this.carbonChat = carbonChat;
|
this.carbonChat = carbonChat;
|
||||||
|
|
||||||
if (!commandSettings.isEnabled()) {
|
if (!commandSettings.isEnabled()) {
|
||||||
@@ -51,7 +52,7 @@ public class ToggleCommand {
|
|||||||
.register();
|
.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeSelf(Player player, Object[] args) {
|
private void executeSelf(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||||
ChatChannel channel = (ChatChannel) args[0];
|
ChatChannel channel = (ChatChannel) args[0];
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ public class ToggleCommand {
|
|||||||
"color", "<color:" + channel.getChannelColor(user).toString() + ">", "channel", channel.getName()));
|
"color", "<color:" + channel.getChannelColor(user).toString() + ">", "channel", channel.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeOther(@NonNull CommandSender sender, Object[] args) {
|
private void executeOther(@NonNull CommandSender sender, @NonNull Object @NonNull [] args) {
|
||||||
ChatUser user = (ChatUser) args[0];
|
ChatUser user = (ChatUser) args[0];
|
||||||
ChatChannel channel = (ChatChannel) args[1];
|
ChatChannel channel = (ChatChannel) args[1];
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user