The admin permission now also supports the placeholder <alias>.
The admin permission now also supports the placeholder <alias>.
This commit is contained in:
parent
0c1d32e0e8
commit
a1ffd48f3e
@ -52,7 +52,7 @@ public class ExecuteAlias {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))) {
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
aliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class ExecuteAlias {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))){
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
subAliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
|
@ -11,20 +11,25 @@ public class AliasRegisterPermissions {
|
||||
public static void onPermRegister() {
|
||||
|
||||
for (AliasObject aliasObject : Main.aliasHashMap.values()) {
|
||||
if (Bukkit.getPluginManager().getPermission(aliasObject.permission.toLowerCase()) == null) {
|
||||
T2Cregister.permission(aliasObject.permission.toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.toLowerCase()) == null) {
|
||||
T2Cregister.permission(aliasObject.adminPermission.toLowerCase(), Main.getPlugin());
|
||||
|
||||
for (String alias : aliasObject.aliasList){
|
||||
if (Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(aliasObject.permission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(aliasObject.adminPermission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
|
||||
if (Bukkit.getPluginManager().getPermission(subAliasObject.permission.toLowerCase()) == null) {
|
||||
T2Cregister.permission(subAliasObject.permission.toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.toLowerCase()) == null) {
|
||||
T2Cregister.permission(subAliasObject.adminPermission.toLowerCase(), Main.getPlugin());
|
||||
for (String alias : subAliasObject.subAliasList){
|
||||
if (Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(subAliasObject.permission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(subAliasObject.adminPermission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -78,6 +78,8 @@ Alias:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
# The placeholder <alias> is the alias name.
|
||||
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
|
||||
Permission: t2code.alias.admin
|
||||
Command:
|
||||
# Here you can tell the alias to execute one or more commands
|
||||
|
@ -20,7 +20,7 @@ SubAlias:
|
||||
Necessary: true
|
||||
# Here you can set the permission for the alias.
|
||||
# The placeholder <alias> is the alias name.
|
||||
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
|
||||
# If you have set multiple alias referrers in the list 'Alias.SubAliasList' you have a permission for each alias.
|
||||
Permission: 't2code.alias.use.subalias.<alias>'
|
||||
# Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank.
|
||||
CustomNoPermissionMSG: ""
|
||||
@ -82,6 +82,8 @@ SubAlias:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
# The placeholder <alias> is the alias name.
|
||||
# If you have set multiple alias referrers in the list 'Alias.SubAliasList' you have a permission for each alias.
|
||||
Permission: t2code.alias.admin
|
||||
Command:
|
||||
# Here you can tell the alias to execute one or more commands
|
||||
|
Loading…
Reference in New Issue
Block a user