Better permissions in plugin.yml (Many thanks to SpaceManiac for the help) (Fix to issue #55)

Removed isOp from permissions checks, no longer needed.
This commit is contained in:
NuclearW 2011-07-19 23:01:00 -04:00
parent ca009f3d22
commit dd3529eca1
2 changed files with 65 additions and 59 deletions

View File

@ -644,7 +644,7 @@ public class mcMMO extends JavaPlugin
/* /*
* FFS -> MySQL * FFS -> MySQL
*/ */
else if(label.equalsIgnoreCase("mmoupdate") && player.isOp()) else if(label.equalsIgnoreCase("mmoupdate"))
{ {
if(!mcPermissions.getInstance().admin(player)) if(!mcPermissions.getInstance().admin(player))
{ {
@ -912,17 +912,6 @@ public class mcMMO extends JavaPlugin
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled")); player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled"));
PP.toggleGodMode(); PP.toggleGodMode();
} }
} else if (player.isOp())
{
if(PP.getGodMode())
{
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
PP.toggleGodMode();
} else
{
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled"));
PP.toggleGodMode();
}
} }
} }
else if(LoadProperties.clearmyspawnEnable && LoadProperties.enableMySpawn && label.equalsIgnoreCase(LoadProperties.clearmyspawn) && mcPermissions.getInstance().mySpawn(player)) else if(LoadProperties.clearmyspawnEnable && LoadProperties.enableMySpawn && label.equalsIgnoreCase(LoadProperties.clearmyspawn) && mcPermissions.getInstance().mySpawn(player))
@ -1027,7 +1016,7 @@ public class mcMMO extends JavaPlugin
/* /*
* WHOIS COMMAND * WHOIS COMMAND
*/ */
else if(LoadProperties.whoisEnable && label.equalsIgnoreCase(LoadProperties.whois) && (player.isOp() || mcPermissions.getInstance().whois(player))){ else if(LoadProperties.whoisEnable && label.equalsIgnoreCase(LoadProperties.whois) && mcPermissions.getInstance().whois(player)){
if(split.length < 2){ if(split.length < 2){
player.sendMessage(ChatColor.RED + "Proper usage is /"+LoadProperties.whois+" <playername>"); player.sendMessage(ChatColor.RED + "Proper usage is /"+LoadProperties.whois+" <playername>");
return true; return true;
@ -1304,14 +1293,13 @@ public class mcMMO extends JavaPlugin
+ aMessage); + aMessage);
for (Player herp : getServer().getOnlinePlayers()) { for (Player herp : getServer().getOnlinePlayers()) {
if ((herp.isOp() || mcPermissions.getInstance().adminChat( if (mcPermissions.getInstance().adminChat(herp))
herp)))
herp.sendMessage(aPrefix + aMessage); herp.sendMessage(aPrefix + aMessage);
} }
return true; return true;
} }
if(!mcPermissions.getInstance().adminChat(player) && !player.isOp()){ if(!mcPermissions.getInstance().adminChat(player)){
player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission")); player.sendMessage(ChatColor.YELLOW+"[mcMMO]"+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
return true; return true;
} }
@ -1329,8 +1317,7 @@ public class mcMMO extends JavaPlugin
log.log(Level.INFO, "[A]<" + player.getName() + "> " log.log(Level.INFO, "[A]<" + player.getName() + "> "
+ aMessage); + aMessage);
for (Player herp : getServer().getOnlinePlayers()) { for (Player herp : getServer().getOnlinePlayers()) {
if ((herp.isOp() || mcPermissions.getInstance().adminChat( if (mcPermissions.getInstance().adminChat(herp))
herp)))
herp.sendMessage(aPrefix + aMessage); herp.sendMessage(aPrefix + aMessage);
} }
return true; return true;

View File

