diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java b/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java index ae7a50b..c3c7af2 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/commands/RPGRegionsCommand.java @@ -66,11 +66,9 @@ public class RPGRegionsCommand extends BaseCommand { return; } - int x = player.getLocation().getBlockX(); - int y = player.getLocation().getBlockY(); - int z = player.getLocation().getBlockZ(); ConfiguredRegion configuredRegion = new ConfiguredRegion(player.getWorld(), region, region, new ArrayList<>(), - new ArrayList<>(), x, y, z); + new ArrayList<>()); + configuredRegion.setLocation(player.getLocation()); plugin.getManagers().getRegionsCache().addConfiguredRegion(configuredRegion); player.sendMessage(StringUtils.colour("&aAdded configured region " + region + "!")); player.sendMessage(StringUtils.colour("&e&oNow use /rpgregions edit " @@ -230,9 +228,7 @@ public class RPGRegionsCommand extends BaseCommand { public void onSetLocation(Player player, ConfiguredRegion configuredRegion) { if (configuredRegion != null) { Location location = player.getLocation(); - configuredRegion.setX(location.getBlockX()); - configuredRegion.setY(location.getBlockY()); - configuredRegion.setZ(location.getBlockZ()); + configuredRegion.setLocation(location); player.sendMessage(ChatColor.GREEN + "Location has been updated."); } else { player.sendMessage(StringUtils.colour("&cA region by that name is not yet configured.")); diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/gui/DiscoveryGUI.java b/rpgregions/src/main/java/net/islandearth/rpgregions/gui/DiscoveryGUI.java index 5fe4956..ad8bca9 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/gui/DiscoveryGUI.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/gui/DiscoveryGUI.java @@ -18,7 +18,6 @@ import net.islandearth.rpgregions.utils.StringUtils; import net.islandearth.rpgregions.utils.XMaterial; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; @@ -200,7 +199,7 @@ public class DiscoveryGUI extends RPGRegionsGUI { : null; String lore2 = configuredRegion.isShowCoords() && player.hasPermission("rpgregions.showloc") - ? configuredRegion.getLocation() == null ? ChatColor.GRAY + "" + configuredRegion.getX() + ", " + configuredRegion.getZ() : ChatColor.GRAY + "" + configuredRegion.getLocation().getBlockX() + ", " + configuredRegion.getLocation().getBlockZ() + ? ChatColor.GRAY + "" + configuredRegion.getLocation().getBlockX() + ", " + configuredRegion.getLocation().getBlockZ() : null; List translatedHint = new ArrayList<>(); if (configuredRegion.getHints() != null) { @@ -246,14 +245,11 @@ public class DiscoveryGUI extends RPGRegionsGUI { && player.hasPermission("rpgregions.teleport") && hasDiscovered) { if (!account.getCooldowns().contains(RPGRegionsAccount.AccountCooldown.TELEPORT)) { - int x = configuredRegion.getX(); - int y = configuredRegion.getY(); - int z = configuredRegion.getZ(); if (configuredRegion.getWorld() == null) { Translations.CANNOT_TELEPORT.send(player); } else { - if (configuredRegion.getLocation() == null) PaperLib.teleportAsync(player, new Location(configuredRegion.getWorld(), x, y, z)); - else PaperLib.teleportAsync(player, configuredRegion.getLocation()); + if (configuredRegion.getLocation() != null) PaperLib.teleportAsync(player, configuredRegion.getLocation()); + else player.sendMessage(ChatColor.RED + "Unable to find teleport location."); if (configuredRegion.getTeleportCooldown() != 0) { account.getCooldowns().add(RPGRegionsAccount.AccountCooldown.TELEPORT); Bukkit.getScheduler().runTaskLater(plugin, () -> account.getCooldowns().remove(RPGRegionsAccount.AccountCooldown.TELEPORT), configuredRegion.getTeleportCooldown()); diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java b/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java index 32b1e34..bd90e41 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/managers/RPGRegionsManagers.java @@ -85,10 +85,7 @@ public class RPGRegionsManagers { ConfiguredRegion configuredRegion = new ConfiguredRegion(null, "exampleconfig", "ExampleConfig", rewards, effects, XSound.AMBIENT_UNDERWATER_EXIT.parseSound(), - XMaterial.WOODEN_AXE, - 0, - 0, - 0); + XMaterial.WOODEN_AXE); configuredRegion.setRegenerate(new Regenerate(5000, false, Collections.singletonList( diff --git a/rpgregions/src/main/java/net/islandearth/rpgregions/managers/data/region/ConfiguredRegion.java b/rpgregions/src/main/java/net/islandearth/rpgregions/managers/data/region/ConfiguredRegion.java index a198f20..0d5e661 100644 --- a/rpgregions/src/main/java/net/islandearth/rpgregions/managers/data/region/ConfiguredRegion.java +++ b/rpgregions/src/main/java/net/islandearth/rpgregions/managers/data/region/ConfiguredRegion.java @@ -44,9 +44,6 @@ public class ConfiguredRegion { private final List iconCommand; private final boolean showCoords; private Location location; - @Deprecated private int x; - @Deprecated private int y; - @Deprecated private int z; private final List hints; private final boolean showHint; private boolean teleportable; @@ -64,7 +61,7 @@ public class ConfiguredRegion { private int teleportCooldown; public ConfiguredRegion(@Nullable World world, String id, String customName, - List rewards, List effects, int x, int y, int z) { + List rewards, List effects) { this.world = world != null ? world.getUID() : null; this.id = id; this.customName = customName; @@ -74,9 +71,6 @@ public class ConfiguredRegion { this.undiscoveredIcon = XMaterial.TOTEM_OF_UNDYING.name(); this.iconCommand = new ArrayList<>(); this.showCoords = false; - this.x = x; - this.y = y; - this.z = z; this.hints = new ArrayList<>(); this.showHint = false; this.teleportable = false; @@ -90,8 +84,7 @@ public class ConfiguredRegion { } public ConfiguredRegion(@Nullable World world, String id, String customName, - List rewards, List effects, Sound sound, XMaterial icon, - int x, int y, int z) { + List rewards, List effects, Sound sound, XMaterial icon) { this.world = world != null ? world.getUID() : null; this.id = id; this.customName = customName; @@ -101,9 +94,6 @@ public class ConfiguredRegion { this.undiscoveredIcon = icon.name(); this.iconCommand = new ArrayList<>(); this.showCoords = false; - this.x = x; - this.y = y; - this.z = z; this.hints = new ArrayList<>(); this.showHint = false; this.teleportable = false; @@ -157,36 +147,6 @@ public class ConfiguredRegion { return iconCommand == null ? new ArrayList<>() : iconCommand; } - @Deprecated - public int getX() { - return x; - } - - @Deprecated - public int getY() { - return y; - } - - @Deprecated - public int getZ() { - return z; - } - - @Deprecated - public void setX(int x) { - this.x = x; - } - - @Deprecated - public void setY(int y) { - this.y = y; - } - - @Deprecated - public void setZ(int z) { - this.z = z; - } - public Location getLocation() { return location; }