-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
b59d6ed
commit bc43072
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
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
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
27 changes: 27 additions & 0 deletions
27
src/main/java/org/mcmonkey/sentinel/integration/SentinelPermissions.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,27 @@ | ||
package org.mcmonkey.sentinel.integration; | ||
|
||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Player; | ||
import org.mcmonkey.sentinel.SentinelIntegration; | ||
|
||
public class SentinelPermissions extends SentinelIntegration { | ||
|
||
@Override | ||
public String getTargetHelp() { | ||
return "permission:PERM.KEY"; | ||
} | ||
|
||
@Override | ||
public boolean isTarget(LivingEntity ent, String text) { | ||
if (!(ent instanceof Player)) { | ||
return false; | ||
} | ||
if (text.startsWith("permission:")) { | ||
String pText = text.substring("permission:".length()); | ||
if (((Player) ent).hasPermission(pText)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |