9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-27 18:59:10 +00:00

Remove x y z

This commit is contained in:
SamB440
2020-08-14 17:05:40 +01:00
parent 8d6f2c0b8e
commit a2ea012140
4 changed files with 9 additions and 60 deletions

View File

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

View File

@@ -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<String> 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());

View File

@@ -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(

View File

@@ -44,9 +44,6 @@ public class ConfiguredRegion {
private final List<IconCommand> iconCommand;
private final boolean showCoords;
private Location location;
@Deprecated private int x;
@Deprecated private int y;
@Deprecated private int z;
private final List<String> 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<DiscoveryReward> rewards, List<RegionEffect> effects, int x, int y, int z) {
List<DiscoveryReward> rewards, List<RegionEffect> 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<DiscoveryReward> rewards, List<RegionEffect> effects, Sound sound, XMaterial icon,
int x, int y, int z) {
List<DiscoveryReward> rewards, List<RegionEffect> 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;
}