mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-24 01:01:51 +01:00
refactor: Add shortcut methods to ParsedDestination
This commit is contained in:
parent
71367d2d69
commit
5d1d71baf2
@ -2,6 +2,10 @@ package com.onarandombox.MultiverseCore.destination;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.Destination;
|
||||
import com.onarandombox.MultiverseCore.api.DestinationInstance;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A parsed destination.
|
||||
@ -23,6 +27,34 @@ public class ParsedDestination<S extends DestinationInstance> {
|
||||
this.destinationInstance = destinationInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for {@link Destination#getIdentifier()}.
|
||||
*
|
||||
* @return The destination identifier.
|
||||
*/
|
||||
public @NotNull String getIdentifier() {
|
||||
return destination.getIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for {@link DestinationInstance#getLocation(Entity)}.
|
||||
*
|
||||
* @param teleportee The entity to teleport.
|
||||
* @return The location to teleport to.
|
||||
*/
|
||||
public @Nullable Location getLocation(@NotNull Entity teleportee) {
|
||||
return destinationInstance.getLocation(teleportee);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for {@link DestinationInstance#getFinerPermissionSuffix()}.
|
||||
*
|
||||
* @return The finer permission suffix.
|
||||
*/
|
||||
public @Nullable String getFinerPermissionSuffix() {
|
||||
return destinationInstance.getFinerPermissionSuffix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the destination.
|
||||
*
|
||||
@ -48,6 +80,6 @@ public class ParsedDestination<S extends DestinationInstance> {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return destination.getIdentifier() + ":" + destinationInstance.serialise();
|
||||
return getIdentifier() + ":" + destinationInstance.serialise();
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ public class SimpleSafeTTeleporter implements SafeTTeleporter {
|
||||
|
||||
MultiverseCore.addPlayerToTeleportQueue(teleporter.getIssuer().getName(), teleporteePlayer.getName());
|
||||
|
||||
Location safeLoc = destination.getDestinationInstance().getLocation(teleportee);
|
||||
Location safeLoc = destination.getLocation(teleportee);
|
||||
if (destination.getDestination().checkTeleportSafety()) {
|
||||
safeLoc = this.getSafeLocation(teleportee, destination.getDestinationInstance());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user