fix: add null-check for brush in traceMask (#2160)

* fix: add null-check for brush in traceMask
 - Fixes #2149

* Switch to print from printError

Co-authored-by: Alexander Brandes <mc.cache@web.de>

---------

Co-authored-by: Alexander Brandes <mc.cache@web.de>
This commit is contained in:
Jordan 2023-03-31 19:45:34 +01:00 committed by GitHub
parent 508b94ddc3
commit a9e1d5009c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -171,7 +171,12 @@ public class ToolUtilCommands {
@Arg(desc = "The trace mask to set", def = "") @Arg(desc = "The trace mask to set", def = "")
Mask maskOpt Mask maskOpt
) throws WorldEditException { ) throws WorldEditException {
session.getBrushTool(player, false).setTraceMask(maskOpt); BrushTool brushTool = session.getBrushTool(player, false);
if (brushTool == null) {
player.print(Caption.of("worldedit.brush.none.equipped"));
return;
}
brushTool.setTraceMask(maskOpt);
if (maskOpt == null) { if (maskOpt == null) {
player.print(Caption.of("worldedit.tool.tracemask.disabled")); player.print(Caption.of("worldedit.tool.tracemask.disabled"));
} else { } else {

View File

@ -283,6 +283,7 @@
"worldedit.brush.butcher.equip": "Butcher brush equipped ({0}).", "worldedit.brush.butcher.equip": "Butcher brush equipped ({0}).",
"worldedit.brush.operation.equip": "Set brush to {0}.", "worldedit.brush.operation.equip": "Set brush to {0}.",
"worldedit.brush.none.equip": "Brush unbound from your current item.", "worldedit.brush.none.equip": "Brush unbound from your current item.",
"worldedit.brush.none.equipped": "You have no brush bound to your current item. Try /brush sphere for a basic brush.",
"worldedit.setbiome.changed": "Biomes were changed in {0} columns. You may have to rejoin your game (or close and reopen your world) to see a change.", "worldedit.setbiome.changed": "Biomes were changed in {0} columns. You may have to rejoin your game (or close and reopen your world) to see a change.",
"worldedit.setbiome.not-locatable": "Command sender must be present in the world to use the -p flag.", "worldedit.setbiome.not-locatable": "Command sender must be present in the world to use the -p flag.",
"worldedit.drawsel.disabled": "Server CUI disabled.", "worldedit.drawsel.disabled": "Server CUI disabled.",