-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5201ab6
commit 78eaff0
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
api/src/main/java/de/oliver/fancynpcs/api/actions/types/NeedPermissionAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.oliver.fancynpcs.api.actions.types; | ||
|
||
import de.oliver.fancynpcs.api.actions.NpcAction; | ||
import de.oliver.fancynpcs.api.actions.executor.ActionExecutionContext; | ||
|
||
public class NeedPermissionAction extends NpcAction { | ||
|
||
public NeedPermissionAction() { | ||
super("need_permission", true); | ||
} | ||
|
||
@Override | ||
public void execute(ActionExecutionContext context, String value) { | ||
if (value == null || value.isEmpty()) { | ||
return; | ||
} | ||
|
||
if (context.getPlayer() == null) { | ||
return; | ||
} | ||
|
||
if (!context.getPlayer().hasPermission(value)) { | ||
context.terminate(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters