SteamWar/BauSystem2.0
Archiviert
12
0

Merge pull request 'Add /warp feature' (#55) from warp into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #55
Dieser Commit ist enthalten in:
YoyoNow 2021-11-12 19:33:23 +01:00
Commit 134760993b
7 geänderte Dateien mit 500 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -525,16 +525,13 @@ REGION_TNT_ON=§aTNT-Schaden aktiviert
REGION_TNT_OFF=§cTNT-Schaden deaktiviert REGION_TNT_OFF=§cTNT-Schaden deaktiviert
REGION_TNT_TB=§aTNT-Schaden außerhalb Baurahmen aktiviert REGION_TNT_TB=§aTNT-Schaden außerhalb Baurahmen aktiviert
REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört
# Unsign Book # Unsign Book
UNSIGN_HELP_1=§8/§eunsign §8- §7Mache ein Buch beschreibbar UNSIGN_HELP_1=§8/§eunsign §8- §7Mache ein Buch beschreibbar
# Team # Team
LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht! LOCK_SCHEM_NO_USER=§7Dieser Spieler existiert nicht!
LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen! LOCK_SCHEM_NO_SCHEM=§7Dieser Spieler besitzt keine Schematic mit diesem Namen!
LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetz. §f§lGrund: §f{3} LOCK_SCHEM_LOCKED=§e{0} §7von §e{1} §7wurde von §e{2} §7auf §eNORMAL §7zurück gesetz. §f§lGrund: §f{3}
LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] [§7Grund§8] - §7Sperre eine Schematic LOCK_SCHEM_HELP=§8/§eschemlock §8[§7Owner§8] [§7Schematic§8] [§7Grund§8] - §7Sperre eine Schematic
AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert. AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert.
AFK_WARNING_MESSAGE=§cDieser Server wird bei weiterer Inaktivität in einer Minute gestoppt AFK_WARNING_MESSAGE=§cDieser Server wird bei weiterer Inaktivität in einer Minute gestoppt
@ -548,3 +545,31 @@ PANZERN_NO_PERM = §cDu darfst hier nicht das Panzern System verwenden
PANZERN_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection PANZERN_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection
PANZERN_PROGRESS = §e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{2} §7Block Delta PANZERN_PROGRESS = §e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{2} §7Block Delta
PANZERN_DONE = §aZuende gepanzert PANZERN_DONE = §aZuende gepanzert
# Warp
WARP_DISALLOWED = §cDu darfst hier nicht das Warp System nutzen
WARP_LOC_X = §7X§8: §e{0}
WARP_LOC_Y = §7Y§8: §e{0}
WARP_LOC_Z = §7Z§8: §e{0}
WARP_EXISTS=§7Der Warp mit dem namen §e{0} §7existiert bereits
WARP_NAME_RESERVED=§7Du kannst nicht §c{0} §7als name für einen Warp nutzen
WARP_CREATED=§7Der Warp §e{0} §7wurde erstellt
WARP_DELETE_HOVER=§e{0} §7löschen
WARP_DELETED=§e{0} §7wurde gelöcht
WARP_TELEPORT_HOVER=§7Zu §e{0} §7teleportieren
WARP_MATERIAL_CHOOSE=Material auswählen
WARP_GUI_NAME=Warps
WARP_GUI_NO=§cHier giebt es noch keine Warps
WARP_GUI_DISTANCE=§7Distanz: §e{0} §7Blöcke
WARP_GUI_LCLICK=§7Links klicken zum teleportieren
WARP_GUI_RCLICK=§7Rechts klicken zum editieren
WARP_LIST_PREVIOUS_PAGE=§eVorherige Seite
WARP_LIST_PAGE=§e Seite ({0}/{1}) »»
WARP_LIST_NEXT_PAGE=§eNächste Seite
WARP_INFO_NAME=§7Name: §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
WARP_HELP_4=§8/§ewarp delete §8[§7Name§8] - §7Lösche einen Warp
WARP_HELP_5=§8/§ewarp gui - §7Öffne die Warp-GUI
WARP_HELP_6=§8/§ewarp list - §7Liste alle Warp-Punkt auf

Datei anzeigen

