commanding-pipeline diff

This commit is contained in:
Jesse Boyd
2019-10-23 05:23:52 +01:00
parent fb91456bdd
commit 2080e9786b
193 changed files with 5449 additions and 3491 deletions

View File

@@ -56,6 +56,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Nullable;
import com.sk89q.worldedit.world.block.BlockType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -351,7 +353,7 @@ public class PlatformManager {
}
}
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
Tool tool = session.getTool(player);
if (tool instanceof DoubleActionBlockTool && tool.canUse(player)) {
player.runAction(() -> reset(((DoubleActionBlockTool) tool))
.actSecondary(queryCapability(Capability.WORLD_EDITING),
@@ -360,19 +362,16 @@ public class PlatformManager {
}
} else if (event.getType() == Interaction.OPEN) {
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
Tool tool = session.getTool(player);
if (tool instanceof BlockTool && tool.canUse(player)) {
if (player.checkAction()) {
player.runAction(() -> {
if (tool instanceof BrushTool) {
((BlockTool) tool)
.actPrimary(queryCapability(Capability.WORLD_EDITING),
getConfiguration(), player, session, location);
} else {
reset((BlockTool) tool)
.actPrimary(queryCapability(Capability.WORLD_EDITING),
getConfiguration(), player, session, location);
BlockTool blockTool = (BlockTool) tool;
if (!(tool instanceof BrushTool)) {
blockTool = reset(blockTool);
}
((BlockTool) blockTool).actPrimary(queryCapability(Capability.WORLD_EDITING),
getConfiguration(), player, session, location);
}, false, true);
event.setCancelled(true);
}
@@ -427,7 +426,7 @@ public class PlatformManager {
event.setCancelled(true);
return;
}
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
Tool tool = session.getTool(player);
if (tool instanceof DoubleActionTraceTool && tool.canUse(player)) {
player.runAsyncIfFree(() -> reset((DoubleActionTraceTool) tool).actSecondary(queryCapability(Capability.WORLD_EDITING),
getConfiguration(), player, session));
@@ -451,7 +450,7 @@ public class PlatformManager {
event.setCancelled(true);
return;
}
Tool tool = session.getTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
Tool tool = session.getTool(player);
if (tool instanceof TraceTool && tool.canUse(player)) {
//todo this needs to be fixed so the event is canceled after actPrimary is used and returns true
player.runAction(() -> reset((TraceTool) tool).actPrimary(queryCapability(Capability.WORLD_EDITING),