From 91fdb4dc331eefb5ebd1977339f6087d1201556a 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 class CreatePortalSubCommand extends CreateTaggedSubCommand { 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 class ShowPortalSubCommand implements SubCommand, SubCommand.SubCommandOn 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 class ShowPortalSubCommand implements SubCommand, SubCommand.SubCommandOn 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 class AdvancedPortal implements TagTarget { 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 class AdvancedPortal implements TagTarget { return tagList; } - public void setTriggerBlocks(String[] triggerBlocks) { + /*public void setTriggerBlocks(String[] triggerBlocks) { this.triggerBlocks = triggerBlocks; - } + }*/ - public String[] getTriggerBlocks() { + /*public String[] getTriggerBlocks() { return triggerBlocks; - } + }*/ }