refactor: switch triggerblock to a tag for consistency

This commit is contained in:
Sekwah 2023-12-18 02:25:02 +00:00
parent 6d4fd07cc2
commit 02d58e5dfd
3 changed files with 20 additions and 21 deletions

View File

@ -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"));

View File

@ -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);
}

View File

@ -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<>();
@ -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;
}
}*/
}