Skip to content

Commit

Permalink
refactor: switch triggerblock to a tag for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Dec 18, 2023
1 parent 6d4fd07 commit 02d58e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public class AdvancedPortal implements TagTarget {
@SerializedName("min")
private BlockLocation minLoc;

@SerializedName("t")
private String[] triggerBlocks = {"PORTAL"};

@SerializedName("a")
private HashMap<String, String[]> args = new HashMap<>();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -154,11 +151,11 @@ public ArrayList<DataTag> getArgs() {
return tagList;
}

public void setTriggerBlocks(String[] triggerBlocks) {
/*public void setTriggerBlocks(String[] triggerBlocks) {
this.triggerBlocks = triggerBlocks;
}
}*/

public String[] getTriggerBlocks() {
/*public String[] getTriggerBlocks() {
return triggerBlocks;
}
}*/
}

0 comments on commit 02d58e5

Please sign in to comment.