Created
June 11, 2011 03:32
-
-
Save CruzBishop/1020218 to your computer and use it in GitHub Desktop.
Permissions for Graham
This file contains hidden or 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
public class Player extends LivingEntity { | |
private ArrayList<String> permissions = new ArrayList<String>(); | |
//(Load the permissions, of course. I used Json and Yaml in two projects, but I'm sure you'll have something better) | |
public boolean hasPermission(string requestedPermission) { | |
if (permissions.contains("*")) //Is this correct in Java? I think it might be a fragment of C# | |
return true; | |
for (string permission : this.permissions) { | |
if (permission.startsWith(requestedPermission)) | |
return true; | |
} | |
return false; | |
} | |
//And your other code, of course | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment