Class ChairNMS

  • public abstract class ChairNMS
    extends Object
    Provides abstraction to be used in maven modules with the specified spigot version

    Why not just use the Fallback-ChairNMS in #onEnable()?
    • Using the fallback in newer versions requires Spigot to enable old material support
    • NMS allows us to easily rotate the ArmorStand together with the player (without using PlayerMoveEvent)
    • Field Detail


        public static final int REGENERATION_EFFECT_DURATION
        See Also:
        Constant Field Values
    • Constructor Detail

      • ChairNMS

        public ChairNMS()
    • Method Detail

      • spawnChairArmorStand

        public abstract @NotNull org.bukkit.entity.ArmorStand spawnChairArmorStand​(@NotNull
                                                                                   @NotNull org.bukkit.Location loc,
                                                                                   int regenerationAmplifier)
        Spawns an ArmorStand that is/has:
        • Invisible
        • Invincible
        • NoGravity
        • DisabledSlots
        The ArmorStand may fulfill the above with the help of getListener().
        loc - The location for the Chair-ArmorStand
        regenerationAmplifier - The amplifier for the regeneration effect
        The created ArmorStand to be used for an Chair
        See Also:
      • killChairArmorStand

        public abstract void killChairArmorStand​(@NotNull
                                                 @NotNull org.bukkit.entity.ArmorStand armorStand)
        armorStand - The ArmorStand that should be deleted
        IllegalArgumentException - if armorStand is not an instance of CustomArmorStand
      • isStair

        public abstract boolean isStair​(@NotNull
                                        @NotNull org.bukkit.block.Block block)
      • isStairUpsideDown

        public abstract boolean isStairUpsideDown​(@NotNull
                                                  @NotNull org.bukkit.block.Block block)
      • getBlockRotation

        public abstract @NotNull org.bukkit.block.BlockFace getBlockRotation​(@NotNull
                                                                             @NotNull org.bukkit.block.Block block)
      • isSlab

        public abstract boolean isSlab​(@NotNull
                                       @NotNull org.bukkit.block.Block block)
        block - The Block to check
        true if the block is a half slab (not double slab!), false otherwise
      • isSlabTop

        public abstract boolean isSlabTop​(@NotNull
                                          @NotNull org.bukkit.block.Block block)
      • hasEmptyHands

        public abstract boolean hasEmptyHands​(@NotNull
                                              @NotNull org.bukkit.entity.Player player)
      • isChair

        public abstract boolean isChair​(@NotNull
                                        @NotNull org.bukkit.entity.ArmorStand armorStand)
        Checks if an ArmorStand is or will be used as Chair with NMS.
        This method should be used to identify a Chair before it has been spawned into the world.
        This can for example be used to un-cancel an EntitySpawnEvent
        armorStand - ArmorStand to check
        true if ArmorStand is or will be used as Chair, false otherwise
        See Also:
      • getListener

        public @Nullable org.bukkit.event.Listener getListener()
      • getRegenerationAmplifier

        public static int getRegenerationAmplifier​(org.bukkit.entity.Player p)