9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-28 03:09:14 +00:00

Add icon commands

This commit is contained in:
SamB440
2020-06-23 20:16:23 +01:00
parent 1d0bb8f80a
commit cf891f77a8
2 changed files with 10 additions and 1 deletions

View File

@@ -247,7 +247,8 @@ public class DiscoveryGUI extends RPGRegionsGUI {
if (configuredRegion.getWorld() == null) Translations.CANNOT_TELEPORT.send(player);
else PaperLib.teleportAsync(player, new Location(configuredRegion.getWorld(), x, y, z));
}
if (!configuredRegion.getIconCommand().isEmpty()) player.performCommand(configuredRegion.getIconCommand().replace("%region%", configuredRegion.getId()));
event.setCancelled(true);
}));
}

View File

@@ -38,6 +38,7 @@ public class ConfiguredRegion {
private final Sound sound;
private final String icon;
private final String undiscoveredIcon;
private final String iconCommand;
private final boolean showCoords;
private int x;
private int y;
@@ -66,6 +67,7 @@ public class ConfiguredRegion {
this.sound = XSound.UI_TOAST_CHALLENGE_COMPLETE.parseSound();
this.icon = XMaterial.TOTEM_OF_UNDYING.name();
this.undiscoveredIcon = XMaterial.TOTEM_OF_UNDYING.name();
this.iconCommand = "";
this.showCoords = false;
this.x = x;
this.y = y;
@@ -91,6 +93,7 @@ public class ConfiguredRegion {
this.sound = sound;
this.icon = icon.name();
this.undiscoveredIcon = icon.name();
this.iconCommand = "";
this.showCoords = false;
this.x = x;
this.y = y;
@@ -138,6 +141,11 @@ public class ConfiguredRegion {
return XMaterial.valueOf(undiscoveredIcon).parseItem(true);
}
@NotNull
public String getIconCommand() {
return iconCommand == null ? "" : iconCommand;
}
public int getX() {
return x;
}