@ -0,0 +1,59 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.warp;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.inventory.SWItem;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import java.util.concurrent.atomic.AtomicInteger;
@UtilityClass
public class Moon {
public static void startMoon(Player player) {
player.getInventory().setHelmet(new SWItem(Material.GLASS, "§3Atemkugel").getItemStack());
AtomicInteger countDown = new AtomicInteger(5);
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
if (countDown.get() == 0) {
AtomicInteger iter = new AtomicInteger(1000);
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask1 -> {
if (player.getLocation().getY() > 300 || iter.getAndDecrement() <= 0) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 60 * 5 * 20, 1, false, false));
bukkitTask1.cancel();
} else {
player.setVelocity(player.getVelocity().add(new Vector(0, 0.2, 0)));
player.getWorld().spawnParticle(Particle.FLAME, player.getLocation(), 5);
}
}, 0, 1);
bukkitTask.cancel();
} else {
player.sendMessage("§7Noch §e§l" + countDown.getAndDecrement() + " §7Sekunden!");
}
}, 0, 20);
}
}

Datei anzeigen

@ -0,0 +1,100 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.warp;
import de.steamwar.bausystem.worlddata.WorldData;
import lombok.Getter;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
import yapion.hierarchy.types.YAPIONObject;
import java.util.*;
// TODO: Rewrite!
@Getter
public class Warp {
private static Map<String, Warp> warpMap = new HashMap<>();
private String name;
private Location location;
private Material mat;
public Warp(String name, Player player) {
this.name = name;
this.location = player.getLocation();
this.mat = Material.COMPASS;
warpMap.put(name, this);
}
public Warp(String name, YAPIONObject object) {
this.name = name;
double x = object.getPlainValue("x");
double y = object.getPlainValue("y");
double z = object.getPlainValue("z");
float yaw = object.getPlainValue("yaw");
float pitch = object.getPlainValue("pitch");
location = new Location(Bukkit.getWorlds().get(0), x, y, z, yaw, pitch);
mat = Material.getMaterial(object.getPlainValue("material"));
warpMap.put(name, this);
}
public YAPIONObject output() {
YAPIONObject yapionObject = new YAPIONObject();
yapionObject.add("x", location.getX());
yapionObject.add("y", location.getY());
yapionObject.add("z", location.getZ());
yapionObject.add("yaw", location.getYaw());
yapionObject.add("pitch", location.getPitch());
yapionObject.add("material", mat.toString());
return yapionObject;
}
public static Set<String> getWarpNames() {
return warpMap.keySet();
}
public static List<Warp> getWarps() {
return new ArrayList<>(warpMap.values());
}
public static Warp getWarp(String name) {
return warpMap.get(name);
}
public void setMat(Material mat) {
this.mat = mat;
}
public void setLocation(Location location) {
this.location = location;
}
public void delete() {
warpMap.remove(name);
WorldData.getWarpData().remove(name);
}
public void teleport(Player player) {
player.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN);
player.playSound(location, Sound.ENTITY_ENDERMAN_TELEPORT, SoundCategory.PLAYERS, 1, 1);
}
}

Datei anzeigen

