Merge remote-tracking branch 'origin/master'
# Conflicts: # BauSystem_Main/src/BauSystem.properties
Dieser Commit ist enthalten in:
Commit
97eeb78d03
@ -1,23 +1,7 @@
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
PREFIX = §eBau§8System §8»
|
||||
TIME = HH:mm:ss
|
||||
DATE = ........
|
||||
|
||||
# Permission
|
||||
PERMISSION_WORLD=Einstellungen vornehmen
|
||||
PERMISSION_WORLD_EDIT=WorldEdit verwenden
|
||||
@ -25,6 +9,7 @@ PERMISSION_CHANGE_YOU_ENABLE=§aDer Spieler darf nun {0}
|
||||
PERMISSION_CHANGE_YOU_DISABLE=§cDer Spieler darf nun nicht mehr {0}
|
||||
PERMISSION_CHANGE_OTHER_ENABLE=§aDu kannst nun auf der Welt von §6{0} §a{1}
|
||||
PERMISSION_CHANGE_OTHER_DISABLE=§cDu kannst nun nicht mehr auf der Welt von §6{0} §c{1}
|
||||
|
||||
# Feature
|
||||
FEATURE_OTHER_ITEMS_TELEPORT_GUI_NAME=Teleportieren
|
||||
FEATURE_OTHER_ITEMS_TELEPORT_PLAYER_OFFLINE=§cDer Spieler ist Offline
|
||||
@ -37,12 +22,32 @@ FEATURE_TRACER_GUI_AUTO_TRACE_INACTIVE=§eAuto-Tracer Aktivieren
|
||||
FEATURE_TRACER_GUI_AUTO_TRACE_ACTIVE=§eAuto-Tracer Deaktivieren
|
||||
FEATURE_TRACER_GUI_SHOW_GUI=§eTrace Show Gui
|
||||
FEATURE_TRACER_GUI_DELETE=§eTrace Löschen
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Uhrzeit
|
||||
SCOREBOARD_REGION = Region
|
||||
SCOREBOARD_TRACE = Trace
|
||||
SCOREBOARD_LOADER = Loader
|
||||
SCOREBOARD_TPS = TPS
|
||||
|
||||
SCOREBOARD_TRACE_TICKS = Ticks
|
||||
SCOREBOARD_TRACE_TNT_COUNT = Anzahl TNT
|
||||
|
||||
# Flags
|
||||
FLAG_COLOR=Color
|
||||
FLAG_TNT=TNT
|
||||
FLAG_FIRE=Fire
|
||||
FLAG_FREEZE=Freeze
|
||||
FLAG_PROTECT=Protect
|
||||
FLAG_FIRE_ALLOW=§can
|
||||
FLAG_FIRE_DENY=§aaus
|
||||
FLAG_COLOR = Color
|
||||
FLAG_TNT = TNT
|
||||
FLAG_FIRE = Fire
|
||||
FLAG_DAMAGE = Damage
|
||||
FLAG_FREEZE = Freeze
|
||||
FLAG_PROTECT = Protect
|
||||
|
||||
FLAG_FIRE_ALLOW = §can
|
||||
FLAG_FIRE_DENY = §aaus
|
||||
|
||||
@ -56,7 +61,42 @@ FLAG_TNT_ALLOW = §aan
|
||||
FLAG_TNT_DENY = §caus
|
||||
FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen
|
||||
|
||||
FLAG_DAMAGE_ALLOW = §aan
|
||||
FLAG_DAMAGE_DENY = §caus
|
||||
|
||||
FLAG_COLOR_WHITE = §fWeiß
|
||||
FLAG_COLOR_ORANGE = §6Orange
|
||||
FLAG_COLOR_MAGENTA = §dMagenta
|
||||
FLAG_COLOR_LIGHT-BLUE = §bHellblau
|
||||
FLAG_COLOR_YELLOW = §eGelb
|
||||
FLAG_COLOR_LIME = §aHellgrün
|
||||
## This cannot be converted
|
||||
FLAG_COLOR_PINK = §ePink
|
||||
FLAG_COLOR_GRAY = §8Grau
|
||||
FLAG_COLOR_LIGHT-GRAY = §7Hellgrau
|
||||
FLAG_COLOR_CYAN = §3Cyan
|
||||
FLAG_COLOR_PURPLE = §5Lila
|
||||
FLAG_COLOR_BLUE = §1Blau
|
||||
## This cannot be converted
|
||||
FLAG_COLOR_BROWN = §eBraun
|
||||
FLAG_COLOR_GREEN = §2Grün
|
||||
FLAG_COLOR_RED = §cRot
|
||||
FLAG_COLOR_BLACK = §0Schwarz
|
||||
|
||||
# Region
|
||||
REGION_TYPE_NORMAL = Normal
|
||||
REGION_TYPE_BUILD = Baubereich
|
||||
REGION_TYPE_ONLY_TB = Testblock
|
||||
|
||||
# Trace
|
||||
TRACE_RECORD = §aan
|
||||
TRACE_RECORD_AUTO = §an
|
||||
TRACE_IDLE = §caus
|
||||
TRACE_IDLE_AUTO = §eauto
|
||||
|
||||
# Loader
|
||||
LOADER_OFF = §caus
|
||||
LOADER_SETUP = §eSetup
|
||||
LOADER_RUNNING = §aRunning
|
||||
LOADER_PAUSE = §7Pause
|
||||
LOADER_END = §8Finished
|
@ -208,10 +208,10 @@ public class Loader implements Listener {
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Stage implements EnumDisplay {
|
||||
SETUP("§eSetup"),
|
||||
RUNNING("§aRunning"),
|
||||
PAUSE("§7Pause"),
|
||||
END("§8Finished");
|
||||
SETUP("LOADER_SETUP"),
|
||||
RUNNING("LOADER_RUNNING"),
|
||||
PAUSE("LOADER_PAUSE"),
|
||||
END("LOADER_END");
|
||||
|
||||
@Getter
|
||||
private String chatValue;
|
||||
|
@ -46,7 +46,7 @@ public class TracerBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
return new SWItem(Material.OBSERVER, ColorConfig.HIGHLIGHT + "Tracer", Arrays.asList(ColorConfig.BASE + "Status: " + RecordStateMachine.getRecordStatus().getName()), false, clickType -> {
|
||||
return new SWItem(Material.OBSERVER, ColorConfig.HIGHLIGHT + "Tracer", Arrays.asList(ColorConfig.BASE + "Status: " + BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), player)), false, clickType -> {
|
||||
}).getItemStack();
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,10 @@ package de.steamwar.bausystem.features.tracer.record;
|
||||
|
||||
public enum RecordStatus {
|
||||
|
||||
RECORD("§aan", true, "§cTNT-Tracer muss gestoppt werden"),
|
||||
RECORD_AUTO("§aan", true, "§cTNT-Tracer darf nicht aufnehmen"),
|
||||
IDLE("§caus", false, "§cAuto-Tracer gestoppt"),
|
||||
IDLE_AUTO("§eauto", false, "§aAuto-Tracer gestartet");
|
||||
RECORD("TRACE_RECORD", true, "§cTNT-Tracer muss gestoppt werden"),
|
||||
RECORD_AUTO("TRACE_RECORD_AUTO", true, "§cTNT-Tracer darf nicht aufnehmen"),
|
||||
IDLE("TRACE_IDLE", false, "§cAuto-Tracer gestoppt"),
|
||||
IDLE_AUTO("TRACE_IDLE_AUTO", false, "§aAuto-Tracer gestartet");
|
||||
|
||||
String name;
|
||||
boolean tracing;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.loader.Loader;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSWarpUtils;
|
||||
@ -46,31 +47,37 @@ public class BauScoreboard implements Listener {
|
||||
private HashMap<String, Integer> sidebar(Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
|
||||
String colorCode = BauSystem.MESSAGE.parse(region.get(Flag.COLOR).getChatValue(), p).substring(0, 2);
|
||||
|
||||
List<String> strings = new ArrayList<>();
|
||||
strings.add("§1");
|
||||
strings.add("§eUhrzeit§8: §7" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()));
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TIME", p) + "§8: §7" + new SimpleDateFormat(BauSystem.MESSAGE.parse("TIME", p)).format(Calendar.getInstance().getTime()));
|
||||
if (GlobalRegion.getInstance() != region) {
|
||||
strings.add("§eRegion§8: §7" + region.getDisplayName());
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getDisplayName());
|
||||
}
|
||||
|
||||
strings.add("§2");
|
||||
strings.add("§eTNT§8: " + region.get(Flag.TNT).getChatValue());
|
||||
strings.add("§eFreeze§8: " + region.get(Flag.FREEZE).getChatValue());
|
||||
strings.add("§eFire§8: " + region.get(Flag.FIRE).getChatValue());
|
||||
if (region.getFloorLevel() != 0) {
|
||||
strings.add("§eProtect§8: " + region.get(Flag.PROTECT).getChatValue());
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
if (!flag.getRegionPredicate().test(region)) {
|
||||
continue;
|
||||
}
|
||||
strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName());
|
||||
String message = BauSystem.MESSAGE.parse(region.get(flag).getChatValue(), p).replace("§e", colorCode);
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse(flag.getChatValue(), p) + "§8: " + message);
|
||||
}
|
||||
|
||||
strings.add("§3");
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE", p) + "§8: " + BauSystem.MESSAGE.parse(RecordStateMachine.getRecordStatus().getName(), p));
|
||||
Loader loader = Loader.getLoader(p);
|
||||
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus"));
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_LOADER", p) + "§8: " + BauSystem.MESSAGE.parse(loader != null ? loader.getStage().getChatValue() : "LOADER_OFF", p));
|
||||
|
||||
if (RecordStateMachine.getRecordStatus().isTracing()) {
|
||||
strings.add("§3");
|
||||
strings.add("§eTicks§8: §7" + traceTicks());
|
||||
strings.add("§eAnzahl TNT§8: §7" + RecordStateMachine.size());
|
||||
strings.add("§4");
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TICKS", p) + "§8: §7" + traceTicks());
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TRACE_TNT_COUNT", p) + "§8: §7" + RecordStateMachine.size());
|
||||
}
|
||||
|
||||
strings.add("§4");
|
||||
strings.add("§eTPS§8: " + tpsColor() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit());
|
||||
strings.add("§5");
|
||||
strings.add(colorCode + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8 " + tpsColor() + TPSWarpUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit());
|
||||
|
||||
int i = strings.size();
|
||||
HashMap<String, Integer> result = new HashMap<>();
|
||||
|
@ -195,9 +195,12 @@ public class Region {
|
||||
}
|
||||
|
||||
private boolean inRegion(Location location, Point minPoint, Point maxPoint) {
|
||||
return location.getBlockX() >= minPoint.getX() && location.getBlockX() <= maxPoint.getX() &&
|
||||
location.getBlockY() >= minPoint.getY() && location.getBlockY() <= maxPoint.getY() &&
|
||||
location.getBlockZ() >= minPoint.getZ() && location.getBlockZ() <= maxPoint.getZ();
|
||||
int blockX = location.getBlockX();
|
||||
int blockY = location.getBlockY();
|
||||
int blockZ = location.getBlockZ();
|
||||
return blockX >= minPoint.getX() && blockX <= maxPoint.getX() &&
|
||||
blockY >= minPoint.getY() && blockY <= maxPoint.getY() &&
|
||||
blockZ >= minPoint.getZ() && blockZ <= maxPoint.getZ();
|
||||
}
|
||||
|
||||
public boolean hasType(RegionType regionType) {
|
||||
|
@ -20,15 +20,27 @@ import org.bukkit.entity.Player;
|
||||
public class RegionUtils {
|
||||
|
||||
public void actionBar(Region region, String s) {
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||
Bukkit.getOnlinePlayers()
|
||||
.stream()
|
||||
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
|
||||
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
|
||||
.forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s)));
|
||||
}
|
||||
|
||||
public static void message(Region region, String s) {
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> player.sendMessage(s));
|
||||
Bukkit.getOnlinePlayers()
|
||||
.stream()
|
||||
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
|
||||
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
|
||||
.forEach(player -> player.sendMessage(s));
|
||||
}
|
||||
|
||||
public static void message(Region region, Function<Player, String> function) {
|
||||
Bukkit.getOnlinePlayers().stream().filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)).forEach(player -> {
|
||||
Bukkit.getOnlinePlayers()
|
||||
.stream()
|
||||
.filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL))
|
||||
.filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal())
|
||||
.forEach(player -> {
|
||||
String message = function.apply(player);
|
||||
if (message == null) {
|
||||
return;
|
||||
|
@ -19,9 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.region.flags;
|
||||
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.*;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import de.steamwar.bausystem.shared.EnumDisplay;
|
||||
import lombok.Getter;
|
||||
@ -29,12 +31,12 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum Flag implements EnumDisplay {
|
||||
|
||||
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW),
|
||||
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB),
|
||||
FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW),
|
||||
DAMAGE("FLAG_DAMAGE", DamageMode.class, DamageMode.ALLOW),
|
||||
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE),
|
||||
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE);
|
||||
COLOR("FLAG_COLOR", ColorMode.class, ColorMode.YELLOW, region -> false),
|
||||
TNT("FLAG_TNT", TNTMode.class, TNTMode.ONLY_TB, region -> true),
|
||||
FIRE("FLAG_FIRE", FireMode.class, FireMode.ALLOW, region -> true),
|
||||
DAMAGE("FLAG_DAMAGE", DamageMode.class, DamageMode.ALLOW, region -> false),
|
||||
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE, region -> true),
|
||||
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.INACTIVE, region -> region.getFloorLevel() != 0);
|
||||
|
||||
@Getter
|
||||
private static final Set<Flag> flags;
|
||||
@ -47,20 +49,20 @@ public enum Flag implements EnumDisplay {
|
||||
private final Class<? extends Value<?>> valueType;
|
||||
private final Flag.Value<?> defaultValue;
|
||||
private final Value<?>[] values;
|
||||
private final Predicate<Region> regionPredicate;
|
||||
|
||||
<T extends Enum<T> & Value<T>> Flag(String chatValue, final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue) {
|
||||
<T extends Enum<T> & Value<T>> Flag(String chatValue, final Class<? extends Value<T>> valueType, final Flag.Value<T> defaultValue, Predicate<Region> regionPredicate) {
|
||||
this.chatValue = chatValue;
|
||||
this.valueType = valueType;
|
||||
this.defaultValue = defaultValue;
|
||||
this.values = defaultValue.getValues();
|
||||
this.regionPredicate = regionPredicate;
|
||||
}
|
||||
|
||||
public Value<?> getFlagValueOf(final String name) {
|
||||
return this.defaultValue.getValueOf(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name().toLowerCase();
|
||||
|
@ -27,28 +27,27 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ColorMode implements Flag.Value<ColorMode> {
|
||||
WHITE(Color.WHITE),
|
||||
ORANGE(Color.ORANGE),
|
||||
MAGENTA(Color.MAGENTA),
|
||||
LIGHT_BLUE(Color.LIGHT_BLUE),
|
||||
YELLOW(Color.YELLOW),
|
||||
LIME(Color.LIME),
|
||||
PINK(Color.PINK),
|
||||
GRAY(Color.GRAY),
|
||||
LIGHT_GRAY(Color.LIGHT_GRAY),
|
||||
CYAN(Color.CYAN),
|
||||
PURPLE(Color.PURPLE),
|
||||
BLUE(Color.BLUE),
|
||||
BROWN(Color.BROWN),
|
||||
GREEN(Color.GREEN),
|
||||
RED(Color.RED),
|
||||
BLACK(Color.BLACK);
|
||||
WHITE("FLAG_COLOR_WHITE", Color.WHITE),
|
||||
ORANGE("FLAG_COLOR_ORANGE", Color.ORANGE),
|
||||
MAGENTA("FLAG_COLOR_MAGENTA", Color.MAGENTA),
|
||||
LIGHT_BLUE("FLAG_COLOR_LIGHT-BLUE", Color.LIGHT_BLUE),
|
||||
YELLOW("FLAG_COLOR_YELLOW", Color.YELLOW),
|
||||
LIME("FLAG_COLOR_LIME", Color.LIME),
|
||||
PINK("FLAG_COLOR_PINK", Color.PINK),
|
||||
GRAY("FLAG_COLOR_GRAY", Color.GRAY),
|
||||
LIGHT_GRAY("FLAG_COLOR_LIGHT-GRAY", Color.LIGHT_GRAY),
|
||||
CYAN("FLAG_COLOR_CYAN", Color.CYAN),
|
||||
PURPLE("FLAG_COLOR_PURPLE", Color.PURPLE),
|
||||
BLUE("FLAG_COLOR_BLUE", Color.BLUE),
|
||||
BROWN("FLAG_COLOR_BROWN", Color.BROWN),
|
||||
GREEN("FLAG_COLOR_GREEN", Color.GREEN),
|
||||
RED("FLAG_COLOR_RED", Color.RED),
|
||||
BLACK("FLAG_COLOR_BLACK", Color.BLACK);
|
||||
|
||||
private static ColorMode[] values;
|
||||
private final String chatValue;
|
||||
private final Color color;
|
||||
|
||||
private final String chatValue = name();
|
||||
|
||||
@Override
|
||||
public ColorMode[] getValues() {
|
||||
if (ColorMode.values == null) {
|
||||
|
@ -22,6 +22,8 @@ package de.steamwar.bausystem.region.loader;
|
||||
import de.steamwar.bausystem.region.Prototype;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import yapion.hierarchy.diff.DiffBase;
|
||||
import yapion.hierarchy.diff.YAPIONDiff;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
import yapion.parser.YAPIONParser;
|
||||
|
||||
@ -33,7 +35,7 @@ import java.io.IOException;
|
||||
@UtilityClass
|
||||
public class PrototypeLoader {
|
||||
|
||||
private int loadedVersion = 0;
|
||||
private YAPIONObject loaded = null;
|
||||
public static final File file = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "prototypes.yapion");
|
||||
|
||||
public void load() {
|
||||
@ -44,11 +46,10 @@ public class PrototypeLoader {
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
int currentVersion = yapionObject.getPlainValueOrDefault("@version", -1);
|
||||
if (currentVersion != loadedVersion && loadedVersion != 0) {
|
||||
if (loaded != null && new YAPIONDiff(loaded, yapionObject).getDiffs().stream().anyMatch(diffBase -> !(diffBase instanceof DiffBase.DiffChange))) {
|
||||
throw new SecurityException("Version was not the specified version needed.");
|
||||
}
|
||||
loadedVersion = currentVersion;
|
||||
loaded = yapionObject;
|
||||
|
||||
yapionObject.forEach((key, yapionAnyType) -> {
|
||||
if (yapionAnyType instanceof YAPIONObject) {
|
||||
|
@ -24,6 +24,8 @@ import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.region.Prototype;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Bukkit;
|
||||
import yapion.hierarchy.diff.DiffBase;
|
||||
import yapion.hierarchy.diff.YAPIONDiff;
|
||||
import yapion.hierarchy.output.FileOutput;
|
||||
import yapion.hierarchy.types.YAPIONObject;
|
||||
import yapion.hierarchy.types.YAPIONType;
|
||||
@ -37,7 +39,7 @@ import java.io.IOException;
|
||||
@UtilityClass
|
||||
public class RegionLoader {
|
||||
|
||||
private int loadedVersion = 0;
|
||||
private YAPIONObject loaded = null;
|
||||
private YAPIONObject optionsYapionObject;
|
||||
public static final File file = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "regions.yapion");
|
||||
|
||||
@ -57,11 +59,10 @@ public class RegionLoader {
|
||||
throw new SecurityException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
int currentVersion = yapionObject.getPlainValueOrDefault("@version", -1);
|
||||
if (currentVersion != loadedVersion && loadedVersion != 0) {
|
||||
if (loaded != null && new YAPIONDiff(loaded, yapionObject).getDiffs().stream().anyMatch(diffBase -> !(diffBase instanceof DiffBase.DiffChange))) {
|
||||
throw new SecurityException("Version was not the specified version needed.");
|
||||
}
|
||||
loadedVersion = currentVersion;
|
||||
loaded = yapionObject;
|
||||
|
||||
File optionsFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "options.yapion");
|
||||
optionsYapionObject = new YAPIONObject();
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren