package net.crankedpvp.arcade.tasks; import net.crankedpvp.arcade.ArcadeAPI; import net.crankedpvp.arcade.ArcadePlugin; import net.crankedpvp.crankedutils.utils.CooldownUtils; import net.crankedpvp.crankedutils.utils.WorldGuardUtils; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; public class ArcadeRegionChecker extends BukkitRunnable { @Override public void run() { World world = Bukkit.getWorld(ArcadeAPI.WORLD_NAME); if (world == null) return; for (Player player : world.getPlayers()) { if (WorldGuardUtils.getRegionName(player.getLocation()).equals(ArcadeAPI.SAFEZONE_REGION_NAME) && ArcadeAPI.inArcadeMatch(player.getUniqueId())) { ArcadePlugin.getInstance().getArcadeManager().endMatch(player.getUniqueId()); if (CooldownUtils.isCooldownActive(player, "arcadeGracePeriod")) { CooldownUtils.removeCooldown(player, "arcadeGracePeriod"); } } } } }