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 classAFKComponent.AFKSessionclassAFKComponent.CommandsclassAFKComponent.MovementListener -
Field Summary
-
Constructor Summary
Constructors Constructor Description AFKComponent() -
Method Summary
Modifier and Type Method Description booleancanIgnoreSleep(boolean requested)Determines if a player can be set to ignored for the sleep check.booleancanIgnoreSleep(org.bukkit.entity.Player player)Determines if a player can be set to ignored for the sleep check.booleancanProtect(boolean requested)Determines if a player can be protected.booleancanProtect(org.bukkit.entity.Player player)Determines if a player can be protected.voidenable()booleanisAfk(long time)Determines if a time is sufficient to be AFK.booleanisAfk(org.bukkit.entity.Player player)Determines if a player is marked as AFK.voidonCommand(org.bukkit.event.player.PlayerCommandPreprocessEvent event)voidonEntityDamageEntityEvent(org.bukkit.event.entity.EntityDamageByEntityEvent event)voidonEntityTargetPlayer(org.bukkit.event.entity.EntityTargetEvent event)voidonInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)voidonInventoryClose(org.bukkit.event.inventory.InventoryCloseEvent event)voidonInventoryOpen(org.bukkit.event.inventory.InventoryOpenEvent event)voidonPlayerChat(org.bukkit.event.player.AsyncPlayerChatEvent event)voidonPlayerFish(org.bukkit.event.player.PlayerFishEvent event)voidonPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)voidonPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)voidreload()voidrun()booleanshouldKick(long time)Determines if a time is sufficient to be kicked for being AFK.booleanshouldKick(org.bukkit.entity.Player player)Determines if a player should be kicked for being AFK.voidupdate(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
-
Constructor Details
-
AFKComponent
public AFKComponent()
-
-
Method Details
-
enable
public void enable()- Specified by:
enablein classcom.zachsthings.libcomponents.AbstractComponent
-
reload
public void reload()- Overrides:
reloadin classcom.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:
runin interfacejava.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)
-