Class AFKComponent

java.lang.Object
com.zachsthings.libcomponents.AbstractComponent
com.zachsthings.libcomponents.bukkit.BukkitComponent
com.sk89q.commandbook.component.afk.AFKComponent
All Implemented Interfaces:
java.lang.Runnable, org.bukkit.command.CommandExecutor, org.bukkit.event.Listener

public class AFKComponent
extends com.zachsthings.libcomponents.bukkit.BukkitComponent
implements java.lang.Runnable, org.bukkit.event.Listener
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  AFKComponent.AFKSession  
    class  AFKComponent.Commands  
    class  AFKComponent.MovementListener  
  • Field Summary

    Fields inherited from class com.zachsthings.libcomponents.bukkit.BukkitComponent

    commands
  • Constructor Summary

    Constructors 
    Constructor Description
    AFKComponent()  
  • Method Summary

    Modifier and Type Method Description
    boolean canIgnoreSleep​(boolean requested)
    Determines if a player can be set to ignored for the sleep check.
    boolean canIgnoreSleep​(org.bukkit.entity.Player player)
    Determines if a player can be set to ignored for the sleep check.
    boolean canProtect​(boolean requested)
    Determines if a player can be protected.
    boolean canProtect​(org.bukkit.entity.Player player)
    Determines if a player can be protected.
    void enable()  
    boolean isAfk​(long time)
    Determines if a time is sufficient to be AFK.
    boolean isAfk​(org.bukkit.entity.Player player)
    Determines if a player is marked as AFK.
    void onCommand​(org.bukkit.event.player.PlayerCommandPreprocessEvent event)  
    void onEntityDamageEntityEvent​(org.bukkit.event.entity.EntityDamageByEntityEvent event)  
    void onEntityTargetPlayer​(org.bukkit.event.entity.EntityTargetEvent event)  
    void onInventoryClick​(org.bukkit.event.inventory.InventoryClickEvent event)  
    void onInventoryClose​(org.bukkit.event.inventory.InventoryCloseEvent event)  
    void onInventoryOpen​(org.bukkit.event.inventory.InventoryOpenEvent event)  
    void onPlayerChat​(org.bukkit.event.player.AsyncPlayerChatEvent event)  
    void onPlayerFish​(org.bukkit.event.player.PlayerFishEvent event)  
    void onPlayerInteract​(org.bukkit.event.player.PlayerInteractEvent event)  
    void onPlayerJoin​(org.bukkit.event.player.PlayerJoinEvent event)  
    void reload()  
    void run()  
    boolean shouldKick​(long time)
    Determines if a time is sufficient to be kicked for being AFK.
    boolean shouldKick​(org.bukkit.entity.Player player)
    Determines if a player should be kicked for being AFK.
    void update​(org.bukkit.entity.Player player)
    Updates a player's last active time.

    Methods inherited from class com.zachsthings.libcomponents.bukkit.BukkitComponent

    disable, getCommands, onCommand, registerCommands, setUp, unregisterCommands

    Methods inherited from class com.zachsthings.libcomponents.AbstractComponent

    configure, getComponentLoader, getInformation, getRawConfiguration, isEnabled, saveConfig, saveConfig, setUp

    Methods inherited from class java.lang.Object

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

  • Method Details

    • enable

      public void enable()
      Specified by:
      enable in class com.zachsthings.libcomponents.AbstractComponent
    • reload

      public void reload()
      Overrides:
      reload in class com.zachsthings.libcomponents.AbstractComponent
    • isAfk

      public boolean isAfk​(org.bukkit.entity.Player player)
      Determines if a player is marked as AFK.
      Parameters:
      player - the player to check
      Returns:
      true if the player should be kicked
    • isAfk

      public boolean isAfk​(long time)
      Determines if a time is sufficient to be AFK.
      Parameters:
      time - the last update time
      Returns:
      true if the player should be kicked
    • shouldKick

      public boolean shouldKick​(org.bukkit.entity.Player player)
      Determines if a player should be kicked for being AFK.
      Parameters:
      player - the player to check
      Returns:
      true if the player should be kicked
    • shouldKick

      public boolean shouldKick​(long time)
      Determines if a time is sufficient to be kicked for being AFK.
      Parameters:
      time - the last update time
      Returns:
      true if the player should be kicked
    • canIgnoreSleep

      public boolean canIgnoreSleep​(org.bukkit.entity.Player player)
      Determines if a player can be set to ignored for the sleep check.
      Parameters:
      player - the player to check
      Returns:
      true if the player can be set to ignored for the sleep check
    • canIgnoreSleep

      public boolean canIgnoreSleep​(boolean requested)
      Determines if a player can be set to ignored for the sleep check.
      Parameters:
      requested - whether or not the player requested to be afk
      Returns:
      true if the player can be set to ignored for the sleep check
    • canProtect

      public boolean canProtect​(org.bukkit.entity.Player player)
      Determines if a player can be protected.
      Parameters:
      player - the player to check
      Returns:
      true if the player can be protected
    • canProtect

      public boolean canProtect​(boolean requested)
      Determines if a player can be protected.
      Parameters:
      requested - whether or not the player requested to be afk
      Returns:
      true if the player can be protected
    • update

      public void update​(org.bukkit.entity.Player player)
      Updates a player's last active time.
      Parameters:
      player - player to update
    • run

      public void run()
      Specified by:
      run in interface java.lang.Runnable
    • onEntityTargetPlayer

      public void onEntityTargetPlayer​(org.bukkit.event.entity.EntityTargetEvent event)
    • onPlayerJoin

      public void onPlayerJoin​(org.bukkit.event.player.PlayerJoinEvent event)
    • onPlayerChat

      public void onPlayerChat​(org.bukkit.event.player.AsyncPlayerChatEvent event)
    • onCommand

      public void onCommand​(org.bukkit.event.player.PlayerCommandPreprocessEvent event)
    • onPlayerInteract

      public void onPlayerInteract​(org.bukkit.event.player.PlayerInteractEvent event)
    • onPlayerFish

      public void onPlayerFish​(org.bukkit.event.player.PlayerFishEvent event)
    • onInventoryOpen

      public void onInventoryOpen​(org.bukkit.event.inventory.InventoryOpenEvent event)
    • onInventoryClick

      public void onInventoryClick​(org.bukkit.event.inventory.InventoryClickEvent event)
    • onInventoryClose

      public void onInventoryClose​(org.bukkit.event.inventory.InventoryCloseEvent event)
    • onEntityDamageEntityEvent

      public void onEntityDamageEntityEvent​(org.bukkit.event.entity.EntityDamageByEntityEvent event)