Fix changing visual mode not updating client

This commit is contained in:
Jesse Boyd 2017-07-25 13:01:02 +10:00
parent 9649482f59
commit 2712f5fea8
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 16 additions and 3 deletions

View File

@ -294,7 +294,7 @@ public class BrushOptionsCommands extends MethodCommands {
}
VisualMode[] modes = VisualMode.values();
VisualMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
tool.setVisualMode(newMode);
tool.setVisualMode(player, newMode);
BBC.BRUSH_VISUAL_MODE_SET.send(player, newMode);
}

View File

@ -474,8 +474,21 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
this.targetMask = mask;
}
public void setVisualMode(VisualMode visualMode) {
public void setVisualMode(Player player, VisualMode visualMode) {
if (visualMode == null) visualMode = VisualMode.NONE;
if (this.visualMode != visualMode) {
if (this.visualMode != VisualMode.NONE) {
clear(player);
}
this.visualMode = visualMode != null ? visualMode : VisualMode.NONE;
if (visualMode != VisualMode.NONE) {
try {
queueVisualization(FawePlayer.wrap(player));
} catch (Throwable e) {
WorldEdit.getInstance().getPlatformManager().handleThrowable(e, player);
}
}
}
}
public TargetMode getTargetMode() {