From cf750eb95a9f47248083c5d16f8f6a11158e5343 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 5 Jul 2021 17:48:18 +0200 Subject: [PATCH 1/3] Fix Updater Signed-off-by: yoyosource --- .../src/de/steamwar/bausystem/region/loader/Updater.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/Updater.java b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/Updater.java index b5f23845..5e33350a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/loader/Updater.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/loader/Updater.java @@ -35,11 +35,11 @@ public class Updater { if (file.lastModified() > lastUpdate + 10) { try { updaterCode.run(); - lastUpdate = file.lastModified(); Bukkit.getLogger().log(Level.INFO, "Update complete of " + file.getAbsolutePath()); } catch (Exception e) { Bukkit.getLogger().log(Level.INFO, "Error while loading file " + file.getAbsolutePath() + " for config: " + e.getMessage(), e); } + lastUpdate = file.lastModified(); } }, 20, 20); } From 9f202b97985d959abe57b00b04d64b6bb6895d30 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 5 Jul 2021 18:15:09 +0200 Subject: [PATCH 2/3] Fix RegionUtils.actionBar Signed-off-by: yoyosource --- .../features/other/KillAllCommand.java | 4 ++-- .../features/region/DamageCommand.java | 4 ++-- .../bausystem/features/region/FireCommand.java | 4 ++-- .../features/region/FreezeCommand.java | 4 ++-- .../features/region/ProtectCommand.java | 4 ++-- .../bausystem/features/region/TNTCommand.java | 2 +- .../bausystem/features/region/TNTListener.java | 4 ++-- .../steamwar/bausystem/region/RegionUtils.java | 18 +----------------- 8 files changed, 14 insertions(+), 30 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/other/KillAllCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/other/KillAllCommand.java index 5de5ed8b..2708620d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/other/KillAllCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/other/KillAllCommand.java @@ -68,7 +68,7 @@ public class KillAllCommand extends SWCommand { entity.remove(); count.incrementAndGet(); }); - RegionUtils.actionBar(GlobalRegion.getInstance(), BauSystem.MESSAGE.parse("OTHER_KILLALL_GLOBAL", player, count.get())); + RegionUtils.actionBar(GlobalRegion.getInstance(), "OTHER_KILLALL_GLOBAL", count.get()); } else { WORLD.getEntities() .stream() @@ -78,7 +78,7 @@ public class KillAllCommand extends SWCommand { entity.remove(); count.incrementAndGet(); }); - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("OTHER_KILLALL_REGION", player, count.get())); + RegionUtils.actionBar(region, "OTHER_KILLALL_REGION", count.get()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java index 103bbc14..7c64c2e8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java @@ -49,9 +49,9 @@ public class DamageCommand extends SWCommand { if (!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if (toggle(region)) { - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); + RegionUtils.actionBar(region, getEnableMessage()); } else { - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); + RegionUtils.actionBar(region, getDisableMessage()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java index c5520212..04d31491 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java @@ -48,9 +48,9 @@ public class FireCommand extends SWCommand { if (!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if (toggle(region)) { - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); + RegionUtils.actionBar(region, getEnableMessage()); } else { - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); + RegionUtils.actionBar(region, getDisableMessage()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java index 58a1fd3f..241066d7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java @@ -48,9 +48,9 @@ public class FreezeCommand extends SWCommand { if (!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if (toggle(region)) { - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); + RegionUtils.actionBar(region, getEnableMessage()); } else { - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); + RegionUtils.actionBar(region, getDisableMessage()); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java index f91abafc..d851cf2b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java @@ -52,12 +52,12 @@ public class ProtectCommand extends SWCommand { switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) { case ACTIVE: region.set(Flag.PROTECT, ProtectMode.INACTIVE); - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("REGION_PROTECT_DISABLE", p)); + RegionUtils.actionBar(region, "REGION_PROTECT_DISABLE"); break; default: case INACTIVE: region.set(Flag.PROTECT, ProtectMode.ACTIVE); - RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("REGION_PROTECT_ENABLE", p)); + RegionUtils.actionBar(region, "REGION_PROTECT_ENABLE"); break; } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java index 9a8eda14..c890995f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java @@ -76,7 +76,7 @@ public class TNTCommand extends SWCommand { requestedMessage = getTestblockEnableMessage(); break; } - tntToggle(region, tntMode, BauSystem.MESSAGE.parse(requestedMessage, p)); + tntToggle(region, tntMode, requestedMessage); } @ClassMapper(value = TNTMode.class, local = true) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java index 9680e699..71d5899c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java @@ -47,11 +47,11 @@ public class TNTListener implements Listener { return false; } if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) { - RegionUtils.actionBarNew(region, "REGION_TNT_BUILD"); + RegionUtils.actionBar(region, "REGION_TNT_BUILD"); return true; } if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) { - RegionUtils.actionBarNew(region, "REGION_TNT_BUILD"); + RegionUtils.actionBar(region, "REGION_TNT_BUILD"); return true; } return value == TNTMode.DENY; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java index e4dc2ae6..ba1d56db 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java @@ -39,15 +39,7 @@ import java.util.function.Function; @UtilityClass public class RegionUtils { - public void actionBar(Region region, String s) { - Bukkit.getOnlinePlayers() - .stream() - .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) - .filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal()) - .forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s))); - } - - public void actionBarNew(Region region, String s, Object... objects) { + public void actionBar(Region region, String s, Object... objects) { Bukkit.getOnlinePlayers() .stream() .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) @@ -55,14 +47,6 @@ public class RegionUtils { .forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse(s, player, objects)))); } - public static void messageOLD(Region region, String s) { - Bukkit.getOnlinePlayers() - .stream() - .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) - .filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal()) - .forEach(player -> player.sendMessage(s)); - } - public static void message(Region region, String message, Object... objects) { Bukkit.getOnlinePlayers() .stream() From ab59c641c063b55b306d570fcc52e15028b46f7a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 5 Jul 2021 18:17:03 +0200 Subject: [PATCH 3/3] Fix RegionUtils.actionBar Signed-off-by: yoyosource --- .../src/de/steamwar/bausystem/region/RegionUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java index ba1d56db..098a2dc3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java @@ -52,9 +52,7 @@ public class RegionUtils { .stream() .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) .filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal()) - .forEach(player -> { - BauSystem.MESSAGE.send(message, player, objects); - }); + .forEach(player -> BauSystem.MESSAGE.send(message, player, objects)); } public static void message(Region region, Function function) {