Package fr.fuzeblocks.homeplugin.event
Class OnEventAction
java.lang.Object
org.bukkit.event.Event
fr.fuzeblocks.homeplugin.event.OnEventAction
- All Implemented Interfaces:
org.bukkit.event.Cancellable
- Direct Known Subclasses:
OnHomeCreatedEvent,OnHomeDeletedEvent,OnHomeTeleportEvent,OnRTPEvent,OnSpawnCreatedEvent,OnSpawnDeletedEvent,OnSpawnTeleportEvent,OnTeleportTaskCancelledEvent,OnTpaAcceptedEvent,OnTpaCreatedEvent,OnTpaDeniedEvent
public class OnEventAction
extends org.bukkit.event.Event
implements org.bukkit.event.Cancellable
Base custom event for teleport-like actions.
Provides explicit origin (from) and destination (to).
getLocation() is retained for backward compatibility and returns the destination (to).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionOnEventAction(TpaRequest tpaRequest) Convenience constructor for TPA events.OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location) Backward-compatible: 'location' is treated as the destination ("to").OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type) Backward-compatible: 'location' is treated as the destination ("to").OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type, String homeName) Backward-compatible: 'location' is treated as the destination ("to").OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, String homeName) Backward-compatible: 'location' is treated as the destination ("to").OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to) Preferred constructor with explicit origin and destination (no type).OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type) Preferred constructor with explicit origin and destination and optional type.OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type, String homeName) Preferred constructor with explicit origin and destination, optional type, and home name.OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, String homeName) Preferred constructor with explicit origin and destination and home name (no type). -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationgetFrom()Origin location (where the player came FROM).static org.bukkit.event.HandlerListGets handler list.org.bukkit.event.HandlerListGets home name.org.bukkit.LocationDeprecated.org.bukkit.entity.PlayerGets player.org.bukkit.LocationgetTo()Destination location (where the player is going TO).getType()Gets type.booleanvoidsetCancelled(boolean b) voidsetHomeName(String homeName) Sets home name.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type) Preferred constructor with explicit origin and destination and optional type.- Parameters:
player- the playerfrom- the fromto- the totype- the type
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, SyncMethod type, String homeName) Preferred constructor with explicit origin and destination, optional type, and home name.- Parameters:
player- the playerfrom- the fromto- the totype- the typehomeName- the home name
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to) Preferred constructor with explicit origin and destination (no type).- Parameters:
player- the playerfrom- the fromto- the to
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location from, org.bukkit.Location to, String homeName) Preferred constructor with explicit origin and destination and home name (no type).- Parameters:
player- the playerfrom- the fromto- the tohomeName- the home name
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type) Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.- Parameters:
player- the playerlocation- the locationtype- the type
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location) Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.- Parameters:
player- the playerlocation- the location
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, SyncMethod type, String homeName) Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.- Parameters:
player- the playerlocation- the locationtype- the typehomeName- the home name
-
OnEventAction
public OnEventAction(org.bukkit.entity.Player player, org.bukkit.Location location, String homeName) Backward-compatible: 'location' is treated as the destination ("to"). 'from' defaults to the player's current location at event creation time.- Parameters:
player- the playerlocation- the locationhomeName- the home name
-
OnEventAction
Convenience constructor for TPA events. Sets 'from' to the sender's current location and 'to' to the target's current location.- Parameters:
tpaRequest- the tpa request
-
-
Method Details
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Gets handler list.- Returns:
- the handler list
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlersin classorg.bukkit.event.Event
-
getPlayer
public org.bukkit.entity.Player getPlayer()Gets player.- Returns:
- the player
-
getFrom
public org.bukkit.Location getFrom()Origin location (where the player came FROM).- Returns:
- the from
-
getTo
public org.bukkit.Location getTo()Destination location (where the player is going TO).- Returns:
- the to
-
getLocation
Deprecated.Backward-compatible getter for the destination. Prefer getTo() in new code.- Returns:
- the location
-
getType
Gets type.- Returns:
- the type
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean b) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHomeName
Gets home name.- Returns:
- the home name
-
setHomeName
Sets home name.- Parameters:
homeName- the home name
-