Skip to content

PlayerEvent

The PlayerEvent class is an abstract base for all events involving a specific player. It provides developers with a streamlined way to access both the standard Bukkit Player object and the internal TNT Run User instance.


  • Package: dev.despical.tntrun.api.event.player
  • Parent Class: TNTRunEvent

MethodReturn TypeDescription
getPlayer()PlayerReturns the standard Bukkit Player associated with the event.
getUser()UserReturns the plugin-specific User object, containing stats and game data.

These events inherit all methods from PlayerEvent:

  • PlayerJoinAttemptEvent: Fired when a player tries to join an arena.
  • PlayerLeaveGameEvent: Fired when a player exits an active game.
  • PlayerDoubleJumpEvent: Fired before a player consumes and performs a double jump.
  • PlayerEliminateEvent: Fired after a player is eliminated from active survivors.
  • PlayerStatisticChangeEvent: Fired before a player’s persistent stats are stored.

When listening to any subclass of PlayerEvent, you can immediately access the User object to check for statistics or plugin-specific data without manual lookups.

import dev.despical.tntrun.api.event.player.PlayerJoinAttemptEvent;
import dev.despical.tntrun.user.User;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class PlayerStatusListener implements Listener {
@EventHandler
public void onAnyPlayerEvent(PlayerJoinAttemptEvent event) {
// Accessing Bukkit Player
Player bukkitPlayer = event.getPlayer();
// Accessing TNT Run User
User user = event.getUser();
if (!bukkitPlayer.hasPermission("server.minigames.tntrun")) {
event.setCancelled(true);
}
}
}