From 02c634fb00d9ebf56613dd7c6909bb4dc1ebe33f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 11 Nov 2021 22:14:11 +0100 Subject: [PATCH] Update Warp and WarpCommand Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 1 - .../steamwar/bausystem/features/warp/Warp.java | 18 +----------------- .../bausystem/features/warp/WarpCommand.java | 9 ++++----- .../bausystem/features/warp/WarpGui.java | 8 ++++---- 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 4458cbf0..86bc6032 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -555,7 +555,6 @@ WARP_GUI_NO=§cHier giebt es noch keine Warps WARP_GUI_DISTANCE=§7Distanz: §e{0} §7Blöcke WARP_INFO_NAME=§7Name: §e{0} WARP_INFO_CREATOR=§7Ersteller: §e{0} -WARP_INFO_CREATED=§7Erstellt am: §e{0} WARP_HELP_1=§8/§ewarp add §8[§7Name§8] - §7Erstelle einen neuen Warp Punkt WARP_HELP_2=§8/§ewarp §8[§7Name§8] - §7Teleportiere dich zu einen Warp-Punkt WARP_HELP_3=§8/§ewarp info §8[§7Name§8] - §7Infos zu einem Punkt diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java index 9b5bb818..3cbc8737 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/Warp.java @@ -33,10 +33,10 @@ import java.util.List; import java.util.Optional; import java.util.UUID; +// TODO: Rewrite! @Getter public class Warp { - private final Instant created; private final YAPIONObject object; private String name; private Location location; @@ -54,13 +54,10 @@ public class Warp { location = new Location(Bukkit.getWorlds().get(0), x, y, z, yaw, pitch); mat = Material.getMaterial(object.getPlainValue("material")); creator = object.getPlainValue("owner"); - created = Instant.ofEpochSecond(object.getPlainValue("time")); } private Warp() { object = new YAPIONObject(); - object.add("time", Instant.now().getEpochSecond()); - created = Instant.ofEpochSecond(object.getPlainValue("time")); } public static List getWarps() { @@ -144,18 +141,5 @@ public class Warp { if(str.contains("p")) { location.setPitch(Location.normalizePitch(location.getPitch())); } - save(); - } - - private void save() { - object.add("name", name); - YAPIONObject loc = new YAPIONObject(); - loc.add("x", location.getX()); - loc.add("y", location.getY()); - loc.add("z", location.getZ()); - loc.add("yaw", location.getYaw()); - loc.add("pitch", location.getPitch()); - object.add("location", loc); - object.add("creator", creator); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java index 8f6aa0d2..8a7e4e27 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java @@ -153,11 +153,10 @@ public class WarpCommand extends SWCommand { BauSystem.MESSAGE.send("COMMAND_HELP_HEAD", player, warp.getName()); BauSystem.MESSAGE.sendPrefixless("WARP_INFO_NAME", player, warp.getName()); BauSystem.MESSAGE.sendPrefixless("WARP_INFO_CREATOR", player, warp.getCreator()); - BauSystem.MESSAGE.sendPrefixless("WARP_INFO_CREATED", player, Timestamp.from(warp.getCreated()).toLocalDateTime()); - player.sendMessage("§7X: §e" + warp.getX()); - player.sendMessage("§7Y: §e" + warp.getY()); - player.sendMessage("§7Z: §e" + warp.getZ()); - BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.toLocation().distance(player.getLocation())); + player.sendMessage("§7X: §e" + warp.getLocation().getX()); + player.sendMessage("§7Y: §e" + warp.getLocation().getY()); + player.sendMessage("§7Z: §e" + warp.getLocation().getZ()); + BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.getLocation().distance(player.getLocation())); } @SuppressWarnings("BooleanMethodIsAlwaysInverted") diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpGui.java index b1c7fc47..b8bc50f0 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpGui.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpGui.java @@ -38,10 +38,10 @@ public class WarpGui { Warp.getWarps().forEach(warp -> entries.add(new SWListInv.SWListEntry<>(new SWItem( warp.getMat(), "§e" + warp.getName(), - Arrays.asList("§7X: §e" + (int) warp.getX(), - "§7Y: §e" + (int) warp.getY(), - "§7Z: §e" + (int) warp.getZ(), - BauSystem.MESSAGE.parse("WARP_GUI_DISTANCE", player, (int) warp.toLocation().distance(player.getLocation()))), + Arrays.asList("§7X: §e" + (int) warp.getLocation().getX(), + "§7Y: §e" + (int) warp.getLocation().getY(), + "§7Z: §e" + (int) warp.getLocation().getZ(), + BauSystem.MESSAGE.parse("WARP_GUI_DISTANCE", player, (int) warp.getLocation().distance(player.getLocation()))), false, clickType -> { }