mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Fix spacing
This commit is contained in:
1 parent
a8788c7d3d
commit
a47ff4e7b2
74 files changed
+5000
-4927
No files matched your search
@@ -15,75 +15,75 @@ import java.util.LinkedHashMap;
|
||||
|
||||
public class AliasedChannelCommand {
|
||||
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
@NonNull
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
@NonNull
|
||||
private final ChatChannel chatChannel;
|
||||
@NonNull
|
||||
private final ChatChannel chatChannel;
|
||||
|
||||
@NonNull
|
||||
private final String commandName;
|
||||
@NonNull
|
||||
private final String commandName;
|
||||
|
||||
public AliasedChannelCommand(@NonNull CarbonChat carbonChat, @NonNull ChatChannel chatChannel) {
|
||||
this.carbonChat = carbonChat;
|
||||
this.chatChannel = chatChannel;
|
||||
public AliasedChannelCommand(@NonNull CarbonChat carbonChat, @NonNull ChatChannel chatChannel) {
|
||||
this.carbonChat = carbonChat;
|
||||
this.chatChannel = chatChannel;
|
||||
|
||||
this.commandName = chatChannel.getKey();
|
||||
this.commandName = chatChannel.getKey();
|
||||
|
||||
LinkedHashMap<String, Argument> setChannelArguments = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, Argument> setChannelArguments = new LinkedHashMap<>();
|
||||
|
||||
new CommandAPICommand(commandName)
|
||||
.withArguments(setChannelArguments)
|
||||
.withPermission(CommandPermission.fromString("carbonchat.channel"))
|
||||
.executesPlayer(this::setChannel)
|
||||
.register();
|
||||
new CommandAPICommand(commandName)
|
||||
.withArguments(setChannelArguments)
|
||||
.withPermission(CommandPermission.fromString("carbonchat.channel"))
|
||||
.executesPlayer(this::setChannel)
|
||||
.register();
|
||||
|
||||
LinkedHashMap<String, Argument> sendMessageArguments = new LinkedHashMap<>();
|
||||
sendMessageArguments.put("message", new GreedyStringArgument());
|
||||
LinkedHashMap<String, Argument> sendMessageArguments = new LinkedHashMap<>();
|
||||
sendMessageArguments.put("message", new GreedyStringArgument());
|
||||
|
||||
new CommandAPICommand(commandName)
|
||||
.withArguments(sendMessageArguments)
|
||||
.withPermission(CommandPermission.fromString("carbonchat.channel.message"))
|
||||
.executesPlayer(this::sendMessage)
|
||||
.register();
|
||||
new CommandAPICommand(commandName)
|
||||
.withArguments(sendMessageArguments)
|
||||
.withPermission(CommandPermission.fromString("carbonchat.channel.message"))
|
||||
.executesPlayer(this::sendMessage)
|
||||
.register();
|
||||
}
|
||||
|
||||
private void setChannel(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
|
||||
if (user.getChannelSettings(getChatChannel()).isIgnored()) {
|
||||
user.sendMessage(carbonChat.getAdventureManager().processMessageWithPapi(player, getChatChannel().getCannotUseMessage(),
|
||||
"br", "\n",
|
||||
"color", "<" + getChatChannel().getChannelColor(user).toString() + ">",
|
||||
"channel", getChatChannel().getName()));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void setChannel(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
user.setSelectedChannel(getChatChannel());
|
||||
|
||||
if (user.getChannelSettings(getChatChannel()).isIgnored()) {
|
||||
user.sendMessage(carbonChat.getAdventureManager().processMessageWithPapi(player, getChatChannel().getCannotUseMessage(),
|
||||
"br", "\n",
|
||||
"color", "<" + getChatChannel().getChannelColor(user).toString() + ">",
|
||||
"channel", getChatChannel().getName()));
|
||||
user.sendMessage(carbonChat.getAdventureManager().processMessageWithPapi(player, getChatChannel().getSwitchMessage(),
|
||||
"br", "\n",
|
||||
"color", "<" + getChatChannel().getChannelColor(user).toString() + ">",
|
||||
"channel", getChatChannel().getName()));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
private void sendMessage(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
String message = (String) args[0];
|
||||
|
||||
user.setSelectedChannel(getChatChannel());
|
||||
Component component = getChatChannel().sendMessage(user, message, false);
|
||||
|
||||
user.sendMessage(carbonChat.getAdventureManager().processMessageWithPapi(player, getChatChannel().getSwitchMessage(),
|
||||
"br", "\n",
|
||||
"color", "<" + getChatChannel().getChannelColor(user).toString() + ">",
|
||||
"channel", getChatChannel().getName()));
|
||||
}
|
||||
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
||||
}
|
||||
|
||||
private void sendMessage(@NonNull Player player, @NonNull Object @NonNull [] args) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
String message = (String) args[0];
|
||||
@NonNull
|
||||
public ChatChannel getChatChannel() {
|
||||
return chatChannel;
|
||||
}
|
||||
|
||||
Component component = getChatChannel().sendMessage(user, message, false);
|
||||
|
||||
carbonChat.getAdventureManager().getAudiences().console().sendMessage(component);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ChatChannel getChatChannel() {
|
||||
return chatChannel;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getCommandName() {
|
||||
return commandName;
|
||||
}
|
||||
@NonNull
|
||||
public String getCommandName() {
|
||||
return commandName;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user