diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/commands/Commands.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/commands/Commands.java index 6f46e113..b32ea461 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/commands/Commands.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/commands/Commands.java @@ -100,13 +100,19 @@ public void init() { LiteralCommandNode debugCommand = literal("debug") .requires(requirements("bluemap.debug")) - .executes(this::debugCommand) - - .then(argument("world", StringArgumentType.string()).suggests(new WorldSuggestionProvider<>(plugin)) - .then(argument("x", DoubleArgumentType.doubleArg()) - .then(argument("y", DoubleArgumentType.doubleArg()) - .then(argument("z", DoubleArgumentType.doubleArg()) - .executes(this::debugCommand))))) + + .then(literal("block") + .executes(this::debugBlockCommand) + + .then(argument("world", StringArgumentType.string()).suggests(new WorldSuggestionProvider<>(plugin)) + .then(argument("x", DoubleArgumentType.doubleArg()) + .then(argument("y", DoubleArgumentType.doubleArg()) + .then(argument("z", DoubleArgumentType.doubleArg()) + .executes(this::debugBlockCommand)))))) + + .then(literal("cache") + .executes(this::debugClearCacheCommand)) + .build(); LiteralCommandNode pauseCommand = @@ -310,7 +316,18 @@ public int reloadCommand(CommandContext context) { return 1; } - public int debugCommand(CommandContext context) throws CommandSyntaxException { + public int debugClearCacheCommand(CommandContext context) throws CommandSyntaxException { + CommandSource source = commandSourceInterface.apply(context.getSource()); + + for (World world : plugin.getWorlds()) { + world.invalidateChunkCache(); + } + + source.sendMessage(Text.of(TextColor.GREEN, "All caches cleared!")); + return 1; + } + + public int debugBlockCommand(CommandContext context) throws CommandSyntaxException { final CommandSource source = commandSourceInterface.apply(context.getSource()); // parse arguments @@ -358,6 +375,7 @@ public int debugCommand(CommandContext context) throws CommandSyntaxException } source.sendMessages(Lists.newArrayList( + Text.of(TextColor.GOLD, "Is generated: ", TextColor.WHITE, world.isChunkGenerated(world.blockPosToChunkPos(blockPos))), Text.of(TextColor.GOLD, "Block at you: ", TextColor.WHITE, block, TextColor.GRAY, blockIdMeta), Text.of(TextColor.GOLD, "Block below you: ", TextColor.WHITE, blockBelow, TextColor.GRAY, blockBelowIdMeta) ));