From 02d58e5dfdec3028932e47cc8274621ed49667e3 Mon Sep 17 00:00:00 2001 From: Sekwah Date: Mon, 18 Dec 2023 02:25:02 +0000 Subject: [PATCH] refactor: switch triggerblock to a tag for consistency --- .../portal/CreatePortalSubCommand.java | 2 +- .../portal/ShowPortalSubCommand.java | 24 ++++++++++--------- .../core/portal/AdvancedPortal.java | 15 +++++------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java b/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java index 53419233..599267c6 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/CreatePortalSubCommand.java @@ -72,7 +72,7 @@ public void onCommand(CommandSenderContainer sender, String[] args) { if(portal != null) { sender.sendMessage(Lang.translate("messageprefix.positive") + Lang.translate("command.create.complete")); sender.sendMessage(Lang.translate("command.create.tags")); - sender.sendMessage("\u00A7a" + " triggerBlock\u00A77:\u00A7e" + Arrays.toString(portal.getTriggerBlocks())); + //sender.sendMessage("\u00A7a" + " triggerBlock\u00A77:\u00A7e" + Arrays.toString(portal.getTriggerBlocks())); this.printTags(sender, portal.getArgs()); } else { sender.sendMessage(Lang.translate("messageprefix.negative") + Lang.translate("command.create.error")); diff --git a/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ShowPortalSubCommand.java b/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ShowPortalSubCommand.java index 8a9062f4..a7fe85b4 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ShowPortalSubCommand.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/commands/subcommands/portal/ShowPortalSubCommand.java @@ -88,6 +88,19 @@ public void registered() { if(!tempData.isPortalVisible()) { continue; } + + + if(tempData.getPos1() != null) { + Debug.addMarker(player, tempData.getPos1(), "Pos1", new Color(0, 255, 0), SHOW_TICKS); + } + if(tempData.getPos2() != null) { + Debug.addMarker(player, tempData.getPos2(), "Pos2", new Color(255, 0, 0), SHOW_TICKS); + } + + if (tempData.getPos1() != null && tempData.getPos2() != null) { + debugPortal(player, tempData.getPos1(), tempData.getPos2(), new Color(255, 0, 0, 100), SHOW_TICKS, true); + } + for (var portal : portalServices.getPortals()) { if(portal.isLocationInPortal(player.getLoc(), config.getVisibleRange())) { BlockLocation minLoc = portal.getMinLoc(); @@ -100,17 +113,6 @@ public void registered() { Debug.addMarker(player, midPoint, portal.getArgValues(NameTag.TAG_NAME)[0], color, SHOW_TICKS); } } - - if(tempData.getPos1() != null) { - Debug.addMarker(player, tempData.getPos1(), "Pos1", new Color(0, 255, 0), SHOW_TICKS); - } - if(tempData.getPos2() != null) { - Debug.addMarker(player, tempData.getPos2(), "Pos2", new Color(255, 0, 0), SHOW_TICKS); - } - - if (tempData.getPos1() != null && tempData.getPos2() != null) { - debugPortal(player, tempData.getPos1(), tempData.getPos2(), new Color(255, 0, 0, 100), SHOW_TICKS, true); - } } }, 1, 20); } diff --git a/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java b/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java index a2c114a6..c7bd718b 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/portal/AdvancedPortal.java @@ -29,9 +29,6 @@ public class AdvancedPortal implements TagTarget { @SerializedName("min") private BlockLocation minLoc; - @SerializedName("t") - private String[] triggerBlocks = {"PORTAL"}; - @SerializedName("a") private HashMap args = new HashMap<>(); @@ -86,14 +83,14 @@ public void updateBounds(BlockLocation loc1, BlockLocation loc2) { this.maxLoc = new BlockLocation(loc2.worldName, maxX, maxY, maxZ); } - public boolean hasTriggerBlock(String blockMaterial) { + /*public boolean hasTriggerBlock(String blockMaterial) { for(String triggerBlock : triggerBlocks) { if(blockMaterial.equals(triggerBlock)) { return true; } } return false; - } + }*/ public boolean activate(PlayerContainer player) { ActivationData data = new ActivationData(); @@ -154,11 +151,11 @@ public ArrayList getArgs() { return tagList; } - public void setTriggerBlocks(String[] triggerBlocks) { + /*public void setTriggerBlocks(String[] triggerBlocks) { this.triggerBlocks = triggerBlocks; - } + }*/ - public String[] getTriggerBlocks() { + /*public String[] getTriggerBlocks() { return triggerBlocks; - } + }*/ }