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
Modifier and TypeFieldDescriptionprotected final ChairNMS
protected final File
protected static ChairManager
protected static JavaPlugin
-
Constructor Summary
ModifierConstructorDescriptionprotected
ChairManager
(@NotNull JavaPlugin plugin, @NotNull ChairNMS chairNMS) -
Method Summary
Modifier and TypeMethodDescriptionboolean
This method is a shortcut forcreate(Player, Block, double)
withyOffset = ChairUtils#getSitOffset
boolean
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)
void
Callsdestroy(Chair, boolean, boolean)
withsameTickTeleport = false
void
int
destroyAll
(boolean teleportPlayer) int
destroyAll
(boolean teleportPlayer, boolean sameTickTeleport) @Nullable Chair
@Nullable Chair
@Nullable Chair
static @Nullable ChairManager
May be null if BetterChairs is not enabledstatic @NotNull Logger
Returns BetterChair's logger or the global one, whengetPlugin()
isnull
.static @Nullable JavaPlugin
May be null if BetterChairs is not enabledboolean
hasChairsDisabled
(UUID uuid) boolean
hasChairsDisabled
(OfflinePlayer player) boolean
This does not yet guarantee thatgetChair(Entity)
is notnull
This may return true for Entities not yet spawned and thus not yet aChair
that is readyboolean
isOccupied
(@NotNull Block b) protected void
void
setChairsDisabled
(UUID uuid, boolean areDisabled) void
setChairsDisabled
(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
- TheChair
that should be destroyedteleportPlayer
- true, when called without anPlayerTeleportEvent
being fired afterwards (e.g.EntityDismountEvent
does)- See Also:
-
destroy
- Parameters:
chair
- TheChair
that should be destroyedteleportPlayer
- true, when called without anPlayerTeleportEvent
being fired afterwards (e.g.EntityDismountEvent
does)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 aChair
that is ready -
hasChairsDisabled
-
hasChairsDisabled
-
setChairsDisabled
-
setChairsDisabled
-
getLogger
Returns BetterChair's logger or the global one, whengetPlugin()
isnull
.- Returns:
- The plugin's
Logger
or the global one, never null
-
getInstance
May be null if BetterChairs is not enabled- Returns:
- The
ChairManager
instance created by BetterChairs, or null
-
getPlugin
May be null if BetterChairs is not enabled- Returns:
- The
JavaPlugin
instance representing BetterChairs, or null
-