Package de.sprax2013.betterchairs
Class ChairManager
java.lang.Object
de.sprax2013.betterchairs.ChairManager
This class should be instantiated as soon as possible inside
JavaPlugin.onEnable() to ensure that other classes relying on it work as intended-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChairNMSprotected final Fileprotected static ChairManagerprotected static JavaPlugin -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedChairManager(@NotNull JavaPlugin plugin, @NotNull ChairNMS chairNMS) -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method is a shortcut forcreate(Player, Block, double)withyOffset = ChairUtils#getSitOffsetbooleanCheck if a chair can be spawned and call an Event.
If the event doesn't get cancelled, the player should then be able to sit.
IgnoreshasChairsDisabled(OfflinePlayer)voidCallsdestroy(Chair, boolean, boolean)withsameTickTeleport = falsevoidintdestroyAll(boolean teleportPlayer) intdestroyAll(boolean teleportPlayer, boolean sameTickTeleport) @Nullable Chair@Nullable Chair@Nullable Chairstatic @Nullable ChairManagerMay be null if BetterChairs is not enabledstatic @NotNull LoggerReturns BetterChair's logger or the global one, whengetPlugin()isnull.static @Nullable JavaPluginMay be null if BetterChairs is not enabledbooleanhasChairsDisabled(UUID uuid) booleanhasChairsDisabled(OfflinePlayer player) booleanThis does not yet guarantee thatgetChair(Entity)is notnull
This may return true for Entities not yet spawned and thus not yet aChairthat is readybooleanisOccupied(@NotNull Block b) protected voidvoidsetChairsDisabled(UUID uuid, boolean areDisabled) voidsetChairsDisabled(Player player, boolean areDisabled)
-
Field Details
-
plugin
-
instance
-
chairNMS
-
chairs
-
disabled
-
disabledForDir
-
-
Constructor Details
-
ChairManager
-
-
Method Details
-
onQuit
-
create
This method is a shortcut forcreate(Player, Block, double)withyOffset = ChairUtils#getSitOffset- See Also:
-
create
Check if a chair can be spawned and call an Event.
If the event doesn't get cancelled, the player should then be able to sit.
IgnoreshasChairsDisabled(OfflinePlayer)- Parameters:
player- The player that should sitblock- The block the player should sit on- Returns:
- true if player is now sitting on a chair, false otherwise
-
destroy
Callsdestroy(Chair, boolean, boolean)withsameTickTeleport = false- Parameters:
chair- TheChairthat should be destroyedteleportPlayer- true, when called without anPlayerTeleportEventbeing fired afterwards (e.g.EntityDismountEventdoes)- See Also:
-
destroy
- Parameters:
chair- TheChairthat should be destroyedteleportPlayer- true, when called without anPlayerTeleportEventbeing fired afterwards (e.g.EntityDismountEventdoes)sameTickTeleport- For compatibility reasons the player is teleported on the next server tick. This may not be possible in some situations
-
destroyAll
public int destroyAll(boolean teleportPlayer) -
destroyAll
public int destroyAll(boolean teleportPlayer, boolean sameTickTeleport) -
isOccupied
- Parameters:
b- The block to check- Returns:
- true if a player is sitting on it, false otherwise
-
getChair
-
getChair
-
getChair
-
isChair
This does not yet guarantee thatgetChair(Entity)is notnull
This may return true for Entities not yet spawned and thus not yet aChairthat is ready -
hasChairsDisabled
-
hasChairsDisabled
-
setChairsDisabled
-
setChairsDisabled
-
getLogger
Returns BetterChair's logger or the global one, whengetPlugin()isnull.- Returns:
- The plugin's
Loggeror the global one, never null
-
getInstance
May be null if BetterChairs is not enabled- Returns:
- The
ChairManagerinstance created by BetterChairs, or null
-
getPlugin
May be null if BetterChairs is not enabled- Returns:
- The
JavaPlugininstance representing BetterChairs, or null
-