SteamWar/BauSystem2.0
Archiviert
12
0

Add /warp feature #55

Zusammengeführt
YoyoNow hat 8 Commits von warp nach master 2021-11-12 19:33:24 +01:00 zusammengeführt
4 geänderte Dateien mit 9 neuen und 27 gelöschten Zeilen
Nur Änderungen aus Commit 02c634fb00 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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 -> {
}