mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 08:39:49 +01:00
Adding proper children for the deprecated permissions, and removing extra permissions checks.
This commit is contained in:
parent
749443454d
commit
b633f36131
@ -23,11 +23,6 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if (!Permissions.mmoedit(sender)) {
|
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
if (!SkillTools.isSkill(args[0])) {
|
if (!SkillTools.isSkill(args[0])) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
|
||||||
@ -55,7 +50,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (!Permissions.hasPermission(sender, "mcmmo.commands.addlevels.others") && !Permissions.mmoedit(sender)) {
|
if (!Permissions.hasPermission(sender, "mcmmo.commands.addlevels.others")) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.addxp") && !Permissions.mmoedit((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.addxp")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.addxp.others") && !Permissions.mmoedit((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.addxp.others")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoedit") && !Permissions.mmoedit((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoedit")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ public class MmoeditCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoedit.others") && !Permissions.mmoedit((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoedit.others")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class SkillResetCommand implements CommandExecutor {
|
public class SkillResetCommand implements CommandExecutor {
|
||||||
@ -34,7 +33,7 @@ public class SkillResetCommand implements CommandExecutor {
|
|||||||
|
|
||||||
skill = SkillTools.getSkillType(args[0]);
|
skill = SkillTools.getSkillType(args[0]);
|
||||||
|
|
||||||
if (CommandHelper.noCommandPermissions((Player) sender, "mcmmo.commands.skillreset." + skill.toString().toLowerCase()) && !Permissions.skillReset((Player) sender)) {
|
if (CommandHelper.noCommandPermissions((Player) sender, "mcmmo.commands.skillreset." + skill.toString().toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ public class SkillResetCommand implements CommandExecutor {
|
|||||||
|
|
||||||
skill = SkillTools.getSkillType(args[1]);
|
skill = SkillTools.getSkillType(args[1]);
|
||||||
|
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.skillreset.others." + skill.toString().toLowerCase()) && !Permissions.skillReset((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.skillreset.others." + skill.toString().toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.commands.CommandHelper;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
|
|
||||||
public class XprateCommand implements CommandExecutor {
|
public class XprateCommand implements CommandExecutor {
|
||||||
private static double originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
|
private static double originalRate = Config.getInstance().getExperienceGainsGlobalMultiplier();
|
||||||
@ -21,7 +20,7 @@ public class XprateCommand implements CommandExecutor {
|
|||||||
String usage2 = LocaleLoader.getString("Commands.xprate.proper.1");
|
String usage2 = LocaleLoader.getString("Commands.xprate.proper.1");
|
||||||
String usage3 = LocaleLoader.getString("Commands.xprate.proper.2");
|
String usage3 = LocaleLoader.getString("Commands.xprate.proper.2");
|
||||||
|
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate") && !Permissions.admin((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ public class XprateCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
if (args[0].equalsIgnoreCase("reset")) {
|
if (args[0].equalsIgnoreCase("reset")) {
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.reset") && !Permissions.admin((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.reset")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ public class XprateCommand implements CommandExecutor {
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (Misc.isInt(args[0])) {
|
if (Misc.isInt(args[0])) {
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.set") && !Permissions.admin((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.xprate.set")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
|
if (args[1].equalsIgnoreCase("true") || args[1].equalsIgnoreCase("false")) {
|
||||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.commands.CommandHelper;
|
import com.gmail.nossr50.commands.CommandHelper;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class McabilityCommand implements CommandExecutor {
|
public class McabilityCommand implements CommandExecutor {
|
||||||
@ -21,7 +20,7 @@ public class McabilityCommand implements CommandExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcability") && !Permissions.mcAbility((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mcability")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,13 +10,12 @@ import com.gmail.nossr50.commands.CommandHelper;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class MmoupdateCommand implements CommandExecutor {
|
public class MmoupdateCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoupdate") && !Permissions.admin((Player) sender)) {
|
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mmoupdate")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public final class Permissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inspectFar(Player player) {
|
public static boolean inspectFar(Player player) {
|
||||||
return (hasPermission(player, "mcmmo.commands.inspect.far") || inspectDistanceBypass(player));
|
return (hasPermission(player, "mcmmo.commands.inspect.far"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ public final class Permissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean inspectOffline(Player player) {
|
public static boolean inspectOffline(Player player) {
|
||||||
return (hasPermission(player, "mcmmo.commands.inspect.offline") || inspectOfflineBypass(player));
|
return (hasPermission(player, "mcmmo.commands.inspect.offline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -561,15 +561,15 @@ public final class Permissions {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static boolean mmoeditCommand(Player player) {
|
public static boolean mmoeditCommand(Player player) {
|
||||||
return (hasPermission(player, "mcmmo.commands.mmoedit") || mmoedit(player));
|
return (hasPermission(player, "mcmmo.commands.mmoedit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean skillResetCommand(Player player) {
|
public static boolean skillResetCommand(Player player) {
|
||||||
return (hasPermission(player, "mcmmo.commands.skillreset") || skillReset(player));
|
return (hasPermission(player, "mcmmo.commands.skillreset"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean mcAbilityCommand(Player player) {
|
public static boolean mcAbilityCommand(Player player) {
|
||||||
return (hasPermission(player, "mcmmo.commands.mcability") || mcAbility(player));
|
return (hasPermission(player, "mcmmo.commands.mcability"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean mcgodCommand(CommandSender sender) {
|
public static boolean mcgodCommand(CommandSender sender) {
|
||||||
|
@ -123,6 +123,7 @@ permissions:
|
|||||||
default: false
|
default: false
|
||||||
description: Implies all mcmmo permissions.
|
description: Implies all mcmmo permissions.
|
||||||
children:
|
children:
|
||||||
|
mcmmo.admin: true
|
||||||
mcmmo.bypass.all: true
|
mcmmo.bypass.all: true
|
||||||
mcmmo.commands.all: true
|
mcmmo.commands.all: true
|
||||||
mcmmo.defaults: true
|
mcmmo.defaults: true
|
||||||
@ -148,7 +149,8 @@ permissions:
|
|||||||
default: false
|
default: false
|
||||||
description: Implies access to everything in mcMMO
|
description: Implies access to everything in mcMMO
|
||||||
children:
|
children:
|
||||||
mcmmo.all: true
|
mcmmo.commands.mmoupdate: true
|
||||||
|
mcmmo.commands.xprate.all: true
|
||||||
mcmmo.perks.*:
|
mcmmo.perks.*:
|
||||||
default: false
|
default: false
|
||||||
description: implies access to all mcmmo perks
|
description: implies access to all mcmmo perks
|
||||||
@ -316,9 +318,13 @@ permissions:
|
|||||||
mcmmo.bypass.inspect.distance:
|
mcmmo.bypass.inspect.distance:
|
||||||
default: op
|
default: op
|
||||||
description: Allows user to bypass Inspect's distance requirements
|
description: Allows user to bypass Inspect's distance requirements
|
||||||
|
children:
|
||||||
|
mcmmo.commands.inspect.far: true
|
||||||
mcmmo.bypass.inspect.offline:
|
mcmmo.bypass.inspect.offline:
|
||||||
default: op
|
default: op
|
||||||
description: Allows user to bypass Inspect's offline player requirements
|
description: Allows user to bypass Inspect's offline player requirements
|
||||||
|
children:
|
||||||
|
mcmmo.commands.inspect.offline: true
|
||||||
mcmmo.tools.*:
|
mcmmo.tools.*:
|
||||||
description: Implies all mcmmo.tools permissions.
|
description: Implies all mcmmo.tools permissions.
|
||||||
children:
|
children:
|
||||||
@ -335,6 +341,13 @@ permissions:
|
|||||||
mcmmo.tools.mmoedit:
|
mcmmo.tools.mmoedit:
|
||||||
default: false
|
default: false
|
||||||
description: Allows access to mmoedit command
|
description: Allows access to mmoedit command
|
||||||
|
children:
|
||||||
|
mcmmo.commands.addlevels: true
|
||||||
|
mcmmo.commands.addlevels.others: true
|
||||||
|
mcmmo.commands.addxp: true
|
||||||
|
mcmmo.commands.addxp.others: true
|
||||||
|
mcmmo.commands.mmoedit: true
|
||||||
|
mcmmo.commands.mmoedit.others: true
|
||||||
mcmmo.tools.mcgod:
|
mcmmo.tools.mcgod:
|
||||||
description: Allows access to mcgod command
|
description: Allows access to mcgod command
|
||||||
children:
|
children:
|
||||||
@ -716,8 +729,9 @@ permissions:
|
|||||||
mcmmo.commands.party.all: true
|
mcmmo.commands.party.all: true
|
||||||
mcmmo.commands.ptp: true
|
mcmmo.commands.ptp: true
|
||||||
mcmmo.commands.ability:
|
mcmmo.commands.ability:
|
||||||
default: false
|
|
||||||
description: Allows access to the mcability command
|
description: Allows access to the mcability command
|
||||||
|
children:
|
||||||
|
mcmmo.commands.mcability: true
|
||||||
mcmmo.commands.addlevels:
|
mcmmo.commands.addlevels:
|
||||||
description: Allows access to the addlevels command
|
description: Allows access to the addlevels command
|
||||||
mcmmo.commands.addlevels.others:
|
mcmmo.commands.addlevels.others:
|
||||||
@ -987,5 +1001,7 @@ permissions:
|
|||||||
mcmmo.skills.smelting:
|
mcmmo.skills.smelting:
|
||||||
description: Allows access to the Smelting skill
|
description: Allows access to the Smelting skill
|
||||||
mcmmo.skillreset:
|
mcmmo.skillreset:
|
||||||
default: false
|
|
||||||
description: Allow reset of skill levels
|
description: Allow reset of skill levels
|
||||||
|
children:
|
||||||
|
mcmmo.commands.skillreset.all: true
|
||||||
|
mcmmo.commands.skillreset.others.all: false
|
Loading…
Reference in New Issue
Block a user