diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java index a2f3441f4..de66c2fe3 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandExecutor.java @@ -80,8 +80,8 @@ public class CommandExecutor { Map commands = geyser.getCommandManager().getCommands(); // Only show commands they have permission to use - for (String name : commands.keySet()) { - GeyserCommand geyserCommand = commands.get(name); + for (Map.Entry entry : commands.entrySet()) { + GeyserCommand geyserCommand = entry.getValue(); if (sender.hasPermission(geyserCommand.getPermission())) { if (geyserCommand.isBedrockOnly()) { @@ -89,7 +89,7 @@ public class CommandExecutor { continue; } - availableCommands.add(name); + availableCommands.add(entry.getKey()); } } diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java index f66e8494c..5e4fe3dd5 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandManager.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandManager.java @@ -38,7 +38,7 @@ import java.util.*; public abstract class CommandManager { @Getter - private final Map commands = Collections.synchronizedMap(new HashMap<>()); + private final Map commands = new HashMap<>(); private final GeyserImpl geyser; diff --git a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java index 4d4a21319..633912300 100644 --- a/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java +++ b/core/src/main/java/org/geysermc/geyser/command/defaults/HelpCommand.java @@ -25,6 +25,7 @@ package org.geysermc.geyser.command.defaults; +import org.geysermc.common.PlatformType; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommand; @@ -60,16 +61,17 @@ public class HelpCommand extends GeyserCommand { sender.sendMessage(header); Map cmds = geyser.getCommandManager().getCommands(); - for (String cmdName : cmds.keySet()) { - GeyserCommand cmd = cmds.get(cmdName); + for (Map.Entry entry : cmds.entrySet()) { + GeyserCommand cmd = entry.getValue(); - if (sender.hasPermission(cmd.getPermission())) { + // Standalone hack-in since it doesn't have a concept of permissions + if (geyser.getPlatformType() == PlatformType.STANDALONE || sender.hasPermission(cmd.getPermission())) { // Only list commands the player can actually run if (cmd.isBedrockOnly() && session == null) { continue; } - sender.sendMessage(ChatColor.YELLOW + "/geyser " + cmdName + ChatColor.WHITE + ": " + + sender.sendMessage(ChatColor.YELLOW + "/geyser " + entry.getKey() + ChatColor.WHITE + ": " + GeyserLocale.getPlayerLocaleString(cmd.getDescription(), sender.getLocale())); } } diff --git a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java index d766c4b4c..ac7084980 100644 --- a/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java +++ b/core/src/main/java/org/geysermc/geyser/level/GeyserWorldManager.java @@ -37,6 +37,8 @@ import org.geysermc.geyser.session.cache.ChunkCache; import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator; import org.geysermc.geyser.level.block.BlockStateValues; +import java.util.Locale; + public class GeyserWorldManager extends WorldManager { private static final Object2ObjectMap gameruleCache = new Object2ObjectOpenHashMap<>(); @@ -107,12 +109,12 @@ public class GeyserWorldManager extends WorldManager { @Override public void setPlayerGameMode(GeyserSession session, GameMode gameMode) { - session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/gamemode " + gameMode.name().toLowerCase(Locale.ROOT))); } @Override public void setDifficulty(GeyserSession session, Difficulty difficulty) { - session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase())); + session.sendDownstreamPacket(new ServerboundChatPacket("/difficulty " + difficulty.name().toLowerCase(Locale.ROOT))); } @Override