Cancel PlayerTeleportEvent for frozen players (closes #31)

This commit is contained in:
Business Goose 2022-05-02 06:08:30 +01:00
parent d55de3b4a8
commit e484130d84
No known key found for this signature in database
GPG Key ID: 77DCA801362E9645

View File

@ -5,6 +5,7 @@ import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
public class FreezeListener extends PlexListener
{
@ -17,4 +18,14 @@ public class FreezeListener extends PlexListener
e.setCancelled(true);
}
}
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent e)
{
PlexPlayer player = DataUtils.getPlayer(e.getPlayer().getUniqueId());
if (player.isFrozen())
{
e.setCancelled(true);
}
}
}