mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Removed and reimplemented mrapple's selection at a distance. It is now a brush tool, meaning it can be bound as other tools can and it subject to Nichts' /range command, so you can select points in midair.
This commit is contained in:
@ -879,26 +879,31 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on left click (not on a block).
|
||||
* Called on arm swing.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean handleLeftClick(LocalPlayer player) {
|
||||
public boolean handleArmSwing(LocalPlayer player) {
|
||||
LocalSession session = getSession(player);
|
||||
WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance);
|
||||
if (player.getItemInHand() == config.wandItem) {
|
||||
return selectFirstPoint(player, session, pos);
|
||||
} else if (player.getItemInHand() == config.navigationWand
|
||||
if (player.getItemInHand() == config.navigationWand
|
||||
&& config.navigationWandMaxDistance > 0
|
||||
&& player.hasPermission("worldedit.navigation.jumpto")) {
|
||||
WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance);
|
||||
if (pos != null) {
|
||||
player.findFreePosition(pos);
|
||||
} else {
|
||||
player.printError("No block in sight (or too far)!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tool tool = session.getTool(player.getItemInHand());
|
||||
if (tool != null && tool instanceof DoubleActionTraceTool) {
|
||||
if (tool.canUse(player)) {
|
||||
((DoubleActionTraceTool) tool).actSecondary(server, config, player, session);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -918,16 +923,13 @@ public class WorldEdit {
|
||||
if (!player.passThroughForwardWall(40)) {
|
||||
player.printError("Nothing to pass through!");
|
||||
}
|
||||
} else if (player.getItemInHand() == config.wandItem) {
|
||||
WorldVector pos = player.getSolidBlockTrace(config.navigationWandMaxDistance);
|
||||
return selectSecondPoint(player, session, pos);
|
||||
}
|
||||
|
||||
Tool tool = session.getTool(player.getItemInHand());
|
||||
|
||||
if (tool != null && tool instanceof TraceTool) {
|
||||
if (tool.canUse(player)) {
|
||||
((TraceTool)tool).act(server, config, player, session);
|
||||
((TraceTool) tool).actPrimary(server, config, player, session);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -943,10 +945,18 @@ public class WorldEdit {
|
||||
* @return false if you want the action to go through
|
||||
*/
|
||||
public boolean handleBlockRightClick(LocalPlayer player, WorldVector clicked) {
|
||||
int itemInHand = player.getItemInHand();
|
||||
|
||||
LocalSession session = getSession(player);
|
||||
|
||||
if (player.getItemInHand() == config.wandItem) {
|
||||
return selectSecondPoint(player, session, clicked);
|
||||
if (itemInHand == config.wandItem && session.isToolControlEnabled()
|
||||
&& player.hasPermission("worldedit.selection.pos")) {
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectSecondary(clicked)) {
|
||||
selector.explainSecondarySelection(player, session, clicked);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Tool tool = session.getTool(player.getItemInHand());
|
||||
@ -971,8 +981,22 @@ public class WorldEdit {
|
||||
public boolean handleBlockLeftClick(LocalPlayer player, WorldVector clicked) {
|
||||
LocalSession session = getSession(player);
|
||||
|
||||
if (player.getItemInHand() == config.wandItem) {
|
||||
return selectFirstPoint(player, session, clicked);
|
||||
if (player.getItemInHand() == config.wandItem) {
|
||||
if (session.isToolControlEnabled()
|
||||
&& player.hasPermission("worldedit.selection.pos")) {
|
||||
// Bug workaround
|
||||
if (clicked.getBlockX() == 0 && clicked.getBlockY() == 0
|
||||
&& clicked.getBlockZ() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectPrimary(clicked)) {
|
||||
selector.explainPrimarySelection(player, session, clicked);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (player.isHoldingPickAxe() && session.hasSuperPickAxe()) {
|
||||
if (session.getSuperPickaxe() != null) {
|
||||
if (session.getSuperPickaxe().canUse(player)) {
|
||||
@ -991,40 +1015,6 @@ public class WorldEdit {
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean selectFirstPoint(LocalPlayer player, LocalSession session, WorldVector clicked)
|
||||
{
|
||||
if (session.isToolControlEnabled()
|
||||
&& player.hasPermission("worldedit.selection.pos")) {
|
||||
// Bug workaround
|
||||
if (clicked.getBlockX() == 0 && clicked.getBlockY() == 0
|
||||
&& clicked.getBlockZ() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectPrimary(clicked)) {
|
||||
selector.explainPrimarySelection(player, session, clicked);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean selectSecondPoint(LocalPlayer player, LocalSession session, WorldVector clicked)
|
||||
{
|
||||
if (session.isToolControlEnabled()
|
||||
&& player.hasPermission("worldedit.selection.pos")) {
|
||||
RegionSelector selector = session.getRegionSelector(player.getWorld());
|
||||
if (selector.selectSecondary(clicked)) {
|
||||
selector.explainSecondarySelection(player, session, clicked);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user