#768 Adjust to ConfigMe 0.2 and restrict command with permission

This commit is contained in:
ljacqu
2016-10-16 21:40:59 +02:00
parent ed6c7043ae
commit 77d4f4b24d
8 changed files with 67 additions and 65 deletions
@@ -8,126 +8,125 @@ public enum AdminPermission implements PermissionNode {
/**
* Administrator command to register a new user.
*/
REGISTER("authme.admin.register", DefaultPermission.OP_ONLY),
REGISTER("authme.admin.register"),
/**
* Administrator command to unregister an existing user.
*/
UNREGISTER("authme.admin.unregister", DefaultPermission.OP_ONLY),
UNREGISTER("authme.admin.unregister"),
/**
* Administrator command to force-login an existing user.
*/
FORCE_LOGIN("authme.admin.forcelogin", DefaultPermission.OP_ONLY),
FORCE_LOGIN("authme.admin.forcelogin"),
/**
* Administrator command to change the password of a user.
*/
CHANGE_PASSWORD("authme.admin.changepassword", DefaultPermission.OP_ONLY),
CHANGE_PASSWORD("authme.admin.changepassword"),
/**
* Administrator command to see the last login date and time of a user.
*/
LAST_LOGIN("authme.admin.lastlogin", DefaultPermission.OP_ONLY),
LAST_LOGIN("authme.admin.lastlogin"),
/**
* Administrator command to see all accounts associated with a user.
*/
ACCOUNTS("authme.admin.accounts", DefaultPermission.OP_ONLY),
ACCOUNTS("authme.admin.accounts"),
/**
* Administrator command to get the email address of a user, if set.
*/
GET_EMAIL("authme.admin.getemail", DefaultPermission.OP_ONLY),
GET_EMAIL("authme.admin.getemail"),
/**
* Administrator command to set or change the email address of a user.
*/
CHANGE_EMAIL("authme.admin.changemail", DefaultPermission.OP_ONLY),
CHANGE_EMAIL("authme.admin.changemail"),
/**
* Administrator command to get the last known IP of a user.
*/
GET_IP("authme.admin.getip", DefaultPermission.OP_ONLY),
GET_IP("authme.admin.getip"),
/**
* Administrator command to teleport to the AuthMe spawn.
*/
SPAWN("authme.admin.spawn", DefaultPermission.OP_ONLY),
SPAWN("authme.admin.spawn"),
/**
* Administrator command to set the AuthMe spawn.
*/
SET_SPAWN("authme.admin.setspawn", DefaultPermission.OP_ONLY),
SET_SPAWN("authme.admin.setspawn"),
/**
* Administrator command to teleport to the first AuthMe spawn.
*/
FIRST_SPAWN("authme.admin.firstspawn", DefaultPermission.OP_ONLY),
FIRST_SPAWN("authme.admin.firstspawn"),
/**
* Administrator command to set the first AuthMe spawn.
*/
SET_FIRST_SPAWN("authme.admin.setfirstspawn", DefaultPermission.OP_ONLY),
SET_FIRST_SPAWN("authme.admin.setfirstspawn"),
/**
* Administrator command to purge old user data.
*/
PURGE("authme.admin.purge", DefaultPermission.OP_ONLY),
PURGE("authme.admin.purge"),
/**
* Administrator command to purge the last position of a user.
*/
PURGE_LAST_POSITION("authme.admin.purgelastpos", DefaultPermission.OP_ONLY),
PURGE_LAST_POSITION("authme.admin.purgelastpos"),
/**
* Administrator command to purge all data associated with banned players.
*/
PURGE_BANNED_PLAYERS("authme.admin.purgebannedplayers", DefaultPermission.OP_ONLY),
PURGE_BANNED_PLAYERS("authme.admin.purgebannedplayers"),
/**
* Administrator command to toggle the AntiBot protection status.
*/
SWITCH_ANTIBOT("authme.admin.switchantibot", DefaultPermission.OP_ONLY),
SWITCH_ANTIBOT("authme.admin.switchantibot"),
/**
* Administrator command to convert old or other data to AuthMe data.
*/
CONVERTER("authme.admin.converter", DefaultPermission.OP_ONLY),
CONVERTER("authme.admin.converter"),
/**
* Administrator command to reload the plugin configuration.
*/
RELOAD("authme.admin.reload", DefaultPermission.OP_ONLY),
RELOAD("authme.admin.reload"),
/**
* Permission to see Antibot messages.
*/
ANTIBOT_MESSAGES("authme.admin.antibotmessages", DefaultPermission.OP_ONLY),
ANTIBOT_MESSAGES("authme.admin.antibotmessages"),
/**
* Permission to use the update messages command.
*/
UPDATE_MESSAGES("authme.admin.updatemessages"),
/**
* Permission to see the other accounts of the players that log in.
*/
SEE_OTHER_ACCOUNTS("authme.admin.seeotheraccounts", DefaultPermission.OP_ONLY);
SEE_OTHER_ACCOUNTS("authme.admin.seeotheraccounts");
/**
* The permission node.
*/
private String node;
/**
* The default permission level
*/
private DefaultPermission defaultPermission;
/**
* Constructor.
*
* @param node Permission node.
*/
AdminPermission(String node, DefaultPermission defaultPermission) {
AdminPermission(String node) {
this.node = node;
this.defaultPermission = defaultPermission;
}
@Override
@@ -137,6 +136,6 @@ public enum AdminPermission implements PermissionNode {
@Override
public DefaultPermission getDefaultPermission() {
return defaultPermission;
return DefaultPermission.OP_ONLY;
}
}
@@ -8,76 +8,70 @@ public enum PlayerPermission implements PermissionNode {
/**
* Command permission to login.
*/
LOGIN("authme.player.login", DefaultPermission.ALLOWED),
LOGIN("authme.player.login"),
/**
* Command permission to logout.
*/
LOGOUT("authme.player.logout", DefaultPermission.ALLOWED),
LOGOUT("authme.player.logout"),
/**
* Command permission to register.
*/
REGISTER("authme.player.register", DefaultPermission.ALLOWED),
REGISTER("authme.player.register"),
/**
* Command permission to unregister.
*/
UNREGISTER("authme.player.unregister", DefaultPermission.ALLOWED),
UNREGISTER("authme.player.unregister"),
/**
* Command permission to change the password.
*/
CHANGE_PASSWORD("authme.player.changepassword", DefaultPermission.ALLOWED),
CHANGE_PASSWORD("authme.player.changepassword"),
/**
* Command permission to add an email address.
*/
ADD_EMAIL("authme.player.email.add", DefaultPermission.ALLOWED),
ADD_EMAIL("authme.player.email.add"),
/**
* Command permission to change the email address.
*/
CHANGE_EMAIL("authme.player.email.change", DefaultPermission.ALLOWED),
CHANGE_EMAIL("authme.player.email.change"),
/**
* Command permission to recover an account using it's email address.
*/
RECOVER_EMAIL("authme.player.email.recover", DefaultPermission.ALLOWED),
RECOVER_EMAIL("authme.player.email.recover"),
/**
* Command permission to use captcha.
*/
CAPTCHA("authme.player.captcha", DefaultPermission.ALLOWED),
CAPTCHA("authme.player.captcha"),
/**
* Permission for users a login can be forced to.
*/
CAN_LOGIN_BE_FORCED("authme.player.canbeforced", DefaultPermission.ALLOWED),
CAN_LOGIN_BE_FORCED("authme.player.canbeforced"),
/**
* Permission to use to see own other accounts.
*/
SEE_OWN_ACCOUNTS("authme.player.seeownaccounts", DefaultPermission.ALLOWED);
SEE_OWN_ACCOUNTS("authme.player.seeownaccounts");
/**
* The permission node.
*/
private String node;
/**
* The default permission level
*/
private DefaultPermission defaultPermission;
/**
* Constructor.
*
* @param node Permission node.
*/
PlayerPermission(String node, DefaultPermission defaultPermission) {
PlayerPermission(String node) {
this.node = node;
this.defaultPermission = defaultPermission;
}
@Override
@@ -87,7 +81,7 @@ public enum PlayerPermission implements PermissionNode {
@Override
public DefaultPermission getDefaultPermission() {
return defaultPermission;
return DefaultPermission.ALLOWED;
}
}
@@ -27,7 +27,7 @@ public enum PlayerStatePermission implements PermissionNode {
ALLOW_MULTIPLE_ACCOUNTS("authme.allowmultipleaccounts", DefaultPermission.OP_ONLY),
/**
* Permission to bypass the purging process
* Permission to bypass the purging process.
*/
BYPASS_PURGE("authme.bypasspurge", DefaultPermission.NOT_ALLOWED);
@@ -44,7 +44,8 @@ public enum PlayerStatePermission implements PermissionNode {
/**
* Constructor.
*
* @param node Permission node.
* @param node Permission node
* @param defaultPermission The default permission
*/
PlayerStatePermission(String node, DefaultPermission defaultPermission) {
this.node = node;