Class HasPermissionFunction
java.lang.Object
io.github.toberocat.guiengine.function.compute.HasPermissionFunction
- All Implemented Interfaces:
ComputeFunction
Custom compute function to check if a player has a specific permission.
Created: 14.07.2023 Author: Tobias Madlberger (Tobias)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkForFunction
(@NotNull String value) Checks if the provided value contains the function to check for the presence of a permission.@NotNull String
compute
(@NotNull GuiEngineApi api, @NotNull GuiContext context, @NotNull String value) Computes the result of the permission check using the provided API and context.
-
Constructor Details
-
HasPermissionFunction
public HasPermissionFunction()
-
-
Method Details
-
compute
@NotNull public @NotNull String compute(@NotNull @NotNull GuiEngineApi api, @NotNull @NotNull GuiContext context, @NotNull @NotNull String value) Computes the result of the permission check using the provided API and context.- Specified by:
compute
in interfaceComputeFunction
- Parameters:
api
- The `GuiEngineApi` instance used to interact with the GUI engine.context
- The `GuiContext` instance representing the GUI context for which the computation is performed.value
- The input value containing the permission node to check.- Returns:
- A string representation of the result with the permission check. `True` if the player has the specified permission, `false` otherwise.
-
checkForFunction
Checks if the provided value contains the function to check for the presence of a permission.- Specified by:
checkForFunction
in interfaceComputeFunction
- Parameters:
value
- The input value to check for the function.- Returns:
- `true` if the function is present in the value, `false` otherwise.
-