Don't allow blocks as brushes

fixes #748
Dieser Commit ist enthalten in:
dordsor21 2020-12-11 17:02:54 +00:00
Ursprung ae39f7bba3
Commit 26e3e56988
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -1066,13 +1066,13 @@ public class LocalSession implements TextureHolder {
private transient boolean loadDefaults = true; private transient boolean loadDefaults = true;
public Tool getTool(BaseItem item, Player player) { public Tool getTool(BaseItem item, Player player) {
loadDefaults(player, false);
if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) { if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) {
BrushTool tool = BrushCache.getTool(player, this, item); BrushTool tool = BrushCache.getTool(player, this, item);
if (tool != null) { if (tool != null) {
return tool; return tool;
} }
} }
loadDefaults(player, false);
return getTool(item.getType()); return getTool(item.getType());
} }
@ -1122,6 +1122,9 @@ public class LocalSession implements TextureHolder {
} }
public BrushTool getBrushTool(BaseItem item, Player player, boolean create) throws InvalidToolBindException { public BrushTool getBrushTool(BaseItem item, Player player, boolean create) throws InvalidToolBindException {
if (item.getType().hasBlockType()) {
throw new InvalidToolBindException(item.getType(), "Blocks can't be used");
}
Tool tool = getTool(item, player); Tool tool = getTool(item, player);
if (!(tool instanceof BrushTool)) { if (!(tool instanceof BrushTool)) {
if (create) { if (create) {