From a3f99fd43643e42e061641b40ff1c51c9e873488 Mon Sep 17 00:00:00 2001 From: Taitaitatata <70869837+Taitaitatata@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:15:30 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=82=BB=E3=83=83=E3=83=88=E3=83=97?= =?UTF-8?q?=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3=E7=94=A8=E3=81=AB=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/nekozouneko/playerguard/PlayerGuard.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/net/nekozouneko/playerguard/PlayerGuard.java b/src/main/java/net/nekozouneko/playerguard/PlayerGuard.java index f48647c..57237e1 100644 --- a/src/main/java/net/nekozouneko/playerguard/PlayerGuard.java +++ b/src/main/java/net/nekozouneko/playerguard/PlayerGuard.java @@ -5,8 +5,11 @@ import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.registry.FlagConflictException; import com.sk89q.worldguard.protection.flags.registry.FlagRegistry; +import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion; +import com.sk89q.worldguard.protection.regions.RegionContainer; import lombok.Getter; +import net.md_5.bungee.api.ChatColor; import net.nekozouneko.playerguard.command.*; import net.nekozouneko.playerguard.command.sub.playerguard.ConfirmCommand; import net.nekozouneko.playerguard.flag.GuardRegisteredFlag; @@ -109,6 +112,16 @@ public long getProtectionUsed(Player player) { return used; } + public void resetAllRegions() { + RegionContainer rc = WorldGuard.getInstance().getPlatform().getRegionContainer(); + rc.getLoaded().forEach(rm -> + rm.getRegions().values().stream() + .filter(pr -> !(pr instanceof GlobalProtectedRegion)) + .filter(pr -> StateFlag.test(pr.getFlag(PlayerGuard.getGuardRegisteredFlag()))) + .forEach(pr -> rm.removeRegion(pr.getId())) + ); + } + private void safetyTaskCancel(BukkitRunnable task) { if (task == null || task.isCancelled()) return;