mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
commanding-pipeline diff
This commit is contained in:
@ -91,6 +91,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
}
|
||||
|
||||
protected static int MAX_RANGE = 500;
|
||||
protected static int DEFAULT_RANGE = 240; // 500 is laggy as the default
|
||||
protected int range = -1;
|
||||
private VisualMode visualMode = VisualMode.NONE;
|
||||
private TargetMode targetMode = TargetMode.TARGET_BLOCK_RANGE;
|
||||
@ -177,7 +178,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
if (targetMode != TargetMode.TARGET_BLOCK_RANGE) {
|
||||
map.put("target", targetMode);
|
||||
}
|
||||
if (range != -1 && range != MAX_RANGE) {
|
||||
if (range != -1 && range != DEFAULT_RANGE) {
|
||||
map.put("range", range);
|
||||
}
|
||||
if (targetOffset != 0) {
|
||||
@ -408,7 +409,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
||||
* @return the range of the brush in blocks
|
||||
*/
|
||||
public int getRange() {
|
||||
return (range < 0) ? MAX_RANGE : Math.min(range, MAX_RANGE);
|
||||
return (range < 0) ? DEFAULT_RANGE : Math.min(range, MAX_RANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,8 +74,9 @@ public class DistanceWand extends BrushTool implements DoubleActionTraceTool {
|
||||
private Location getTarget(Player player) {
|
||||
Location target;
|
||||
Mask mask = getTraceMask();
|
||||
if (this.range > -1) {
|
||||
target = player.getBlockTrace(getRange(), true, mask);
|
||||
int range = getRange();
|
||||
if (range < MAX_RANGE) {
|
||||
target = player.getBlockTrace(range, true, mask);
|
||||
} else {
|
||||
target = player.getBlockTrace(MAX_RANGE, false, mask);
|
||||
}
|
||||
|
@ -26,30 +26,26 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
public class NavigationWand implements DoubleActionTraceTool {
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
if (!player.hasPermission("worldedit.navigation.jumpto.tool")) {
|
||||
return false;
|
||||
}
|
||||
final int maxDist = config.navigationWandMaxDistance;
|
||||
if (maxDist <= 0) {
|
||||
return false;
|
||||
}
|
||||
Location pos = player.getSolidBlockTrace(maxDist);
|
||||
if (pos != null) {
|
||||
player.findFreePosition(pos);
|
||||
} else {
|
||||
player.printError("No block in sight (or too far)!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public enum NavigationWand implements DoubleActionTraceTool {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
final int maxDist = config.navigationWandMaxDistance;
|
||||
if (maxDist <= 0) {
|
||||
return false;
|
||||
}
|
||||
Location pos = player.getSolidBlockTrace(maxDist);
|
||||
if (pos != null) {
|
||||
player.findFreePosition(pos);
|
||||
} else {
|
||||
player.printError("No block in sight (or too far)!");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
if (!player.hasPermission("worldedit.navigation.thru.tool")) {
|
||||
return false;
|
||||
}
|
||||
final int maxDist = config.navigationWandMaxDistance;
|
||||
if (maxDist <= 0) {
|
||||
return false;
|
||||
@ -63,6 +59,6 @@ public class NavigationWand implements DoubleActionTraceTool {
|
||||
|
||||
@Override
|
||||
public boolean canUse(Actor actor) {
|
||||
return true; // skip check here - checked separately for primary/secondary
|
||||
return actor.hasPermission("worldedit.navigation.jumpto.tool"); // check should be here
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
|
||||
public class SelectionWand implements DoubleActionBlockTool {
|
||||
public enum SelectionWand implements DoubleActionBlockTool {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
|
||||
|
@ -34,4 +34,4 @@ public class SphereBrush implements Brush {
|
||||
}
|
||||
editSession.makeSphere(position, pattern, size, size, size, true);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user