Class PermissionsService
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.services.PermissionsService
This Service is responsible for handling the
Permission
of a
SlimefunItem
.
You can set up these Permission
nodes inside the permissions.yml
file.- Author:
- TheBusyBiscuit
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetLore
(SlimefunItem item) This returns the lore to display for a givenSlimefunItem
when aPlayer
does not have the required permission node.getPermission
(SlimefunItem item) This returns the associatedPermission
with the givenSlimefunItem
.boolean
hasPermission
(Permissible p, SlimefunItem item) This method checks whether the givenPermissible
has thePermission
to access the givenSlimefunItem
.void
register
(Iterable<SlimefunItem> items, boolean save) void
save()
This saves every configuredPermission
to the permissionsFile
.void
setPermission
(SlimefunItem item, String permission) This method sets thePermission
for a givenSlimefunItem
.
-
Constructor Details
-
PermissionsService
-
-
Method Details
-
register
- Parameters:
items
- AnIterable
ofSlimefunItem
s to registersave
- Whether to save the default values to our permissions file
-
hasPermission
This method checks whether the givenPermissible
has thePermission
to access the givenSlimefunItem
.- Parameters:
p
- ThePermissible
to checkitem
- TheSlimefunItem
in question- Returns:
- Whether the
Permissible
has the requiredPermission
-
getPermission
This returns the associatedPermission
with the givenSlimefunItem
. It actually returns anOptional
,Optional.empty()
means that there was noPermission
set for the givenSlimefunItem
- Parameters:
item
- TheSlimefunItem
to retrieve thePermission
for.- Returns:
- An
Optional
holding thePermission
as aString
or an emptyOptional
-
setPermission
This method sets thePermission
for a givenSlimefunItem
.- Parameters:
item
- TheSlimefunItem
to modifypermission
- ThePermission
to set
-
save
public void save()This saves every configuredPermission
to the permissionsFile
. -
getLore
This returns the lore to display for a givenSlimefunItem
when aPlayer
does not have the required permission node.- Parameters:
item
- TheSlimefunItem
- Returns:
- The configured lore to display
-