@ -0,0 +1,201 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.warp;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.Disable;
import de.steamwar.bausystem.linkage.Enable;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.worlddata.WorldData;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import yapion.hierarchy.types.YAPIONArray;
import yapion.hierarchy.types.YAPIONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Linked(LinkageType.COMMAND)
@Linked(LinkageType.DISABLE_LINK)
@Linked(LinkageType.ENABLE_LINK)
public class WarpCommand extends SWCommand implements Disable, Enable {
private static final String[] FORBIDDEN_NAMES = new String[]{
"add", "create", "delete", "list", "info", "gui"
};
protected WarpCommand() {
super("warp");
}
@ClassMapper(Warp.class)
public static TypeMapper<Warp> getWarpMapper() {
return SWCommandUtils.createMapper(Warp::getWarp, (commandSender, s) -> new ArrayList<>(Warp.getWarpNames()));
}
@Register(help = true)
public void genericHelp(Player player, String... args) {
if (args.length > 0 && args[0].equals("moon")) {
Moon.startMoon(player);
return;
}
BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", player, "Warp");
BauSystem.MESSAGE.sendPrefixless("WARP_HELP_1", player);
BauSystem.MESSAGE.sendPrefixless("WARP_HELP_2", player);
BauSystem.MESSAGE.sendPrefixless("WARP_HELP_3", player);
BauSystem.MESSAGE.sendPrefixless("WARP_HELP_4", player);
BauSystem.MESSAGE.sendPrefixless("WARP_HELP_5", player);
BauSystem.MESSAGE.sendPrefixless("WARP_HELP_6", player);
}
@Register("add")
@Register("create")
public void addWarp(Player player, String name) {
if (!permissionCheck(player)) return;
for (String forbiddenName : FORBIDDEN_NAMES) {
if (name.equalsIgnoreCase(forbiddenName)) {
BauSystem.MESSAGE.send("WARP_NAME_RESERVED", player, name);
return;
}
}
if (Warp.getWarp(name) != null) {
BauSystem.MESSAGE.send("WARP_EXISTS", player, name);
return;
}
new Warp(name, player);
BauSystem.MESSAGE.send("WARP_CREATED", player, name);
}
@Register
public void tpWarp(Player player, Warp warp) {
warp.teleport(player);
}
@Register("delete")
public void deleteWarp(Player player, Warp warp) {
if (permissionCheck(player)) return;
warp.delete();
BauSystem.MESSAGE.send("WARP_DELETED", player, warp.getName());
}
@Register("gui")
public void gui(Player player) {
WarpGui.openGui(player);
}
@Register("list")
public void listWarps(Player player) {
listWarps(player, 0);
}
@Register("list")
public void listWarps(Player player, int page) {
List<Warp> warps = Warp.getWarps();
int pageCount = (int) Math.ceil(warps.size() / 18d);
for (int i = page * 18; i < warps.size() && i < (page + 1) * 18; i++) {
Warp warp = warps.get(i);
TextComponent component = new TextComponent();
component.setText(warp.getName());
component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/warp " + warp.getName()));
component.setColor(ChatColor.YELLOW);
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse("WARP_TELEPORT_HOVER", player, warp.getName()))));
player.spigot().sendMessage(component);
}
TextComponent beforePage = new TextComponent("««");
if (page > 0) {
beforePage.setColor(ChatColor.YELLOW);
beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("WARP_LIST_PREVIOUS_PAGE", player)).create()));
beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/warp list " + (page - 1)));
} else {
beforePage.setColor(ChatColor.RED);
}
TextComponent nextPage = new TextComponent(BauSystem.MESSAGE.parse("WARP_LIST_PAGE", player, page + 1, Math.max(pageCount, 1)));
if (page < pageCount - 1) {
nextPage.setColor(ChatColor.YELLOW);
nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(BauSystem.MESSAGE.parse("WARP_LIST_NEXT_PAGE", player)).create()));
nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/warp list " + (page + 1)));
} else {
nextPage.setColor(ChatColor.RED);
}
beforePage.addExtra(nextPage);
player.spigot().sendMessage(beforePage);
}
@Register("info")
public void warpInfo(Player player, Warp warp) {
BauSystem.MESSAGE.send("COMMAND_HELP_HEAD", player, warp.getName());
BauSystem.MESSAGE.sendPrefixless("WARP_INFO_NAME", player, warp.getName());
BauSystem.MESSAGE.sendPrefixless("WARP_LOC_X", player, warp.getLocation().getX());
BauSystem.MESSAGE.sendPrefixless("WARP_LOC_Y", player, warp.getLocation().getY());
BauSystem.MESSAGE.sendPrefixless("WARP_LOC_Z", player, warp.getLocation().getZ());
BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.getLocation().distance(player.getLocation()));
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
private boolean permissionCheck(Player player) {
if (!Permission.hasPermission(player, Permission.WORLD)) {
BauSystem.MESSAGE.send("WARP_DISALLOWED", player);
return false;
}
return true;
}
@Linked(LinkageType.COMMAND)
public static class WarpsLink extends SWCommand {
protected WarpsLink() {
super("warps");
}
@Register(help = true)
public void genericCommand(Player player, String... args) {
player.performCommand("warp list " + String.join(" ", args));
}
}
@Override
public void enable() {
WorldData.getWarpData().forEach((name, yapionAnyType) -> {
new Warp(name, (YAPIONObject) yapionAnyType);
});
}
@Override
public void disable() {
YAPIONObject yapionObject = WorldData.getWarpData();
for (Warp warp : Warp.getWarps()) {
yapionObject.add(warp.getName(), warp.output());
}
}
}

Datei anzeigen

