3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 19:10:07 +01:00

Further cleanup of input handlers.

Slight deviation from previous behaviour:
Wand and navigation wand can no longer be used as ordinary tool binds.
However, these are already blocked elsewhere anyway, so it is unimportant.
Dieser Commit ist enthalten in:
TomyLobo 2011-11-20 02:00:12 +01:00
Ursprung 71d302c893
Commit cf30a63018

Datei anzeigen

@ -1092,12 +1092,17 @@ public class WorldEdit {
* @return false if you want the action to go through * @return false if you want the action to go through
*/ */
public boolean handleBlockRightClick(LocalPlayer player, WorldVector clicked) { public boolean handleBlockRightClick(LocalPlayer player, WorldVector clicked) {
int itemInHand = player.getItemInHand();
LocalSession session = getSession(player); LocalSession session = getSession(player);
if (itemInHand == config.wandItem && session.isToolControlEnabled() if (player.getItemInHand() == config.wandItem) {
&& player.hasPermission("worldedit.selection.pos")) { if (!session.isToolControlEnabled()) {
return false;
}
if (!player.hasPermission("worldedit.selection.pos")) {
return false;
}
RegionSelector selector = session.getRegionSelector(player.getWorld()); RegionSelector selector = session.getRegionSelector(player.getWorld());
if (selector.selectSecondary(clicked)) { if (selector.selectSecondary(clicked)) {
selector.explainSecondarySelection(player, session, clicked); selector.explainSecondarySelection(player, session, clicked);
@ -1107,7 +1112,6 @@ public class WorldEdit {
} }
Tool tool = session.getTool(player.getItemInHand()); Tool tool = session.getTool(player.getItemInHand());
if (tool != null && tool instanceof BlockTool) { if (tool != null && tool instanceof BlockTool) {
if (tool.canUse(player)) { if (tool.canUse(player)) {
((BlockTool)tool).actPrimary(server, config, player, session, clicked); ((BlockTool)tool).actPrimary(server, config, player, session, clicked);
@ -1129,8 +1133,13 @@ public class WorldEdit {
LocalSession session = getSession(player); LocalSession session = getSession(player);
if (player.getItemInHand() == config.wandItem) { if (player.getItemInHand() == config.wandItem) {
if (session.isToolControlEnabled() if (!session.isToolControlEnabled()) {
&& player.hasPermission("worldedit.selection.pos")) { return false;
}
if (!player.hasPermission("worldedit.selection.pos")) {
return false;
}
RegionSelector selector = session.getRegionSelector(player.getWorld()); RegionSelector selector = session.getRegionSelector(player.getWorld());
if (selector.selectPrimary(clicked)) { if (selector.selectPrimary(clicked)) {
@ -1139,17 +1148,15 @@ public class WorldEdit {
return true; return true;
} }
} else if (player.isHoldingPickAxe() && session.hasSuperPickAxe()) {
if (session.getSuperPickaxe() != null) { if (player.isHoldingPickAxe() && session.hasSuperPickAxe()) {
if (session.getSuperPickaxe().canUse(player)) { final BlockTool superPickaxe = session.getSuperPickaxe();
return session.getSuperPickaxe().actPrimary(server, config, if (superPickaxe != null && superPickaxe.canUse(player)) {
player, session, clicked); return superPickaxe.actPrimary(server, config, player, session, clicked);
}
} }
} }
Tool tool = session.getTool(player.getItemInHand()); Tool tool = session.getTool(player.getItemInHand());
if (tool != null && tool instanceof DoubleActionBlockTool) { if (tool != null && tool instanceof DoubleActionBlockTool) {
if (tool.canUse(player)) { if (tool.canUse(player)) {
((DoubleActionBlockTool)tool).actSecondary(server, config, player, session, clicked); ((DoubleActionBlockTool)tool).actSecondary(server, config, player, session, clicked);