@ -68,18 +68,35 @@ permissions:
mcmmo.*: mcmmo.*:
description: Implies all mcmmo permissions. description: Implies all mcmmo permissions.
children: children:
mcmmo.defaults: true
#Instead of containing mcmmo.defaultsop on its own, it should specify each of mcmmo.defaultsop
mcmmo.admin: true mcmmo.admin: true
mcmmo.tools.*: true mcmmo.tools.*: true
mcmmo.chat.adminchat: true
mcmmo.defaults:
default: true
description: mcmmo permisionss that default to true
children:
mcmmo.ability.*: true mcmmo.ability.*: true
mcmmo.item.*: true mcmmo.item.*: true
mcmmo.tools.*: true mcmmo.tools.*: true
mcmmo.regeneration: true mcmmo.regeneration: true
mcmmo.motd: true mcmmo.motd: true
mcmmo.commands.*: true mcmmo.commands.*: true
mcmmo.chat.*: true mcmmo.chat.partychat: true
mcmmo.skills.*: true mcmmo.skills.*: true
mcmmo.admin:
mcmmo.defaultsop:
default: op default: op
description: mcmmo permissions that default to op
children:
mcmmo.admin: true
mcmmo.tools.*: true
mcmmo.chat.adminchat: true
mcmmo.admin:
description:
mcmmo.tools.*: mcmmo.tools.*:
description: Implies all mcmmo.tools permissions. description: Implies all mcmmo.tools permissions.
@ -88,11 +105,11 @@ permissions:
mcmmo.tools.mmoedit: true mcmmo.tools.mmoedit: true
mcmmo.tools.mcgod: true mcmmo.tools.mcgod: true
mcmmo.tools.mcrefresh: mcmmo.tools.mcrefresh:
default: op description:
mcmmo.tools.mmoedit: mcmmo.tools.mmoedit:
default: op description:
mcmmo.tools.mcgod: mcmmo.tools.mcgod:
default: op description:
mcmmo.ability.*: mcmmo.ability.*:
description: Implies all mcmmo.ability permissions. description: Implies all mcmmo.ability permissions.
@ -105,32 +122,32 @@ permissions:
mcmmo.ability.swords: true mcmmo.ability.swords: true
mcmmo.ability.woodcutting: true mcmmo.ability.woodcutting: true
mcmmo.ability.herbalism: mcmmo.ability.herbalism:
default: true description:
mcmmo.ability.excavation: mcmmo.ability.excavation:
default: true description:
mcmmo.ability.unarmed: mcmmo.ability.unarmed:
default: true description:
mcmmo.ability.mining: mcmmo.ability.mining:
default: true description:
mcmmo.ability.axes: mcmmo.ability.axes:
default: true description:
mcmmo.ability.swords: mcmmo.ability.swords:
default: true description:
mcmmo.ability.woodcutting: mcmmo.ability.woodcutting:
default: true description:
mcmmo.item.*: mcmmo.item.*:
description: Implies all mcmmo.item permissions. description: Implies all mcmmo.item permissions.
children: children:
mcmmo.item.chimaerawing: true mcmmo.item.chimaerawing: true
mcmmo.item.chimaerawing: mcmmo.item.chimaerawing:
default: true description:
mcmmo.regeneration: mcmmo.regeneration:
default: true description:
mcmmo.motd: mcmmo.motd:
default: true description:
mcmmo.commands.*: mcmmo.commands.*:
description: Implies all mcmmo.commands permissions. description: Implies all mcmmo.commands permissions.
@ -142,17 +159,17 @@ permissions:
mcmmo.commands.whois: true mcmmo.commands.whois: true
mcmmo.commands.party: true mcmmo.commands.party: true
mcmmo.commands.ability: mcmmo.commands.ability:
default: true description:
mcmmo.commands.myspawn: mcmmo.commands.myspawn:
default: true description:
mcmmo.commands.setmyspawn: mcmmo.commands.setmyspawn:
default: true description:
mcmmo.commands.ptp: mcmmo.commands.ptp:
default: true description:
mcmmo.commands.whois: mcmmo.commands.whois:
default: true description:
mcmmo.commands.party: mcmmo.commands.party:
default: true description:
mcmmo.chat.*: mcmmo.chat.*:
description: Implies all mcmmo.chat permissions. (Warning, contains adminchat) description: Implies all mcmmo.chat permissions. (Warning, contains adminchat)
@ -160,9 +177,9 @@ permissions:
mcmmo.chat.adminchat: true mcmmo.chat.adminchat: true
mcmmo.chat.partychat: true mcmmo.chat.partychat: true
mcmmo.chat.adminchat: mcmmo.chat.adminchat:
default: op description:
mcmmo.chat.partychat: mcmmo.chat.partychat:
default: true description:
mcmmo.skills.*: mcmmo.skills.*:
description: Implies all mcmmo.skills permissions. description: Implies all mcmmo.skills permissions.
@ -194,36 +211,38 @@ permissions:
mcmmo.skills.curative.heal.self: true mcmmo.skills.curative.heal.self: true
mcmmo.skills.sorcery: mcmmo.skills.sorcery:
default: true description:
mcmmo.skills.sorcery.water: mcmmo.skills.sorcery.water:
default: true description:
mcmmo.skills.sorcery.water.thunder: mcmmo.skills.sorcery.water.thunder:
default: true description:
mcmmo.skills.curative: mcmmo.skills.curative:
default: true description:
mcmmo.skills.curative.heal.other: mcmmo.skills.curative.heal.other:
default: true description:
mcmmo.skills.curative.heal.self: mcmmo.skills.curative.heal.self:
default: true description:
mcmmo.skills.taming: mcmmo.skills.taming:
default: true description:
mcmmo.skills.mining: mcmmo.skills.mining:
default: true description:
mcmmo.skills.woodcutting: mcmmo.skills.woodcutting:
default: true description:
mcmmo.skills.repair: mcmmo.skills.repair:
default: true description:
mcmmo.skills.unarmed: mcmmo.skills.unarmed:
default: true description:
mcmmo.skills.archery: mcmmo.skills.archery:
default: true description:
mcmmo.skills.herbalism: mcmmo.skills.herbalism:
default: true description:
mcmmo.skills.excavation: mcmmo.skills.excavation:
default: true description:
mcmmo.skills.swords: mcmmo.skills.swords:
default: true description:
mcmmo.skills.axes: mcmmo.skills.axes:
default: true description:
mcmmo.skills.acrobatics: mcmmo.skills.acrobatics:
default: true description: