Package net.glowstone

Class EventFactory

java.lang.Object
net.glowstone.EventFactory

public class EventFactory extends Object
Central class for the calling of events.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends org.bukkit.event.Event>
    T
    callEvent(T event)
    Calls an event through the plugin manager.
    The instance of this class.
    <T extends org.bukkit.event.entity.EntityDamageEvent>
    T
    onEntityDamage(T event)
    Runs an EntityDamageEvent and updates Entity.setLastDamageCause(org.bukkit.event.entity.EntityDamageEvent) and (for a LivingEntity only) LivingEntity.setLastDamage(double).
    org.bukkit.event.player.AsyncPlayerChatEvent
    onPlayerChat(boolean async, org.bukkit.entity.Player player, String message)
    Handles an incoming chat message.
    org.bukkit.event.player.PlayerInteractEvent
    onPlayerInteract(org.bukkit.entity.Player player, org.bukkit.event.block.Action action, org.bukkit.inventory.EquipmentSlot hand)
    Handles a click in the air.
    org.bukkit.event.player.PlayerInteractEvent
    onPlayerInteract(org.bukkit.entity.Player player, org.bukkit.event.block.Action action, org.bukkit.inventory.EquipmentSlot hand, org.bukkit.block.Block clicked, org.bukkit.block.BlockFace face)
    Handles a click on a block.
    org.bukkit.event.player.PlayerJoinEvent
    onPlayerJoin(org.bukkit.entity.Player player)
     
    org.bukkit.event.player.PlayerKickEvent
    onPlayerKick(org.bukkit.entity.Player player, String reason)
     
    org.bukkit.event.player.PlayerLoginEvent
    onPlayerLogin(GlowPlayer player, String hostname)
    Handles post-hooks for a player login, including the name and IP banlists, whitelist policy and occupancy limit.
    org.bukkit.event.player.AsyncPlayerPreLoginEvent
    Handles pre-hooks for a player login.
    org.bukkit.event.player.PlayerQuitEvent
    onPlayerQuit(org.bukkit.entity.Player player)
     
    static void
    The instance of this class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • callEvent

      public <T extends org.bukkit.event.Event> T callEvent(T event)
      Calls an event through the plugin manager.
      Type Parameters:
      T - The type of the event.
      Parameters:
      event - The event to throw.
      Returns:
      the called event
    • onPlayerPreLogin

      public org.bukkit.event.player.AsyncPlayerPreLoginEvent onPlayerPreLogin(String name, InetSocketAddress address, UUID uuid)
      Handles pre-hooks for a player login.
      Parameters:
      name - the name of the player who is logging in
      address - the address of the player who is logging in
      uuid - the UUID of the player who is logging in, provided by Mojang
      Returns:
      an AsyncPlayerPreLoginEvent
    • onPlayerLogin

      public org.bukkit.event.player.PlayerLoginEvent onPlayerLogin(GlowPlayer player, String hostname)
      Handles post-hooks for a player login, including the name and IP banlists, whitelist policy and occupancy limit.
      Parameters:
      player - the login
      hostname - the hostname that was used to connect to the server
      Returns:
      the completed event
    • onPlayerChat

      public org.bukkit.event.player.AsyncPlayerChatEvent onPlayerChat(boolean async, org.bukkit.entity.Player player, String message)
      Handles an incoming chat message.
      Parameters:
      async - This changes the event to a synchronous state.
      player - the sending player
      message - the message
      Returns:
      the completed event
    • onPlayerJoin

      public org.bukkit.event.player.PlayerJoinEvent onPlayerJoin(org.bukkit.entity.Player player)
    • onPlayerKick

      public org.bukkit.event.player.PlayerKickEvent onPlayerKick(org.bukkit.entity.Player player, String reason)
    • onPlayerQuit

      public org.bukkit.event.player.PlayerQuitEvent onPlayerQuit(org.bukkit.entity.Player player)
    • onPlayerInteract

      public org.bukkit.event.player.PlayerInteractEvent onPlayerInteract(org.bukkit.entity.Player player, org.bukkit.event.block.Action action, org.bukkit.inventory.EquipmentSlot hand)
      Handles a click in the air.
      Parameters:
      player - the player
      action - the click action
      hand - the active hand
      Returns:
      the completed event
    • onPlayerInteract

      public org.bukkit.event.player.PlayerInteractEvent onPlayerInteract(org.bukkit.entity.Player player, org.bukkit.event.block.Action action, org.bukkit.inventory.EquipmentSlot hand, org.bukkit.block.Block clicked, org.bukkit.block.BlockFace face)
      Handles a click on a block.
      Parameters:
      player - the player
      action - the click action
      hand - the active hand
      clicked - the block clicked
      face - the side of the block clicked
      Returns:
      the completed event
    • onEntityDamage

      public <T extends org.bukkit.event.entity.EntityDamageEvent> T onEntityDamage(T event)
      Runs an EntityDamageEvent and updates Entity.setLastDamageCause(org.bukkit.event.entity.EntityDamageEvent) and (for a LivingEntity only) LivingEntity.setLastDamage(double).
      Type Parameters:
      T - the event's type
      Parameters:
      event - the event to run
      Returns:
      the completed event
    • getInstance

      public static EventFactory getInstance()
      The instance of this class. Setter should only be called in tests when mocking.
    • setInstance

      public static void setInstance(EventFactory instance)
      The instance of this class. Setter should only be called in tests when mocking.