diff --git a/core/src/main/java/org/geysermc/geyser/command/CommandRegistry.java b/core/src/main/java/org/geysermc/geyser/command/CommandRegistry.java index 5d44016c9..838ab71b1 100644 --- a/core/src/main/java/org/geysermc/geyser/command/CommandRegistry.java +++ b/core/src/main/java/org/geysermc/geyser/command/CommandRegistry.java @@ -346,7 +346,7 @@ public class CommandRegistry implements EventRegistrar { List data = new ArrayList<>(); for (var node : commandTree.children()) { - List> params = createParamData(node); + List> params = createParamData(session, node); params.forEach(param -> data.add(new CommandOverloadData(false, param.toArray(CommandParamData[]::new)))); } @@ -358,7 +358,13 @@ public class CommandRegistry implements EventRegistrar { }); } - private List> createParamData(CommandNode node) { + private List> createParamData(GeyserSession session, CommandNode node) { + var command = node.command(); + if (command != null && !session.hasPermission(command.commandPermission().permissionString())) { + // Triggers with subcommands like Geyser dump, stop, etc. + return Collections.emptyList(); + } + CommandParamData data = new CommandParamData(); var component = node.component(); data.setName(component.name()); @@ -396,7 +402,7 @@ public class CommandRegistry implements EventRegistrar { // If a node has multiple children, this will need to be represented // by creating a new list/branch for each and cloning this node down each line. for (var child : children) { - collectiveData.addAll(createParamData(child)); + collectiveData.addAll(createParamData(session, child)); } collectiveData.forEach(list -> list.add(0, data)); return collectiveData; diff --git a/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserRecipe.java b/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserRecipe.java index b0f5a1b44..7d25c5803 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserRecipe.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserRecipe.java @@ -25,7 +25,6 @@ package org.geysermc.geyser.inventory.recipe; -import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay; /** @@ -37,6 +36,5 @@ public interface GeyserRecipe { */ boolean isShaped(); - @Nullable SlotDisplay result(); } diff --git a/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapedRecipe.java b/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapedRecipe.java index 70b71cf4d..7fc1d52aa 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapedRecipe.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapedRecipe.java @@ -25,13 +25,12 @@ package org.geysermc.geyser.inventory.recipe; -import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.ShapedCraftingRecipeDisplay; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay; import java.util.List; -public record GeyserShapedRecipe(int width, int height, List ingredients, @Nullable SlotDisplay result) implements GeyserRecipe { +public record GeyserShapedRecipe(int width, int height, List ingredients, SlotDisplay result) implements GeyserRecipe { public GeyserShapedRecipe(ShapedCraftingRecipeDisplay data) { this(data.width(), data.height(), data.ingredients(), data.result()); diff --git a/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapelessRecipe.java b/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapelessRecipe.java index 90eeb01c9..ed513a804 100644 --- a/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapelessRecipe.java +++ b/core/src/main/java/org/geysermc/geyser/inventory/recipe/GeyserShapelessRecipe.java @@ -25,13 +25,12 @@ package org.geysermc.geyser.inventory.recipe; -import org.checkerframework.checker.nullness.qual.Nullable; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.ShapelessCraftingRecipeDisplay; import org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay; import java.util.List; -public record GeyserShapelessRecipe(List ingredients, @Nullable SlotDisplay result) implements GeyserRecipe { +public record GeyserShapelessRecipe(List ingredients, SlotDisplay result) implements GeyserRecipe { public GeyserShapelessRecipe(ShapelessCraftingRecipeDisplay data) { this(data.ingredients(), data.result()); diff --git a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java index b95da4f8f..5b7213bee 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java +++ b/core/src/main/java/org/geysermc/geyser/registry/populator/BlockRegistryPopulator.java @@ -196,11 +196,10 @@ public final class BlockRegistryPopulator { GeyserBedrockBlock[] bedrockRuntimeMap = new GeyserBedrockBlock[blockStates.size()]; for (int i = 0; i < blockStates.size(); i++) { NbtMap tag = blockStates.get(i); - if (blockStateOrderedMap.containsKey(tag)) { + GeyserBedrockBlock block = new GeyserBedrockBlock(i, tag); + if (blockStateOrderedMap.put(tag, block) != null) { throw new AssertionError("Duplicate block states in Bedrock palette: " + tag); } - GeyserBedrockBlock block = new GeyserBedrockBlock(i, tag); - blockStateOrderedMap.put(tag, block); bedrockRuntimeMap[i] = block; } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockPlayerAuthInputTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockPlayerAuthInputTranslator.java index a07ebe04a..3c9b41488 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockPlayerAuthInputTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/bedrock/entity/player/BedrockPlayerAuthInputTranslator.java @@ -229,12 +229,12 @@ public final class BedrockPlayerAuthInputTranslator extends PacketTranslator