Skip to content

Commit

Permalink
リセットプラグイン用に実装
Browse files Browse the repository at this point in the history
  • Loading branch information
Taitaitatata committed Nov 12, 2024
1 parent 91f7831 commit a3f99fd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/net/nekozouneko/playerguard/PlayerGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a3f99fd

Please sign in to comment.