Interface Destination<D extends Destination<D,T,F>,T extends DestinationInstance<T,D>,F extends FailureReason>
- Type Parameters:
D
- The type of the destinationT
- The type of the destination instance
- All Known Implementing Classes:
AnchorDestination
,BedDestination
,CannonDestination
,ExactDestination
,PlayerDestination
,WorldDestination
@Contract
public interface Destination<D extends Destination<D,T,F>,T extends DestinationInstance<T,D>,F extends FailureReason>
A destination is a location that can be teleported to.
Please ensure you implement at least one of
Please ensure you implement at least one of
getDestinationInstance(CommandSender, String)
or
getDestinationInstance(String)
to prevent a stack overflow.-
Method Summary
Modifier and TypeMethodDescriptiongetDestinationInstance
(@NotNull String destinationParams) Deprecated, for removal: This API element is subject to removal in a future version.getDestinationInstance
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String destinationParams) Returns the destination instance for the given destination parameters with sender context.@NotNull String
Returns the identifier or prefix required for this destination.@NotNull Collection
<DestinationSuggestionPacket> suggestDestinations
(@NotNull org.bukkit.command.CommandSender commandSender, @Nullable String destinationParams) Returns a list of possible destinations for the given destination parameters.
-
Method Details
-
getIdentifier
Returns the identifier or prefix required for this destination.Portals have a prefix of "p" for example and OpenWarp (third party plugin) uses "ow". This is derived from a hash and cannot have duplicate values. Means that your plugin cannot use 'p' because it's already used. Please check the wiki when adding a custom destination!
- Returns:
- The identifier or prefix required for this destination.
-
getDestinationInstance
@Deprecated(forRemoval=true, since="5.1") @ScheduledForRemoval(inVersion="6.0") @NotNull default @NotNull Attempt<T,F> getDestinationInstance(@NotNull @NotNull String destinationParams) Deprecated, for removal: This API element is subject to removal in a future version.UsegetDestinationInstance(CommandSender, String)
instead. This method will no longer be called byDestinationsProvider
.Returns the destination instance for the given destination parameters.- Parameters:
destinationParams
- The destination parameters. ex: p:MyPortal:nw- Returns:
- The destination instance, or null if the destination parameters are invalid.
-
getDestinationInstance
@AvailableSince("5.1") default Attempt<T,F> getDestinationInstance(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String destinationParams) Returns the destination instance for the given destination parameters with sender context. This allows for shorthands such as getting location or name from sender. If no sender context is available, useBukkit.getConsoleSender()
will be defaulted byDestinationsProvider
.
Note that the resultingDestinationInstance
should be (de)serializable without the original sender context.
For example, the parsable string with sender context `e:@here` should return aDestinationInstance
that is serialized to `e:world:x,y,z:p:y`, which can be deserialized without the original sender context.- Parameters:
sender
- The sender context.destinationParams
- The destination parameters. ex: p:MyPortal:nw- Returns:
- The destination instance, or null if the destination parameters are invalid.
- Since:
- 5.1
-
suggestDestinations
@NotNull @NotNull Collection<DestinationSuggestionPacket> suggestDestinations(@NotNull @NotNull org.bukkit.command.CommandSender commandSender, @Nullable @Nullable String destinationParams) Returns a list of possible destinations for the given destination parameters. This packet's destination should be this instance and not other destinations.- Parameters:
commandSender
- The command senderdestinationParams
- The destination parameters. ex: p:MyPortal:nw- Returns:
- A list of possible destinations
-
getDestinationInstance(CommandSender, String)
instead.