mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-12-29 04:18:01 +01:00
Add debug command to clear caches
This commit is contained in:
parent
7405520713
commit
3fd22e5b45
@ -100,13 +100,19 @@ public void init() {
|
|||||||
LiteralCommandNode<S> debugCommand =
|
LiteralCommandNode<S> debugCommand =
|
||||||
literal("debug")
|
literal("debug")
|
||||||
.requires(requirements("bluemap.debug"))
|
.requires(requirements("bluemap.debug"))
|
||||||
.executes(this::debugCommand)
|
|
||||||
|
.then(literal("block")
|
||||||
.then(argument("world", StringArgumentType.string()).suggests(new WorldSuggestionProvider<>(plugin))
|
.executes(this::debugBlockCommand)
|
||||||
.then(argument("x", DoubleArgumentType.doubleArg())
|
|
||||||
.then(argument("y", DoubleArgumentType.doubleArg())
|
.then(argument("world", StringArgumentType.string()).suggests(new WorldSuggestionProvider<>(plugin))
|
||||||
.then(argument("z", DoubleArgumentType.doubleArg())
|
.then(argument("x", DoubleArgumentType.doubleArg())
|
||||||
.executes(this::debugCommand)))))
|
.then(argument("y", DoubleArgumentType.doubleArg())
|
||||||
|
.then(argument("z", DoubleArgumentType.doubleArg())
|
||||||
|
.executes(this::debugBlockCommand))))))
|
||||||
|
|
||||||
|
.then(literal("cache")
|
||||||
|
.executes(this::debugClearCacheCommand))
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
LiteralCommandNode<S> pauseCommand =
|
LiteralCommandNode<S> pauseCommand =
|
||||||
@ -310,7 +316,18 @@ public int reloadCommand(CommandContext<S> context) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int debugCommand(CommandContext<S> context) throws CommandSyntaxException {
|
public int debugClearCacheCommand(CommandContext<S> 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<S> context) throws CommandSyntaxException {
|
||||||
final CommandSource source = commandSourceInterface.apply(context.getSource());
|
final CommandSource source = commandSourceInterface.apply(context.getSource());
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
@ -358,6 +375,7 @@ public int debugCommand(CommandContext<S> context) throws CommandSyntaxException
|
|||||||
}
|
}
|
||||||
|
|
||||||
source.sendMessages(Lists.newArrayList(
|
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 at you: ", TextColor.WHITE, block, TextColor.GRAY, blockIdMeta),
|
||||||
Text.of(TextColor.GOLD, "Block below you: ", TextColor.WHITE, blockBelow, TextColor.GRAY, blockBelowIdMeta)
|
Text.of(TextColor.GOLD, "Block below you: ", TextColor.WHITE, blockBelow, TextColor.GRAY, blockBelowIdMeta)
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user