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>
Dieser Commit ist enthalten in:
Jordan 2023-03-31 19:45:34 +01:00 committet von GitHub
Ursprung 508b94ddc3
Commit a9e1d5009c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -169,9 +169,14 @@ public class ToolUtilCommands {
public void traceMask( public void traceMask(
Player player, LocalSession session, Player player, LocalSession session,
@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 {

Datei anzeigen

@ -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.",