Class SpigotAdapter
java.lang.Object
nl.pim16aap2.animatedarchitecture.spigot.util.SpigotAdapter
Class that contains utility methods to convert between AnimatedArchitecture and Spigot objects.
For example, getBukkitWorld(IWorld) converts an IWorld to a World and
wrapWorld(World) can be used to do the opposite.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.LocationgetBukkitLocation(ILocation location) Converts anILocationobject to aLocationobject.static @Nullable org.bukkit.entity.PlayergetBukkitPlayer(IPlayer player) Tries to get an online Bukkit player represented by anIPlayer.static org.bukkit.util.VectorgetBukkitVector(Vector3Dd vector) Gets a Bukkit vector from a AnimatedArchitecture vector.static org.bukkit.util.VectorgetBukkitVector(Vector3Di vector) Gets a Bukkit vector from a AnimatedArchitecture vector.static @Nullable org.bukkit.WorldgetBukkitWorld(IWorld world) Converts anIWorldobject to aWorldobject.static org.bukkit.OfflinePlayergetOfflineBukkitPlayer(IPlayer player) Tries to get an offline Bukkit player represented by anIPlayer.static @Nullable PlayerSpigotgetPlayerSpigot(IPlayer player) Tries to convert anIPlayerto aPlayerSpigot.static org.bukkit.command.CommandSenderunwrapCommandSender(ICommandSender commandSender) Unwraps aICommandSenderinto a BukkitCommandSender.static ICommandSenderwrapCommandSender(org.bukkit.command.CommandSender commandSender) Wraps a BukkitCommandSenderin anICommandSender.static ILocationwrapLocation(org.bukkit.Location location) Wraps a Bukkit location in an ILocation.static CompletableFuture<Optional<IPlayer>> wrapPlayer(IPlayerFactory factory, org.bukkit.OfflinePlayer player) Wraps an offline Bukkit player in an IPlayer.static IPlayerwrapPlayer(org.bukkit.entity.Player player) Wraps a Bukkit player in an IPlayer.static IWorldwrapWorld(org.bukkit.World world) Wraps a Bukkit world in an IWorld.
-
Method Details
-
getBukkitWorld
Converts anIWorldobject to aWorldobject.If the
ILocationis anWorldSpigot, only a simple cast is performed. Otherwise, a newWorldis constructed.- Parameters:
world- The AnimatedArchitecture world.- Returns:
- The Spigot world.
-
getBukkitLocation
Converts anILocationobject to aLocationobject.If the
ILocationis anLocationSpigot, only a simple cast is performed. Otherwise, a newLocationis constructed.- Parameters:
location- The AnimatedArchitecture location.- Returns:
- The Spigot location.
-
getBukkitVector
Gets a Bukkit vector from a AnimatedArchitecture vector.- Parameters:
vector- The AnimatedArchitecture vector.- Returns:
- The bukkit vector.
-
getBukkitPlayer
Tries to get an online Bukkit player represented by anIPlayer.- Parameters:
player- TheIPlayer.- Returns:
- The online bukkit player, if possible.
-
getPlayerSpigot
Tries to convert anIPlayerto aPlayerSpigot.- Parameters:
player- The player object to convert.- Returns:
- The converted player object, or null if that was not possible.
-
getOfflineBukkitPlayer
Tries to get an offline Bukkit player represented by anIPlayer.- Parameters:
player- TheIPlayer.- Returns:
- The offline bukkit player.
-
getBukkitVector
Gets a Bukkit vector from a AnimatedArchitecture vector.- Parameters:
vector- The AnimatedArchitecture vector.- Returns:
- The bukkit vector.
-
wrapCommandSender
Wraps a BukkitCommandSenderin anICommandSender.- Parameters:
commandSender- The Bukkit command sender.- Returns:
- The wrapped command sender.
-
unwrapCommandSender
Unwraps aICommandSenderinto a BukkitCommandSender.- Parameters:
commandSender- The command sender.- Returns:
- The unwrapped bukkit command sender.
-
wrapPlayer
Wraps a Bukkit player in an IPlayer.- Parameters:
player- The Bukkit player.- Returns:
- The IPlayer.
-
wrapPlayer
public static CompletableFuture<Optional<IPlayer>> wrapPlayer(IPlayerFactory factory, org.bukkit.OfflinePlayer player) Wraps an offline Bukkit player in an IPlayer.- Parameters:
player- The Bukkit player.- Returns:
- The IPlayer.
-
wrapLocation
Wraps a Bukkit location in an ILocation.- Parameters:
location- The Bukkit location.- Returns:
- The ILocation.
-
wrapWorld
Wraps a Bukkit world in an IWorld.- Parameters:
world- The Bukkit world.- Returns:
- The IWorld.
-