@ -0,0 +1,103 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.warp;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@UtilityClass
public class WarpGui {
public static void openGui(Player player) {
List<SWListInv.SWListEntry<Warp>> entries = new ArrayList<>();
Warp.getWarps().forEach(warp -> entries.add(new SWListInv.SWListEntry<>(new SWItem(
warp.getMat(),
"§e" + warp.getName(),
Arrays.asList(
BauSystem.MESSAGE.parse("WARP_LOC_X", player, (int) warp.getLocation().getX()),
BauSystem.MESSAGE.parse("WARP_LOC_Y", player, (int) warp.getLocation().getY()),
BauSystem.MESSAGE.parse("WARP_LOC_Z", player, (int) warp.getLocation().getZ()),
BauSystem.MESSAGE.parse("WARP_GUI_DISTANCE", player, (int) warp.getLocation().distance(player.getLocation())),
"",
BauSystem.MESSAGE.parse("WARP_GUI_LCLICK", player),
BauSystem.MESSAGE.parse("WARP_GUI_RCLICK", player)
),
false,
clickType -> {
}
), warp)));
SWListInv<Warp> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("WARP_GUI_NAME", player), false, entries, (clickType, warp) -> {
if (clickType.isRightClick() && Permission.hasPermission(player, Permission.WORLD)) {
openWarpGui(player, warp);
} else {
warp.teleport(player);
}
});
if (entries.isEmpty()) {
inv.setItem(22, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("WARP_GUI_NO", player), clickType -> {
}));
}
inv.open();
}
public static void openWarpGui(Player player, Warp warp) {
SWInventory inv = new SWInventory(player, 9, warp.getName());
inv.setItem(0, new SWItem(Material.ENDER_PEARL, BauSystem.MESSAGE.parse("WARP_TELEPORT_HOVER", player, warp.getName()), clickType -> {
player.closeInventory();
warp.teleport(player);
}));
inv.setItem(2, new SWItem(warp.getMat(), "§e" + warp.getMat().name(), clickType -> changeMaterial(player, warp)));
inv.setItem(8, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("WARP_DELETE_HOVER", player, warp.getName()), clickType -> {
player.closeInventory();
warp.delete();
}));
inv.open();
}
public static void changeMaterial(Player player, Warp warp) {
List<SWListInv.SWListEntry<Material>> materials = new ArrayList<>();
for (Material value : Material.values()) {
if (value.isLegacy() || value.isAir() || !value.isBlock() || !value.isItem()) continue;
materials.add(new SWListInv.SWListEntry<>(new SWItem(value, "§e" + value.name()), value));
}
SWListInv<Material> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("WARP_MATERIAL_CHOOSE", player), materials, (clickType, material) -> {
player.closeInventory();
warp.setMat(material);
});
inv.open();
}
}

Datei anzeigen

@ -47,8 +47,8 @@ public enum LinkageType {
// NORMAL // NORMAL
COMMAND(-1, false, SWCommand.class::isAssignableFrom), COMMAND(-1, false, SWCommand.class::isAssignableFrom),
ENABLE_LINK(0, false, Enable.class::isInstance, o -> ((Enable) o).enable()), ENABLE_LINK(0, false, Enable.class::isAssignableFrom, o -> ((Enable) o).enable()),
DISABLE_LINK(0, true, Disable.class::isInstance, o -> ((Disable) o).disable()), DISABLE_LINK(0, true, Disable.class::isAssignableFrom, o -> ((Disable) o).disable()),
PLAIN(1, false, clazz -> true), PLAIN(1, false, clazz -> true),
LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())), LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())),
UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)), UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)),

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.worlddata;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import yapion.hierarchy.output.FileOutput; import yapion.hierarchy.output.FileOutput;
import yapion.hierarchy.types.YAPIONArray;
import yapion.hierarchy.types.YAPIONObject; import yapion.hierarchy.types.YAPIONObject;
import yapion.parser.YAPIONParser; import yapion.parser.YAPIONParser;
@ -33,7 +34,7 @@ import java.io.IOException;
@UtilityClass @UtilityClass
public class WorldData { public class WorldData {
private File optionsFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "options.yapion"); private final File optionsFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "options.yapion");
private YAPIONObject worldData; private YAPIONObject worldData;
public YAPIONObject getWorldData() { public YAPIONObject getWorldData() {
@ -47,6 +48,10 @@ public class WorldData {
return getWorldData().getYAPIONObjectOrSetDefault("regions", new YAPIONObject()); return getWorldData().getYAPIONObjectOrSetDefault("regions", new YAPIONObject());
} }
public YAPIONObject getWarpData() {
return getWorldData().getYAPIONObjectOrSetDefault("warps", new YAPIONObject());
}
public YAPIONObject getSimulatorData() { public YAPIONObject getSimulatorData() {
return getWorldData().getYAPIONObjectOrSetDefault("simulators", new YAPIONObject()); return getWorldData().getYAPIONObjectOrSetDefault("simulators", new YAPIONObject());
} }