From 9a506a34f83b59a393272666e29e721e686df632 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Sun, 22 Dec 2024 13:09:15 +0100 Subject: [PATCH] Fix things and optimize imports --- .../BauSystem_Main/src/BauSystem.properties | 1 + .../src/BauSystem_de.properties | 1 + .../src/de/steamwar/bausystem/Permission.java | 2 - .../AttributeRemoveCommand.java | 1 - .../features/autostart/AutostartListener.java | 8 +- .../features/bau/ForceSpectatorCommand.java | 2 - .../bausystem/features/cannon/CannonKey.java | 1 - .../killchecker/KillcheckerCommand.java | 5 +- .../killchecker/KillcheckerVisualizer.java | 6 +- .../features/loader/LoaderRecorder.java | 1 - .../features/loadtimer/Loadtimer.java | 4 +- .../observer/ObserverTracerCommand.java | 1 - .../features/region/FireCommand.java | 18 +-- .../features/region/FireListener.java | 10 +- .../features/region/FreezeCommand.java | 18 +-- .../features/region/FreezeListener.java | 148 +++--------------- .../features/region/ItemsCommand.java | 19 +-- .../features/region/ItemsListener.java | 12 +- .../features/region/NoGravityCommand.java | 16 +- .../features/region/NoGravityListener.java | 12 +- .../features/region/ProtectCommand.java | 22 +-- .../features/region/ProtectListener.java | 20 ++- .../features/region/RegionListener.java | 5 +- .../region/RegionScoreboardElement.java | 8 +- .../bausystem/features/region/TNTCommand.java | 2 - .../features/region/TNTListener.java | 23 +-- .../features/region/TestblockCommand.java | 4 - .../features/region/items/FireBauGuiItem.java | 7 +- .../region/items/FreezeBauGuiItem.java | 7 +- .../region/items/ProtectBauGuiItem.java | 7 +- .../bausystem/features/script/ScriptGUI.java | 1 - .../script/event/CommandListener.java | 1 - .../features/script/event/EventListener.java | 6 +- .../script/lua/SteamWarLuaPlugin.java | 7 - .../script/lua/libs/ScoreboardLib.java | 2 - .../features/script/lua/libs/ServerLib.java | 1 - .../impl/PistonConfiguration.java | 1 - .../simulator/data/SimulatorElement.java | 1 - .../simulator/data/SimulatorPhase.java | 2 - .../slaves/laufbau/LaufbauCommand.java | 2 - .../slaves/panzern/PanzernCommand.java | 2 - .../testblock/blockcounter/BlockCount.java | 1 - .../features/tracer/TraceManager.java | 2 - .../bausystem/features/util/BindCommand.java | 7 +- .../bausystem/features/util/ClearCommand.java | 2 - .../features/util/KillAllCommand.java | 2 +- .../features/util/PistonCalculator.java | 5 +- .../bausystem/features/util/TimeCommand.java | 5 +- .../bausystem/features/warp/WarpCommand.java | 2 - .../features/world/BauMemberUpdate.java | 3 +- .../features/world/KickallCommand.java | 1 - .../world/WorldEditSelectionSaver.java | 1 - .../de/steamwar/bausystem/region/Region.java | 6 +- .../steamwar/bausystem/region/flags/Flag.java | 4 +- .../bausystem/utils/PlaceItemUtils.java | 5 +- .../utils/bossbar/RegionedBossbar.java | 4 +- 56 files changed, 151 insertions(+), 316 deletions(-) diff --git a/BauSystem/BauSystem_Main/src/BauSystem.properties b/BauSystem/BauSystem_Main/src/BauSystem.properties index 61c95dc7..20bb5f87 100644 --- a/BauSystem/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem/BauSystem_Main/src/BauSystem.properties @@ -403,6 +403,7 @@ KILLCHECKER_INFO=§7Shows the overlaps of cannon kills in your build area. KILLCHECKER_INFO2=§7Only colorable blocks like Wool, Terractotta, Stained Glass and Concrete are counted. KILLCHECKER_ENABLE=§aKillchecker activated KILLCHECKER_DISABLE=§cKillchecker deactivated +KILLCHECKER_NO_BUILD=§cThere is no Build Area in this Region KILLCHECKER_BOSSBAR=§e§l{0} §7(§e{1}%§7) §e§l{2}§7 cannons # BlockCounter BLOCK_COUNTER_HELP_TOGGLE=§8/§eblockcounter §8- §7Toggle on/off diff --git a/BauSystem/BauSystem_Main/src/BauSystem_de.properties b/BauSystem/BauSystem_Main/src/BauSystem_de.properties index 3acad9fe..8af9ba4b 100644 --- a/BauSystem/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem/BauSystem_Main/src/BauSystem_de.properties @@ -362,6 +362,7 @@ KILLCHECKER_INFO=§7Zeigt Überlappungen der Kanonen Kills im Baubereich an. KILLCHECKER_INFO2=§7Nur farbige Blöcke wie Wolle, Terracotta, Stained Glass und Concrete wird gezählt. KILLCHECKER_ENABLE=§aKillchecker aktiviert KILLCHECKER_DISABLE=§cKillchecker deaktiviert +KILLCHECKER_NO_BUILD=§cEs gibt keinen Baubereich in dieser Region KILLCHECKER_BOSSBAR=§e§l{0} §7(§e{1}%§7) §e§l{2}§7 Kanonnen # BlockCounter BLOCK_COUNTER_HELP_TOGGLE=§8/§eblockcounter §8- §7Wechsel zwischen an und aus diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/Permission.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/Permission.java index 0985a62d..a4cefb9a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/Permission.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/Permission.java @@ -21,11 +21,9 @@ package de.steamwar.bausystem; import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.features.world.BauMemberUpdate; -import de.steamwar.bausystem.utils.BauMemberUpdateEvent; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import lombok.AllArgsConstructor; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.HashSet; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java index 689be980..eb621256 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/attributescopy/AttributeRemoveCommand.java @@ -24,7 +24,6 @@ import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.linkage.Linked; -import de.steamwar.linkage.MinVersion; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java index 3185c66c..3e477955 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/autostart/AutostartListener.java @@ -24,8 +24,6 @@ import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; -import de.steamwar.bausystem.region.utils.RegionExtensionType; -import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.inventory.SWItem; import de.steamwar.linkage.Linked; @@ -44,7 +42,9 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import java.io.File; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; @Linked public class AutostartListener implements Listener { @@ -140,7 +140,7 @@ public class AutostartListener implements Listener { } private int getPreFightDurationInSeconds(Region region) { - File file = region.gameModeConfig(); + File file = region.getGameModeConfig().orElse(null); if (file == null) return 30; FileConfiguration config = YamlConfiguration.loadConfiguration(file); return config.getInt("Times.PreFightDuration", 30); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/bau/ForceSpectatorCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/bau/ForceSpectatorCommand.java index 7bef91df..a192fec5 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/bau/ForceSpectatorCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/bau/ForceSpectatorCommand.java @@ -19,13 +19,11 @@ package de.steamwar.bausystem.features.bau; -import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; import de.steamwar.linkage.Linked; -import de.steamwar.techhider.TechHider; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java index c260e8a9..08912f6f 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/cannon/CannonKey.java @@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.cannon; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; -import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; import java.util.Set; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java index 9ca7a480..1c6a3b41 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java @@ -38,7 +38,6 @@ import org.bukkit.event.player.PlayerQuitEvent; import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import java.util.Set; @Linked public class KillcheckerCommand extends SWCommand implements Listener { @@ -57,6 +56,10 @@ public class KillcheckerCommand extends SWCommand implements Listener { @Register(value = "enable", description = "KILLCHECKER_HELP_ENABLE") public void genericCommand(@Validator Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) { Region region = Region.getRegion(player.getLocation()); + if (region.getBuildArea().isEmpty()) { + BauSystem.MESSAGE.send("KILLCHECKER_NO_BUILD", player); + return; + } KillcheckerVisualizer killcheckerVisualizer = visualizers.computeIfAbsent(region, region1 -> new KillcheckerVisualizer(region1, bossBarService)); killcheckerVisualizer.recalc(); killcheckerVisualizer.show(player, onlyOutline); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java index 04822aa8..52eae2b6 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java @@ -22,8 +22,6 @@ package de.steamwar.bausystem.features.killchecker; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.region.utils.RegionExtensionType; -import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar; import de.steamwar.bausystem.utils.bossbar.BossBarService; import de.steamwar.entity.REntity; @@ -75,8 +73,8 @@ public class KillcheckerVisualizer { public KillcheckerVisualizer(Region region, BossBarService bossBarService) { this.region = region; - this.minPoint = region.getMinPoint(RegionType.BUILD, RegionExtensionType.NORMAL); - this.maxPoint = region.getMaxPoint(RegionType.BUILD, RegionExtensionType.NORMAL); + this.minPoint = region.getBuildArea().getMinPoint(false); + this.maxPoint = region.getBuildArea().getMaxPoint(false); yArea = (maxPoint.getX() - minPoint.getX()) * (maxPoint.getZ() - minPoint.getZ()); zArea = (maxPoint.getX() - minPoint.getX()) * (maxPoint.getY() - minPoint.getY()); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java index cc3dce23..d3e2fcfb 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java @@ -44,7 +44,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.BiConsumer; -import java.util.function.Consumer; public class LoaderRecorder implements Listener { diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java index 116edba5..12a4d867 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/Loadtimer.java @@ -22,8 +22,6 @@ package de.steamwar.bausystem.features.loadtimer; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.region.utils.RegionExtensionType; -import de.steamwar.bausystem.region.utils.RegionType; import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -158,7 +156,7 @@ public class Loadtimer implements Listener { } public void onTntExplode(EntityExplodeEvent event) { - if (region.inRegion(event.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION) && stage == Stage.IGNITION) { + if (region.getBuildArea().inRegion(event.getLocation(), true) && stage == Stage.IGNITION) { stage = Stage.END; explode = TPSUtils.currentRealTick.get(); print(); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java index 531eda68..c09d3c18 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/observer/ObserverTracerCommand.java @@ -20,7 +20,6 @@ package de.steamwar.bausystem.features.observer; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java index 3a0d4403..c7372eb3 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java @@ -19,13 +19,11 @@ package de.steamwar.bausystem.features.region; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; +import de.steamwar.bausystem.region.flags.FireMode; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.FireMode; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -55,14 +53,12 @@ public class FireCommand extends SWCommand { } private boolean toggle(Region region) { - switch (region.getPlain(Flag.FIRE, FireMode.class)) { - case ALLOW: - region.set(Flag.FIRE, FireMode.DENY); - return true; - default: - case DENY: - region.set(Flag.FIRE, FireMode.ALLOW); - return false; + if (region.isFlag(Flag.FIRE, FireMode.ALLOW)) { + region.setFlag(Flag.FIRE, FireMode.DENY); + return true; + } else { + region.setFlag(Flag.FIRE, FireMode.ALLOW); + return false; } } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java index 3cf4d1dc..840356d4 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireListener.java @@ -2,8 +2,8 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.flags.FireMode; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.FireMode; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -17,12 +17,12 @@ public class FireListener implements Listener, ScoreboardElement { @EventHandler public void onFireDamage(BlockBurnEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).getPlain(Flag.FIRE, FireMode.class) == FireMode.DENY) e.setCancelled(true); + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FIRE, FireMode.DENY)) e.setCancelled(true); } @EventHandler public void onFireSpread(BlockSpreadEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).getPlain(Flag.FIRE, FireMode.class) == FireMode.DENY) e.setCancelled(true); + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FIRE, FireMode.DENY)) e.setCancelled(true); } @Override @@ -37,7 +37,7 @@ public class FireListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - if (region.get(Flag.FIRE) == Flag.FIRE.getDefaultValue()) return null; - return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.FIRE).getChatValue(), p); + if (region.isFlag(Flag.FIRE, Flag.FIRE.getDefaultValue(), true)) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.FIRE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlag(Flag.FIRE).get().getChatValue(), p); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java index d154ce66..aee10390 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java @@ -19,13 +19,11 @@ package de.steamwar.bausystem.features.region; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; +import de.steamwar.bausystem.region.flags.FreezeMode; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -55,14 +53,12 @@ public class FreezeCommand extends SWCommand { } private boolean toggle(Region region) { - switch (region.getPlain(Flag.FREEZE, FreezeMode.class)) { - case ACTIVE: - region.set(Flag.FREEZE, FreezeMode.INACTIVE); - return false; - default: - case INACTIVE: - region.set(Flag.FREEZE, FreezeMode.ACTIVE); - return true; + if (region.isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { + region.setFlag(Flag.FREEZE, FreezeMode.INACTIVE); + return false; + } else { + region.setFlag(Flag.FREEZE, FreezeMode.ACTIVE); + return true; } } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index 673867e7..fb15e84e 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -29,9 +29,7 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onEntitySpawn(EntitySpawnEvent e) { - if (Region.getRegion(e.getLocation()).get(Flag.FREEZE) == FreezeMode.INACTIVE) { - return; - } + if (Region.getRegion(e.getLocation()).isFlag(Flag.FREEZE, FreezeMode.INACTIVE, true)) return; e.setCancelled(true); if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { @@ -43,8 +41,7 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onBlockCanBuild(BlockCanBuildEvent e) { if (!e.isBuildable()) return; - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.INACTIVE) - return; + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.INACTIVE, true)) return; if (e.getMaterial() == Material.TNT) { e.setBuildable(false); e.getBlock().setType(Material.TNT, false); @@ -53,14 +50,14 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onEntityChangeBlock(EntityChangeBlockEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onPhysicsEvent(BlockPhysicsEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { if (e.getSourceBlock().getType() == Material.NOTE_BLOCK) { BlockState state = e.getSourceBlock().getState(); NoteBlock noteBlock = (NoteBlock) state.getBlockData(); @@ -85,143 +82,44 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onPistonExtend(BlockPistonExtendEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } - @EventHandler - public void onNotePlay(NotePlayEvent event) { - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=45, z=98},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=44, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=97},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=custom_head,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=97},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=96},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-108, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=45, z=98},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-104, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=45, z=98},type=CYAN_TERRACOTTA,data=Block{minecraft:cyan_terracotta},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=BARRIER,data=Block{minecraft:barrier},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=harp,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@78078831} - - - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=45, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=46, z=100},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=49, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=99},type=SMOOTH_STONE,data=Block{minecraft:smooth_stone},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - ////[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=true],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=102},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-108, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-107, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=100},type=STONE_SLAB,data=Block{minecraft:stone_slab}[type=bottom,waterlogged=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-104, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=46, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=48, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-105, y=47, z=100},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=101},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-107, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-105, y=47, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=46, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=48, z=98},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=97},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=99},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - //[STDOUT] CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} -> CraftBlock{pos=BlockPosition{x=-106, y=47, z=98},type=NOTE_BLOCK,data=Block{minecraft:note_block}[instrument=basedrum,note=9,powered=false],fluid=net.minecraft.world.level.material.FluidTypeEmpty@1531ed7b} - } - - @EventHandler public void onPistonRetract(BlockPistonRetractEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onBlockGrow(BlockGrowEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onRedstoneEvent(BlockRedstoneEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setNewCurrent(e.getOldCurrent()); } } @EventHandler public void onBlockDispense(BlockDispenseEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onInventoryMoveEvent(InventoryMoveItemEvent e) { - if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (e.getDestination().getLocation() != null && Region.getRegion(e.getDestination().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); - } else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + } else if (e.getSource().getLocation() != null && Region.getRegion(e.getSource().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @@ -230,7 +128,7 @@ public class FreezeListener implements Listener, ScoreboardElement { public void onBlockBreak(BlockBreakEvent e) { if (Core.getVersion() < 19) return; if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) return; - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); e.getBlock().setType(Material.BARRIER, false); e.getBlock().setType(Material.AIR, false); @@ -253,35 +151,35 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onFluidLevelChange(FluidLevelChangeEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onBlockSpread(BlockSpreadEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onBlockFromTo(BlockFromToEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onSpongeAbsorb(SpongeAbsorbEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @EventHandler public void onBlockForm(BlockFormEvent e) { - if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { e.setCancelled(true); } } @@ -289,7 +187,7 @@ public class FreezeListener implements Listener, ScoreboardElement { @EventHandler public void onPlayerInteract(PlayerInteractEvent e) { if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return; - if (Region.getRegion(e.getClickedBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { + if (Region.getRegion(e.getClickedBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { Block block = e.getClickedBlock(); if (block.getType() == Material.LEVER) { Switch data = ((Switch) block.getBlockData()); @@ -300,9 +198,9 @@ public class FreezeListener implements Listener, ScoreboardElement { } @EventHandler - public void onBlockFade(BlockFadeEvent event) { - if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) { - event.setCancelled(true); + public void onBlockFade(BlockFadeEvent e) { + if (Region.getRegion(e.getBlock().getLocation()).isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { + e.setCancelled(true); } } @@ -318,7 +216,7 @@ public class FreezeListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - if (region.get(Flag.FREEZE) == Flag.FREEZE.getDefaultValue()) return null; - return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.FREEZE).getChatValue(), p); + if (region.isFlag(Flag.FREEZE, Flag.FREEZE.getDefaultValue(), true)) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.FREEZE.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlag(Flag.FREEZE).get().getChatValue(), p); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java index 8c4452cb..3003912c 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsCommand.java @@ -19,14 +19,11 @@ package de.steamwar.bausystem.features.region; -import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.ItemMode; +import de.steamwar.bausystem.region.flags.ItemMode; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import de.steamwar.linkage.MinVersion; import org.bukkit.entity.Player; @@ -58,14 +55,12 @@ public class ItemsCommand extends SWCommand { } private boolean toggle(Region region) { - switch (region.getPlain(Flag.ITEMS, ItemMode.class)) { - case ACTIVE: - region.set(Flag.ITEMS, ItemMode.INACTIVE); - return false; - default: - case INACTIVE: - region.set(Flag.ITEMS, ItemMode.ACTIVE); - return true; + if (region.isFlag(Flag.ITEMS, ItemMode.ACTIVE)) { + region.setFlag(Flag.ITEMS, ItemMode.INACTIVE); + return false; + } else { + region.setFlag(Flag.ITEMS, ItemMode.ACTIVE); + return true; } } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java index 66e1fdb7..b673bb93 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ItemsListener.java @@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.ItemMode; +import de.steamwar.bausystem.region.flags.ItemMode; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; import de.steamwar.linkage.MinVersion; @@ -35,13 +35,9 @@ import org.bukkit.event.entity.ItemSpawnEvent; @MinVersion(19) public class ItemsListener implements Listener, ScoreboardElement { - private static ItemMode getMode(Region region) { - return region.getPlain(Flag.ITEMS, ItemMode.class); - } - @EventHandler public void onItemSpawn(ItemSpawnEvent event) { - if (getMode(Region.getRegion(event.getLocation())) == ItemMode.INACTIVE) { + if (Region.getRegion(event.getLocation()).isFlag(Flag.ITEMS, ItemMode.INACTIVE, true)) { event.setCancelled(true); } } @@ -58,7 +54,7 @@ public class ItemsListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - if (region.get(Flag.ITEMS) == Flag.ITEMS.getDefaultValue()) return null; - return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.ITEMS).getChatValue(), p); + if (region.isFlag(Flag.ITEMS, Flag.ITEMS.getDefaultValue(), true)) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.ITEMS.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlag(Flag.ITEMS).get().getChatValue(), p); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityCommand.java index aeeaf588..3d3b6b61 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityCommand.java @@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode; +import de.steamwar.bausystem.region.flags.NoGravityMode; import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -53,14 +53,12 @@ public class NoGravityCommand extends SWCommand { } private boolean toggle(Region region) { - switch (region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class)) { - case ACTIVE: - region.set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE); - return false; - default: - case INACTIVE: - region.set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE); - return true; + if (region.isFlag(Flag.NO_GRAVITY, NoGravityMode.ACTIVE)) { + region.setFlag(Flag.NO_GRAVITY, NoGravityMode.INACTIVE); + return false; + } else { + region.setFlag(Flag.NO_GRAVITY, NoGravityMode.ACTIVE); + return true; } } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityListener.java index f86403f9..e69b8225 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/NoGravityListener.java @@ -22,7 +22,7 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode; +import de.steamwar.bausystem.region.flags.NoGravityMode; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; import org.bukkit.entity.EntityType; @@ -34,14 +34,10 @@ import org.bukkit.event.entity.EntitySpawnEvent; @Linked public class NoGravityListener implements Listener, ScoreboardElement { - private static NoGravityMode getMode(Region region) { - return region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class); - } - @EventHandler public void onEntitySpawn(EntitySpawnEvent event) { if (event.getEntityType() == EntityType.PLAYER) return; - if (getMode(Region.getRegion(event.getLocation())) == NoGravityMode.ACTIVE) { + if (Region.getRegion(event.getLocation()).isFlag(Flag.NO_GRAVITY, NoGravityMode.ACTIVE)) { event.getEntity().setGravity(false); } } @@ -58,7 +54,7 @@ public class NoGravityListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - if (region.get(Flag.NO_GRAVITY) == Flag.NO_GRAVITY.getDefaultValue()) return null; - return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.NO_GRAVITY).getChatValue(), p); + if (region.isFlag(Flag.NO_GRAVITY, Flag.NO_GRAVITY.getDefaultValue(), true)) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlag(Flag.NO_GRAVITY).get().getChatValue(), p); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java index 4fc33cf0..04383c38 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java @@ -20,13 +20,11 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode; +import de.steamwar.bausystem.region.flags.ProtectMode; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; @@ -41,22 +39,18 @@ public class ProtectCommand extends SWCommand { public void genericProtectCommand(@Validator Player p) { Region region = regionCheck(p); if (region == null) return; - switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) { - case ACTIVE: - region.set(Flag.PROTECT, ProtectMode.INACTIVE); - RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE"); - break; - default: - case INACTIVE: - region.set(Flag.PROTECT, ProtectMode.ACTIVE); - RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE"); - break; + if (region.isFlag(Flag.PROTECT, ProtectMode.ACTIVE)) { + region.setFlag(Flag.PROTECT, ProtectMode.INACTIVE); + RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE"); + } else { + region.setFlag(Flag.PROTECT, ProtectMode.ACTIVE); + RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE"); } } private Region regionCheck(Player player) { Region region = Region.getRegion(player.getLocation()); - if (region.getFloorLevel() == 0) { + if (!region.hasFlag(Flag.PROTECT).isApplicable()) { BauSystem.MESSAGE.send("REGION_PROTECT_FALSE_REGION", player); return null; } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java index 65ec30de..b90aa779 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectListener.java @@ -1,9 +1,10 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode; +import de.steamwar.bausystem.region.flags.ProtectMode; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; import org.bukkit.Location; @@ -21,13 +22,11 @@ public class ProtectListener implements Listener, ScoreboardElement { private void explode(List blockList, Location location) { Region region = Region.getRegion(location); - if (region.getFloorLevel() == 0) { - return; - } - if (region.getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.INACTIVE) { - return; - } - blockList.removeIf(block -> block.getY() < region.getFloorLevel()); + if (region.isFlag(Flag.PROTECT, ProtectMode.INACTIVE)) return; + Point p1 = region.getBuildArea().getMinPoint(true); + Point p2 = region.getTestblockArea().getMinPoint(true); + int floorLevel = Math.min(p1.getY(), p2.getY()); + blockList.removeIf(block -> block.getY() < floorLevel); } @EventHandler @@ -52,8 +51,7 @@ public class ProtectListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - if (region.getFloorLevel() == 0) return null; - if (region.get(Flag.PROTECT) != Flag.PROTECT.getDefaultValue()) return null; - return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.PROTECT).getChatValue(), p); + if (region.isFlag(Flag.PROTECT, Flag.PROTECT.getDefaultValue(), true)) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.PROTECT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlag(Flag.PROTECT).get().getChatValue(), p); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java index 38b6532e..990c3379 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionListener.java @@ -21,7 +21,8 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.region.tags.Tag; +import de.steamwar.bausystem.region.flags.ChangedMode; +import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.linkage.Linked; import org.bukkit.Location; import org.bukkit.event.EventHandler; @@ -185,7 +186,7 @@ public class RegionListener implements Listener { new BukkitRunnable() { @Override public void run() { - Region.getRegion(location).set(Tag.CHANGED); + Region.getRegion(location).setFlag(Flag.CHANGED, ChangedMode.HAS_CHANGE); } }.runTaskAsynchronously(BauSystem.getInstance()); } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionScoreboardElement.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionScoreboardElement.java index 246b9a01..7ad6dea1 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionScoreboardElement.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionScoreboardElement.java @@ -19,8 +19,6 @@ package de.steamwar.bausystem.features.region; -import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.region.GlobalRegion; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; @@ -41,7 +39,9 @@ public class RegionScoreboardElement implements ScoreboardElement { @Override public String get(Region region, Player p) { - if (GlobalRegion.getInstance() == region) return null; - return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getDisplayName(); + if (region.getType().isGlobal()) return null; + // TODO: Fix this! + // return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_REGION", p) + "§8: §7" + region.getName(); + return null; } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java index 27dcbe8f..0aa8a4c9 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java @@ -20,7 +20,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; @@ -29,7 +28,6 @@ import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java index a8d34de5..6b1e899c 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java @@ -23,9 +23,7 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.TNTMode; -import de.steamwar.bausystem.region.utils.RegionExtensionType; -import de.steamwar.bausystem.region.utils.RegionType; +import de.steamwar.bausystem.region.flags.TNTMode; import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; import org.bukkit.block.Block; @@ -37,7 +35,6 @@ import org.bukkit.event.block.BlockExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; @Linked public class TNTListener implements Listener, ScoreboardElement { @@ -45,24 +42,17 @@ public class TNTListener implements Listener, ScoreboardElement { private void explode(List blockList) { blockList.removeIf(block -> { Region region = Region.getRegion(block.getLocation()); - TNTMode value = region.getPlain(Flag.TNT); + if (!region.hasFlag(Flag.TNT).isReadable()) return false; + TNTMode value = region.getFlag(Flag.TNT).get(); if (value == TNTMode.ALLOW) { return false; } else if (value == TNTMode.ONLY_TB) { - if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) { - RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY"); - return true; - } - if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) { + if (region.getBuildArea().inRegion(block.getLocation(), true)) { RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY"); return true; } } else if (value == TNTMode.ONLY_BUILD) { - if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.NORMAL)) { - RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY"); - return true; - } - if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) { + if (region.getTestblockArea().inRegion(block.getLocation(), true)) { RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY"); return true; } @@ -93,6 +83,7 @@ public class TNTListener implements Listener, ScoreboardElement { @Override public String get(Region region, Player p) { - return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.TNT).getChatValue(), p); + if (!region.hasFlag(Flag.TNT).isReadable()) return null; + return "§e" + BauSystem.MESSAGE.parse(Flag.TNT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getFlag(Flag.TNT).get().getChatValue(), p); } } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java index 6b319062..a56718c9 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java @@ -20,7 +20,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.config.BauServer; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; @@ -32,7 +31,6 @@ import de.steamwar.bausystem.utils.PasteBuilder; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import de.steamwar.sql.Punishment; @@ -43,10 +41,8 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import java.io.IOException; import java.util.*; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Consumer; import java.util.function.Supplier; import java.util.logging.Level; import java.util.stream.Collectors; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java index 79101ee9..4a69b708 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FireBauGuiItem.java @@ -23,8 +23,8 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; +import de.steamwar.bausystem.region.flags.FireMode; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.FireMode; import de.steamwar.inventory.SWItem; import de.steamwar.linkage.Linked; import org.bukkit.Material; @@ -42,7 +42,10 @@ public class FireBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { Region region = Region.getRegion(player.getLocation()); - if (region.getPlain(Flag.FIRE, FireMode.class) == FireMode.ALLOW) { + if (!region.hasFlag(Flag.FIRE).isApplicable()) { + return new SWItem(Material.BARRIER, "").getItemStack(); + } + if (region.isFlag(Flag.FIRE, FireMode.ALLOW)) { return new SWItem(Material.FIRE_CHARGE, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_ALLOW", player)).getItemStack(); } else { return new SWItem(Material.FIREWORK_STAR, BauSystem.MESSAGE.parse("REGION_ITEM_FIRE_DISALLOW", player)).getItemStack(); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java index 1406638c..0fecdfa8 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/FreezeBauGuiItem.java @@ -24,7 +24,7 @@ import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode; +import de.steamwar.bausystem.region.flags.FreezeMode; import de.steamwar.inventory.SWItem; import de.steamwar.linkage.Linked; import org.bukkit.Material; @@ -42,7 +42,10 @@ public class FreezeBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { Region region = Region.getRegion(player.getLocation()); - if (region.getPlain(Flag.FREEZE, FreezeMode.class) == FreezeMode.ACTIVE) { + if (!region.hasFlag(Flag.FREEZE).isApplicable()) { + return new SWItem(Material.BARRIER, "").getItemStack(); + } + if (region.isFlag(Flag.FREEZE, FreezeMode.ACTIVE)) { return new SWItem(Material.GUNPOWDER, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_ALLOW", player)).getItemStack(); } else { return new SWItem(Material.REDSTONE, BauSystem.MESSAGE.parse("REGION_ITEM_FREEZE_DISALLOW", player)).getItemStack(); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java index a11e508d..5453414e 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/items/ProtectBauGuiItem.java @@ -25,7 +25,7 @@ import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.linkage.specific.BauGuiItem; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; -import de.steamwar.bausystem.region.flags.flagvalues.ProtectMode; +import de.steamwar.bausystem.region.flags.ProtectMode; import de.steamwar.inventory.SWItem; import de.steamwar.linkage.Linked; import org.bukkit.Material; @@ -43,7 +43,10 @@ public class ProtectBauGuiItem extends BauGuiItem { @Override public ItemStack getItem(Player player) { Region region = Region.getRegion(player.getLocation()); - if (region.getPlain(Flag.PROTECT, ProtectMode.class) == ProtectMode.ACTIVE) { + if (!region.hasFlag(Flag.PROTECT).isApplicable()) { + return new SWItem(Material.BARRIER, "").getItemStack(); + } + if (region.isFlag(Flag.PROTECT, ProtectMode.ACTIVE)) { return SWUtils.setCustomModelData(new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_ALLOW", player)), 1).getItemStack(); } else { return SWUtils.setCustomModelData(new SWItem(Material.STONE, BauSystem.MESSAGE.parse("REGION_ITEM_PROTECT_DISALLOW", player)), 1).getItemStack(); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java index add7ad81..fd6fd3f2 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptGUI.java @@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.script; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.features.script.lua.SteamWarPlatform; -import de.steamwar.bausystem.utils.ItemUtils; import de.steamwar.inventory.SWAnvilInv; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/CommandListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/CommandListener.java index da5f1f21..7cf88d1e 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/CommandListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/CommandListener.java @@ -28,7 +28,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.luaj.vm2.LuaValue; import java.util.HashMap; import java.util.HashSet; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java index 4c5feada..958d13a4 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java @@ -153,7 +153,7 @@ public class EventListener implements Listener { for (Player player : Bukkit.getOnlinePlayers()) { if(!Permission.BUILD.hasPermission(player)) continue; - if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) { + if (tntRegion.inRegion(player.getLocation())) { ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTSpawn, LuaValue.NIL, event); } } @@ -171,11 +171,11 @@ public class EventListener implements Listener { table.set("y", event.getLocation().getY()); table.set("z", event.getLocation().getZ()); - boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)); + boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.getBuildArea().inRegion(block.getLocation(), true)); for (Player player : Bukkit.getOnlinePlayers()) { if(!Permission.BUILD.hasPermission(player)) continue; - if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) { + if (tntRegion.inRegion(player.getLocation())) { ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplode, table, event); if (inBuild) { ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplodeInBuild, table, event); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/SteamWarLuaPlugin.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/SteamWarLuaPlugin.java index c3370904..a17943a9 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/SteamWarLuaPlugin.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/SteamWarLuaPlugin.java @@ -22,19 +22,14 @@ package de.steamwar.bausystem.features.script.lua; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.BukkitPlayer; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.extension.platform.Actor; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.features.script.ScriptRunner; import de.steamwar.bausystem.features.script.lua.libs.LuaLib; import de.steamwar.bausystem.features.world.WorldEditListener; import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.inventory.SWAnvilInv; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -47,8 +42,6 @@ import org.luaj.vm2.LuaValue; import org.luaj.vm2.Varargs; import org.luaj.vm2.lib.*; -import java.lang.reflect.Proxy; -import java.net.InetSocketAddress; import java.util.*; import java.util.logging.Level; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ScoreboardLib.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ScoreboardLib.java index af9c67ae..ff09ac9a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ScoreboardLib.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ScoreboardLib.java @@ -24,9 +24,7 @@ import de.steamwar.bausystem.utils.ScoreboardElement; import de.steamwar.linkage.Linked; import org.bukkit.entity.Player; import org.luaj.vm2.LuaTable; -import org.luaj.vm2.LuaValue; import org.luaj.vm2.Varargs; -import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.lib.VarArgFunction; @Linked diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ServerLib.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ServerLib.java index 10a41830..039b849f 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ServerLib.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/lua/libs/ServerLib.java @@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.script.lua.libs; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.features.loader.Loader; import de.steamwar.bausystem.features.loader.LoaderRecorder; import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.inventory.SWItem; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/impl/PistonConfiguration.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/impl/PistonConfiguration.java index dab77b8e..c3efb459 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/impl/PistonConfiguration.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/shieldprinting/impl/PistonConfiguration.java @@ -23,7 +23,6 @@ import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.shieldprinting.BlockDataConfiguration; import de.steamwar.inventory.SWItem; import org.bukkit.Material; -import org.bukkit.block.data.BlockData; import org.bukkit.block.data.type.Piston; import org.bukkit.entity.Player; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorElement.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorElement.java index 119143db..88aaaa96 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorElement.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorElement.java @@ -33,7 +33,6 @@ import yapion.hierarchy.types.YAPIONObject; import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.function.BiConsumer; @Getter diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorPhase.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorPhase.java index b226d124..f69977a6 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorPhase.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/data/SimulatorPhase.java @@ -25,8 +25,6 @@ import lombok.Setter; import org.bukkit.util.Vector; import yapion.hierarchy.types.YAPIONObject; -import java.util.List; -import java.util.Map; import java.util.function.BiConsumer; @Getter diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java index daff9d87..34beeee7 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/laufbau/LaufbauCommand.java @@ -20,12 +20,10 @@ package de.steamwar.bausystem.features.slaves.laufbau; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java index cca7a266..6c983358 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/slaves/panzern/PanzernCommand.java @@ -20,14 +20,12 @@ package de.steamwar.bausystem.features.slaves.panzern; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.shared.Pair; import de.steamwar.bausystem.utils.WorldEditUtils; import de.steamwar.command.PreviousArguments; import de.steamwar.command.SWCommand; import de.steamwar.command.TypeMapper; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCount.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCount.java index 84853b8c..e0e79f77 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCount.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/blockcounter/BlockCount.java @@ -24,7 +24,6 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils; import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.RegionUtils; import lombok.ToString; -import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.scheduler.BukkitTask; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java index 060db33b..a61ed1f6 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceManager.java @@ -25,12 +25,10 @@ import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.AtFlag; import de.steamwar.bausystem.features.tracer.rendering.dynamicflags.IsolateFlag; import de.steamwar.bausystem.region.Region; import de.steamwar.linkage.Linked; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.server.PluginEnableEvent; import java.io.File; import java.util.*; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/BindCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/BindCommand.java index 9a93977e..c71c8400 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/BindCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/BindCommand.java @@ -8,7 +8,6 @@ import com.sk89q.worldedit.extension.platform.Actor; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; -import de.steamwar.bausystem.features.script.ScriptCommand; import de.steamwar.bausystem.features.script.ScriptRunner; import de.steamwar.bausystem.features.world.WorldEditListener; import de.steamwar.bausystem.utils.WorldEditUtils; @@ -28,10 +27,12 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.persistence.PersistentDataType; -import org.luaj.vm2.LuaValue; import java.lang.reflect.Field; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Objects; import java.util.logging.Level; import java.util.stream.Collectors; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java index 1df08e5d..f1e64ce5 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/ClearCommand.java @@ -20,9 +20,7 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java index c0d99689..0812255e 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/KillAllCommand.java @@ -22,8 +22,8 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.region.utils.RegionSelectionType; import de.steamwar.bausystem.region.RegionUtils; +import de.steamwar.bausystem.region.utils.RegionSelectionType; import de.steamwar.command.SWCommand; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java index 5cc4b744..b50ab2fa 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/PistonCalculator.java @@ -21,7 +21,10 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.entity.*; +import de.steamwar.entity.CWireframe; +import de.steamwar.entity.REntity; +import de.steamwar.entity.REntityServer; +import de.steamwar.entity.RTextDisplay; import de.steamwar.linkage.Linked; import de.steamwar.linkage.MinVersion; import org.bukkit.Bukkit; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java index 249f4072..ea38d446 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/TimeCommand.java @@ -20,8 +20,9 @@ package de.steamwar.bausystem.features.util; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; -import de.steamwar.command.*; +import de.steamwar.command.SWCommand; +import de.steamwar.command.SWCommandUtils; +import de.steamwar.command.TypeMapper; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java index aad07fcb..4b35cef7 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/warp/WarpCommand.java @@ -20,13 +20,11 @@ package de.steamwar.bausystem.features.warp; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.utils.ListChatView; import de.steamwar.bausystem.worlddata.WorldData; import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.TypeMapper; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import de.steamwar.linkage.api.Disable; import de.steamwar.linkage.api.Enable; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java index d5aa97d5..1e1eba45 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/BauMemberUpdate.java @@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.region.GlobalRegion; +import de.steamwar.bausystem.region.RegionSystem; import de.steamwar.bausystem.utils.BauMemberUpdateEvent; import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar; import de.steamwar.bausystem.utils.bossbar.BossBarService; @@ -94,7 +95,7 @@ public class BauMemberUpdate extends PacketHandler implements Listener { } private static void showSpectatorNotice(Player player) { - BauSystemBossbar bossbar = BossBarService.instance.get(player, GlobalRegion.getInstance(), "spectator"); + BauSystemBossbar bossbar = BossBarService.instance.get(player, RegionSystem.INSTANCE.getGlobalRegion(), "spectator"); bossbar.setTitle(BauSystem.MESSAGE.parse("SPECTATOR", player)); bossbar.setColor(BarColor.WHITE); bossbar.setStyle(BarStyle.SOLID); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java index d4e5d3f7..44bdb818 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/KickallCommand.java @@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.world; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.config.BauServer; import de.steamwar.command.SWCommand; -import de.steamwar.command.TypeValidator; import de.steamwar.linkage.Linked; import de.steamwar.linkage.LinkedInstance; import org.bukkit.Bukkit; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditSelectionSaver.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditSelectionSaver.java index 1d989226..85351f06 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditSelectionSaver.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/world/WorldEditSelectionSaver.java @@ -32,7 +32,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.checkerframework.checker.units.qual.min; import java.io.*; import java.util.List; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java index 72a007a0..53959621 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/Region.java @@ -44,11 +44,15 @@ public interface Region { & Flag.Value> Optional getFlag(@NonNull Flag flag); default & Flag.Value> boolean isFlag(@NonNull Flag flag, T value) { + return isFlag(flag, value, false); + } + + default & Flag.Value> boolean isFlag(@NonNull Flag flag, T value, boolean defaultValue) { if (hasFlag(flag).isReadable()) { Optional optional = getFlag(flag); return optional.isPresent() && optional.get() == value; } - return false; + return defaultValue; } Point getMinPoint(); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java index 7cfa0347..e9eb963b 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/region/flags/Flag.java @@ -54,12 +54,12 @@ public final class Flag & Flag.Value> implements EnumDispla private final Class> valueType; @Getter - private final Flag.Value defaultValue; + private final T defaultValue; @Getter private final Flag.Value[] values; - private Flag(String name, String chatValue, Class> valueType, Value defaultValue) { + private Flag(String name, String chatValue, Class> valueType, T defaultValue) { flags.add(this); this.name = name; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PlaceItemUtils.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PlaceItemUtils.java index 3202c88e..6ada6d86 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PlaceItemUtils.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/PlaceItemUtils.java @@ -27,7 +27,6 @@ import org.bukkit.*; import org.bukkit.block.*; import org.bukkit.block.data.*; import org.bukkit.block.data.type.Hopper; -import org.bukkit.block.data.type.Observer; import org.bukkit.block.data.type.*; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockCanBuildEvent; @@ -38,7 +37,9 @@ import org.bukkit.inventory.meta.*; import org.bukkit.util.RayTraceResult; import org.bukkit.util.Vector; -import java.util.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/bossbar/RegionedBossbar.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/bossbar/RegionedBossbar.java index 5fb1cc99..843c8500 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/bossbar/RegionedBossbar.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/utils/bossbar/RegionedBossbar.java @@ -21,8 +21,6 @@ package de.steamwar.bausystem.utils.bossbar; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Region; -import de.steamwar.bausystem.region.utils.RegionExtensionType; -import de.steamwar.bausystem.region.utils.RegionType; import org.bukkit.Bukkit; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarFlag; @@ -120,7 +118,7 @@ public class RegionedBossbar implements BauSystemBossbar, Listener { @EventHandler public void onPlayerMove(PlayerMoveEvent event) { if (event.getPlayer() != player) return; - if (region.inRegion(event.getTo(), RegionType.NORMAL, RegionExtensionType.NORMAL)) { + if (region.inRegion(event.getTo())) { bossBar.addPlayer(player); } else { bossBar.removePlayer(player);