Class PlayerIteratorAction
java.lang.Object
com.sk89q.commandbook.util.entity.player.iterators.PlayerIteratorAction
- Direct Known Subclasses:
TeleportPlayerIterator
public abstract class PlayerIteratorAction
extends java.lang.Object
Performs an action over a list of players.
-
Field Summary
Fields Modifier and Type Field Description protected org.bukkit.command.CommandSendersender -
Constructor Summary
Constructors Constructor Description PlayerIteratorAction(org.bukkit.command.CommandSender sender)Construct the object. -
Method Summary
Modifier and Type Method Description org.bukkit.command.CommandSendergetSender()Get the sender.voiditerate(java.lang.Iterable<org.bukkit.entity.Player> targets)Iterate over a list of players and perform the action on the player.abstract voidonCaller(org.bukkit.entity.Player player)Called when the caller is affected by the action.voidonComplete(org.bukkit.command.CommandSender sender, int affected)Called on operation complete.voidonInform(org.bukkit.command.CommandSender sender, int affected)Called on informing of the sender of the action.voidonInformMany(org.bukkit.command.CommandSender sender, int affected)Called on operation complete if more than one player was affected and the caller was also not affected or the caller was console.abstract voidonVictim(org.bukkit.command.CommandSender sender, org.bukkit.entity.Player player)Called when a player is a victim and is not the caller.abstract java.util.concurrent.CompletableFuture<java.lang.Boolean>perform(org.bukkit.entity.Player player)Perform the action.
-
Field Details
-
sender
protected final org.bukkit.command.CommandSender sender
-
-
Constructor Details
-
PlayerIteratorAction
public PlayerIteratorAction(org.bukkit.command.CommandSender sender)Construct the object.- Parameters:
sender-
-
-
Method Details
-
iterate
public void iterate(java.lang.Iterable<org.bukkit.entity.Player> targets)Iterate over a list of players and perform the action on the player.- Parameters:
targets-
-
getSender
public org.bukkit.command.CommandSender getSender()Get the sender.- Returns:
-
perform
public abstract java.util.concurrent.CompletableFuture<java.lang.Boolean> perform(org.bukkit.entity.Player player)Perform the action.- Parameters:
player-
-
onCaller
public abstract void onCaller(org.bukkit.entity.Player player)Called when the caller is affected by the action.- Parameters:
player-
-
onVictim
public abstract void onVictim(org.bukkit.command.CommandSender sender, org.bukkit.entity.Player player)Called when a player is a victim and is not the caller.- Parameters:
sender-player-
-
onInform
public void onInform(org.bukkit.command.CommandSender sender, int affected)Called on informing of the sender of the action. This is only called if the sender was also not a victim.- Parameters:
sender-affected-
-
onInformMany
public void onInformMany(org.bukkit.command.CommandSender sender, int affected)Called on operation complete if more than one player was affected and the caller was also not affected or the caller was console.- Parameters:
sender-affected-
-
onComplete
public void onComplete(org.bukkit.command.CommandSender sender, int affected)Called on operation complete.- Parameters:
sender-affected-
-