Class SpigotAdapter

java.lang.Object
nl.pim16aap2.animatedarchitecture.spigot.util.SpigotAdapter

public final class SpigotAdapter extends Object
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 Details

    • getBukkitWorld

      @Nullable public static @Nullable org.bukkit.World getBukkitWorld(IWorld world)
      Converts an IWorld object to a World object.

      If the ILocation is an WorldSpigot, only a simple cast is performed. Otherwise, a new World is constructed.

      Parameters:
      world - The AnimatedArchitecture world.
      Returns:
      The Spigot world.
    • getBukkitLocation

      public static org.bukkit.Location getBukkitLocation(ILocation location)
      Converts an ILocation object to a Location object.

      If the ILocation is an LocationSpigot, only a simple cast is performed. Otherwise, a new Location is constructed.

      Parameters:
      location - The AnimatedArchitecture location.
      Returns:
      The Spigot location.
    • getBukkitVector

      public static org.bukkit.util.Vector getBukkitVector(Vector3Di vector)
      Gets a Bukkit vector from a AnimatedArchitecture vector.
      Parameters:
      vector - The AnimatedArchitecture vector.
      Returns:
      The bukkit vector.
    • getBukkitPlayer

      @Nullable public static @Nullable org.bukkit.entity.Player getBukkitPlayer(IPlayer player)
      Tries to get an online Bukkit player represented by an IPlayer.
      Parameters:
      player - The IPlayer.
      Returns:
      The online bukkit player, if possible.
    • getPlayerSpigot

      @Nullable public static @Nullable PlayerSpigot getPlayerSpigot(IPlayer player)
      Tries to convert an IPlayer to a PlayerSpigot.
      Parameters:
      player - The player object to convert.
      Returns:
      The converted player object, or null if that was not possible.
    • getOfflineBukkitPlayer

      public static org.bukkit.OfflinePlayer getOfflineBukkitPlayer(IPlayer player)
      Tries to get an offline Bukkit player represented by an IPlayer.
      Parameters:
      player - The IPlayer.
      Returns:
      The offline bukkit player.
    • getBukkitVector

      public static org.bukkit.util.Vector getBukkitVector(Vector3Dd vector)
      Gets a Bukkit vector from a AnimatedArchitecture vector.
      Parameters:
      vector - The AnimatedArchitecture vector.
      Returns:
      The bukkit vector.
    • wrapCommandSender

      public static ICommandSender wrapCommandSender(org.bukkit.command.CommandSender commandSender)
      Wraps a Bukkit CommandSender in an ICommandSender.
      Parameters:
      commandSender - The Bukkit command sender.
      Returns:
      The wrapped command sender.
    • unwrapCommandSender

      public static org.bukkit.command.CommandSender unwrapCommandSender(ICommandSender commandSender)
      Unwraps a ICommandSender into a Bukkit CommandSender.
      Parameters:
      commandSender - The command sender.
      Returns:
      The unwrapped bukkit command sender.
    • wrapPlayer

      public static IPlayer wrapPlayer(org.bukkit.entity.Player player)
      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

      public static ILocation wrapLocation(org.bukkit.Location location)
      Wraps a Bukkit location in an ILocation.
      Parameters:
      location - The Bukkit location.
      Returns:
      The ILocation.
    • wrapWorld

      public static IWorld wrapWorld(org.bukkit.World world)
      Wraps a Bukkit world in an IWorld.
      Parameters:
      world - The Bukkit world.
      Returns:
      The IWorld.