Add /warp feature #55
@ -555,7 +555,6 @@ WARP_GUI_NO=§cHier giebt es noch keine Warps
|
|||||||
WARP_GUI_DISTANCE=§7Distanz: §e{0} §7Blöcke
|
WARP_GUI_DISTANCE=§7Distanz: §e{0} §7Blöcke
|
||||||
WARP_INFO_NAME=§7Name: §e{0}
|
WARP_INFO_NAME=§7Name: §e{0}
|
||||||
WARP_INFO_CREATOR=§7Ersteller: §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_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_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
|
WARP_HELP_3=§8/§ewarp info §8[§7Name§8] - §7Infos zu einem Punkt
|
||||||
|
@ -33,10 +33,10 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
// TODO: Rewrite!
|
||||||
@Getter
|
@Getter
|
||||||
public class Warp {
|
public class Warp {
|
||||||
|
|
||||||
private final Instant created;
|
|
||||||
private final YAPIONObject object;
|
private final YAPIONObject object;
|
||||||
private String name;
|
private String name;
|
||||||
private Location location;
|
private Location location;
|
||||||
@ -54,13 +54,10 @@ public class Warp {
|
|||||||
location = new Location(Bukkit.getWorlds().get(0), x, y, z, yaw, pitch);
|
location = new Location(Bukkit.getWorlds().get(0), x, y, z, yaw, pitch);
|
||||||
mat = Material.getMaterial(object.getPlainValue("material"));
|
mat = Material.getMaterial(object.getPlainValue("material"));
|
||||||
creator = object.getPlainValue("owner");
|
creator = object.getPlainValue("owner");
|
||||||
created = Instant.ofEpochSecond(object.getPlainValue("time"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Warp() {
|
private Warp() {
|
||||||
object = new YAPIONObject();
|
object = new YAPIONObject();
|
||||||
object.add("time", Instant.now().getEpochSecond());
|
|
||||||
created = Instant.ofEpochSecond(object.getPlainValue("time"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Warp> getWarps() {
|
public static List<Warp> getWarps() {
|
||||||
@ -144,18 +141,5 @@ public class Warp {
|
|||||||
if(str.contains("p")) {
|
if(str.contains("p")) {
|
||||||
location.setPitch(Location.normalizePitch(location.getPitch()));
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,11 +153,10 @@ public class WarpCommand extends SWCommand {
|
|||||||
BauSystem.MESSAGE.send("COMMAND_HELP_HEAD", player, warp.getName());
|
BauSystem.MESSAGE.send("COMMAND_HELP_HEAD", player, warp.getName());
|
||||||
BauSystem.MESSAGE.sendPrefixless("WARP_INFO_NAME", 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_CREATOR", player, warp.getCreator());
|
||||||
BauSystem.MESSAGE.sendPrefixless("WARP_INFO_CREATED", player, Timestamp.from(warp.getCreated()).toLocalDateTime());
|
player.sendMessage("§7X: §e" + warp.getLocation().getX());
|
||||||
player.sendMessage("§7X: §e" + warp.getX());
|
player.sendMessage("§7Y: §e" + warp.getLocation().getY());
|
||||||
player.sendMessage("§7Y: §e" + warp.getY());
|
player.sendMessage("§7Z: §e" + warp.getLocation().getZ());
|
||||||
player.sendMessage("§7Z: §e" + warp.getZ());
|
BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.getLocation().distance(player.getLocation()));
|
||||||
BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.toLocation().distance(player.getLocation()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||||
|
@ -38,10 +38,10 @@ public class WarpGui {
|
|||||||
Warp.getWarps().forEach(warp -> entries.add(new SWListInv.SWListEntry<>(new SWItem(
|
Warp.getWarps().forEach(warp -> entries.add(new SWListInv.SWListEntry<>(new SWItem(
|
||||||
warp.getMat(),
|
warp.getMat(),
|
||||||
"§e" + warp.getName(),
|
"§e" + warp.getName(),
|
||||||
Arrays.asList("§7X: §e" + (int) warp.getX(),
|
Arrays.asList("§7X: §e" + (int) warp.getLocation().getX(),
|
||||||
"§7Y: §e" + (int) warp.getY(),
|
"§7Y: §e" + (int) warp.getLocation().getY(),
|
||||||
"§7Z: §e" + (int) warp.getZ(),
|
"§7Z: §e" + (int) warp.getLocation().getZ(),
|
||||||
BauSystem.MESSAGE.parse("WARP_GUI_DISTANCE", player, (int) warp.toLocation().distance(player.getLocation()))),
|
BauSystem.MESSAGE.parse("WARP_GUI_DISTANCE", player, (int) warp.getLocation().distance(player.getLocation()))),
|
||||||
false,
|
false,
|
||||||
clickType -> {
|
clickType -> {
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren