Package de.sprax2013.betterchairs
Class ChairNMS
java.lang.Object
de.sprax2013.betterchairs.ChairNMS
Provides abstraction to be used in maven modules with the specified spigot version
Why not just use the Fallback-ChairNMS in
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract @NotNull BlockFace
getBlockRotation
(@NotNull Block block) @Nullable Listener
static int
abstract boolean
hasEmptyMainHand
(@NotNull Player player) abstract boolean
Checks if an Entity is or will be used asChair
with NMS.
This method should be used to identify aChair
before it has been spawned into the world.
This can for example be used to un-cancel anEntitySpawnEvent
abstract boolean
abstract boolean
abstract boolean
abstract boolean
isStairUpsideDown
(@NotNull Block block) abstract void
killChairEntity
(@NotNull Entity entity) abstract @NotNull Entity
spawnChairEntity
(@NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) Spawns an Entity that is/has: Invisible Invincible NoGravity Silent DisabledSlots (if it is an ArmorStand) NoBounce (if it is an Arrow) The entity may fulfill the above with the help ofgetListener()
andChairUtils.applyChairProtections(Entity)
-
Field Details
-
REGENERATION_EFFECT_DURATION
public static final int REGENERATION_EFFECT_DURATION- See Also:
-
-
Constructor Details
-
ChairNMS
public ChairNMS()
-
-
Method Details
-
spawnChairEntity
@NotNull public abstract @NotNull Entity spawnChairEntity(@NotNull @NotNull Location loc, int regenerationAmplifier, boolean useArmorStand) Spawns an Entity that is/has:- Invisible
- Invincible
- NoGravity
- Silent
- DisabledSlots (if it is an ArmorStand)
- NoBounce (if it is an Arrow)
getListener()
andChairUtils.applyChairProtections(Entity)
- Parameters:
loc
- The location for the Chair-EntityregenerationAmplifier
- The amplifier for the regeneration effectuseArmorStand
- Whether an ArmorStand should be used as Entity- Returns:
- The created Entity to be used for a Chair
- See Also:
-
killChairEntity
- Parameters:
entity
- TheEntity
that should be deleted- Throws:
IllegalArgumentException
- ifentity
is not an instance of the custom Entity
-
isStair
-
isStairUpsideDown
-
getBlockRotation
-
isSlab
- Parameters:
block
- TheBlock
to check- Returns:
- true if the block is a half slab (not double slab!), false otherwise
-
isSlabTop
-
hasEmptyMainHand
-
isChair
Checks if an Entity is or will be used asChair
with NMS.
This method should be used to identify aChair
before it has been spawned into the world.
This can for example be used to un-cancel anEntitySpawnEvent
- Parameters:
entity
-Entity
to check- Returns:
- true if Entity is or will be used as Chair, false otherwise
- See Also:
-
getListener
-
getRegenerationAmplifier
-