Files
Project-CrankedPvP/Arcade/src/main/java/net/crankedpvp/arcade/tasks/ArcadeRegionChecker.java
T
2026-10-12 13:57:05 -03:00

28 lines
1.0 KiB
Java

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");
}
}
}
}
}