mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Use keys instead of names when possible
This commit is contained in:
1 parent
d9299c335c
commit
0d256d95cc
6 files changed
+8
-8
No files matched your search
@@ -26,7 +26,7 @@ public class SetColorCommand extends BaseCommand {
|
||||
|
||||
ChatUser user = carbonChat.getUserService().wrap(player);
|
||||
|
||||
if (!player.hasPermission("carbonchat.setcolor." + channel.getName())) {
|
||||
if (!player.hasPermission("carbonchat.setcolor." + channel.getKey())) {
|
||||
throw new ConditionFailedException("You can't set colors for this channel!");
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class UserFormattingListener implements Listener {
|
||||
|
||||
Player p = event.getUser().asPlayer();
|
||||
if (!(p.hasPermission("carbonchat.formatting") ||
|
||||
p.hasPermission("carbonchat.channels." + event.getChannel().getName() + ".formatting"))) {
|
||||
p.hasPermission("carbonchat.channels." + event.getChannel().getKey() + ".formatting"))) {
|
||||
suppressFormatting(event);
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CommandManager {
|
||||
|
||||
for (ChatChannel chatChannel : carbonChat.getChannelManager().getRegistry().values()) {
|
||||
if (chatChannel.canPlayerUse(user)) {
|
||||
completions.add(chatChannel.getName());
|
||||
completions.add(chatChannel.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CommandManager {
|
||||
List<String> completions = new ArrayList<>();
|
||||
|
||||
for (ChatChannel chatChannel : carbonChat.getChannelManager().getRegistry().values()) {
|
||||
completions.add(chatChannel.getName());
|
||||
completions.add(chatChannel.getKey());
|
||||
}
|
||||
|
||||
return completions;
|
||||
@@ -48,7 +48,7 @@ public class CommandManager {
|
||||
String name = context.popFirstArg();
|
||||
|
||||
for (ChatChannel chatChannel : carbonChat.getChannelManager().getRegistry().values()) {
|
||||
if (chatChannel.getName().equalsIgnoreCase(name)) {
|
||||
if (chatChannel.getKey().equalsIgnoreCase(name)) {
|
||||
return chatChannel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class PluginMessageManager implements PluginMessageListener {
|
||||
public void sendMessage(ChatChannel chatChannel, Player player, String message) {
|
||||
ByteArrayDataOutput msg = ByteStreams.newDataOutput();
|
||||
|
||||
msg.writeUTF(chatChannel.getName());
|
||||
msg.writeUTF(chatChannel.getKey());
|
||||
msg.writeUTF(player.getUniqueId().toString());
|
||||
msg.writeUTF(message);
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ public class CarbonChatUser implements ChatUser, ForwardingAudience {
|
||||
|
||||
@Override
|
||||
public UserChannelSettings getChannelSettings(ChatChannel channel) {
|
||||
return channelSettings.computeIfAbsent(channel.getName(), (name) -> {
|
||||
return channelSettings.computeIfAbsent(channel.getKey(), (name) -> {
|
||||
return new SimpleUserChannelSettings(uuid, channel.getKey());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class MySQLUserService implements UserService {
|
||||
String selectedName = null;
|
||||
|
||||
if (user.getSelectedChannel() != null) {
|
||||
selectedName = user.getSelectedChannel().getName();
|
||||
selectedName = user.getSelectedChannel().getKey();
|
||||
}
|
||||
|
||||
carbonChat.getLogger().info("Saving user data!");
|
||||
|
||||
Reference in new issue
Block a user