Class CompatibilityLayer


  • public class CompatibilityLayer
    extends java.lang.Object
    Utility class to enable version specific minecraft features.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void init()
      Initialise the reflection class, methods and fields.
      static boolean isAnchorSpawn​(org.bukkit.event.player.PlayerRespawnEvent event)
      Check if the respawn point is of respawn anchor type.
      static boolean isUseTravelAgent()
      Gets if Travel Agent is supported on the server's minecraft version.
      static void setPortalSearchRadius​(org.bukkit.event.entity.EntityPortalEvent event, int searchRadius)
      Sets search radius for a EntityPortalEvent.
      static void setPortalSearchRadius​(org.bukkit.event.player.PlayerPortalEvent event, int searchRadius)
      Sets search radius for a PlayerPortalEvent.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompatibilityLayer

        public CompatibilityLayer()
    • Method Detail

      • init

        public static void init()
        Initialise the reflection class, methods and fields.
      • isAnchorSpawn

        public static boolean isAnchorSpawn​(org.bukkit.event.player.PlayerRespawnEvent event)

        Check if the respawn point is of respawn anchor type.

        Introduced in minecraft 1.16

        Parameters:
        event - A player respawn event.
        Returns:
        If the respawn location is an anchor point.
      • isUseTravelAgent

        public static boolean isUseTravelAgent()

        Gets if Travel Agent is supported on the server's minecraft version.

        Removed in minecraft 1.14

        Returns:
        True if Travel Agent is supported, else false.
      • setPortalSearchRadius

        public static void setPortalSearchRadius​(org.bukkit.event.player.PlayerPortalEvent event,
                                                 int searchRadius)

        Sets search radius for a PlayerPortalEvent.

        Use travel agent if available, else using new PlayerPortalEvent.setSearchRadius(int) method introduced in minecraft 1.15

        Parameters:
        event - A Player Portal Event.
        searchRadius - Target search radius to set to.
      • setPortalSearchRadius

        public static void setPortalSearchRadius​(org.bukkit.event.entity.EntityPortalEvent event,
                                                 int searchRadius)

        Sets search radius for a EntityPortalEvent.

        Use travel agent if available, else using new EntityPortalEvent.setSearchRadius(int) method introduced in minecraft 1.15

        Parameters:
        event - A Entity Portal Event.
        searchRadius - Target search radius to set to.