package nl.sbdeveloper.themeparkplus.listeners;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

/**
 * Anti-Freerun effect
 */
public class AntiFreerunListener implements Listener {
    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        if (!p.hasPermission("tpp.bypassantifreerun")) {
            p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, -2, false, false));
        }
    }
}
