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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @NotNull BlockFacegetBlockRotation(@NotNull Block block) @Nullable Listenerstatic intabstract booleanhasEmptyMainHand(@NotNull Player player) abstract booleanChecks if an Entity is or will be used asChairwith NMS.
This method should be used to identify aChairbefore it has been spawned into the world.
This can for example be used to un-cancel anEntitySpawnEventabstract booleanabstract booleanabstract booleanabstract booleanisStairUpsideDown(@NotNull Block block) abstract voidkillChairEntity(@NotNull Entity entity) abstract @NotNull EntityspawnChairEntity(@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- TheEntitythat should be deleted- Throws:
IllegalArgumentException- ifentityis not an instance of the custom Entity
-
isStair
-
isStairUpsideDown
-
getBlockRotation
-
isSlab
- Parameters:
block- TheBlockto 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 asChairwith NMS.
This method should be used to identify aChairbefore it has been spawned into the world.
This can for example be used to un-cancel anEntitySpawnEvent- Parameters:
entity-Entityto check- Returns:
- true if Entity is or will be used as Chair, false otherwise
- See Also:
-
getListener
-
getRegenerationAmplifier
-