Class LifestealerPreUserBanEvent
java.lang.Object
org.bukkit.event.Event
dev.chicoferreira.lifestealer.events.LifestealerPreUserBanEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public class LifestealerPreUserBanEvent
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
Event that is called before a user is banned when he dies.
You can change the duration of the ban in this event.
This event is NOT called when the user is banned by the ban command, only when the user dies with less than the minimum amount of hearts.
If you wish to listen to the command as well, you should use LifestealerPostUserBanEvent
.
This event is called before the user is kicked and the ban commands are executed.
This event will still be called even if the external flag is set to true in the LifestealerUserController.BanSettings
Thread-safety (WARNING): This event is called with a write lock active on the user.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorsConstructorDescriptionLifestealerPreUserBanEvent
(@NotNull org.bukkit.entity.Player player, @NotNull LifestealerUser user, @NotNull Duration banDuration) Constructs a newLifestealerPreUserBanEvent
. -
Method Summary
Modifier and TypeMethodDescription@NotNull Duration
Gets the duration of the ban.static org.bukkit.event.HandlerList
Gets the handler list.@NotNull org.bukkit.event.HandlerList
Gets the handler list.@NotNull org.bukkit.entity.Player
Gets the player going to be banned.@NotNull LifestealerUser
getUser()
Gets theLifestealerUser
associated with the player.boolean
void
setBanDuration
(@NotNull Duration banDuration) Sets the duration of the ban.void
setCancelled
(boolean cancel) Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
LifestealerPreUserBanEvent
public LifestealerPreUserBanEvent(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull LifestealerUser user, @NotNull @NotNull Duration banDuration) Constructs a newLifestealerPreUserBanEvent
.- Parameters:
player
- ThePlayer
who is going to be banned.user
- TheLifestealerUser
associated with the player.banDuration
- The duration of the ban.
-
-
Method Details
-
getPlayer
@NotNull public @NotNull org.bukkit.entity.Player getPlayer()Gets the player going to be banned.- Returns:
- The banned player.
-
getUser
Gets theLifestealerUser
associated with the player.- Returns:
- The
LifestealerUser
associated with the player.
-
getBanDuration
Gets the duration of the ban.- Returns:
- The duration of the ban.
-
setBanDuration
Sets the duration of the ban.- Parameters:
banDuration
- The duration of the ban.
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancel) - Specified by:
setCancelled
in interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Gets the handler list.- Specified by:
getHandlers
in classorg.bukkit.event.Event
- Returns:
- the handler list
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Gets the handler list.- Returns:
- the handler list
-