mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
MASSIVE Permissions overhaul. Added a handful of new permissions,
renamed a few more. Changed Green Terra to handle blocks based on perms rather than the config file. For more details, read the diff.
This commit is contained in:
@ -7,6 +7,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public final class CommandHelper {
|
||||
private CommandHelper() {}
|
||||
@ -31,23 +32,23 @@ public final class CommandHelper {
|
||||
if (SkillTools.hasGatheringSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.excavation")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.EXCAVATION)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Excavation.Listener"), profile.getSkillLevel(SkillType.EXCAVATION), profile.getSkillXpLevel(SkillType.EXCAVATION), profile.getXpToLevel(SkillType.EXCAVATION)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.fishing")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.FISHING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Fishing.Listener"), profile.getSkillLevel(SkillType.FISHING), profile.getSkillXpLevel(SkillType.FISHING), profile.getXpToLevel(SkillType.FISHING)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.fishing")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.HERBALISM)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Herbalism.Listener"), profile.getSkillLevel(SkillType.HERBALISM), profile.getSkillXpLevel(SkillType.HERBALISM), profile.getXpToLevel(SkillType.HERBALISM)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.mining")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.MINING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Mining.Listener"), profile.getSkillLevel(SkillType.MINING), profile.getSkillXpLevel(SkillType.MINING), profile.getXpToLevel(SkillType.MINING)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.woodcutting")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.WOODCUTTING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Woodcutting.Listener"), profile.getSkillLevel(SkillType.WOODCUTTING), profile.getSkillXpLevel(SkillType.WOODCUTTING), profile.getXpToLevel(SkillType.WOODCUTTING)));
|
||||
}
|
||||
}
|
||||
@ -68,23 +69,23 @@ public final class CommandHelper {
|
||||
if (SkillTools.hasCombatSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.axes")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.AXES)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Axes.Listener"), profile.getSkillLevel(SkillType.AXES), profile.getSkillXpLevel(SkillType.AXES), profile.getXpToLevel(SkillType.AXES)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.archery")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.ARCHERY)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Archery.Listener"), profile.getSkillLevel(SkillType.ARCHERY), profile.getSkillXpLevel(SkillType.ARCHERY), profile.getXpToLevel(SkillType.ARCHERY)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.swords")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.SWORDS)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Swords.Listener"), profile.getSkillLevel(SkillType.SWORDS), profile.getSkillXpLevel(SkillType.SWORDS), profile.getXpToLevel(SkillType.SWORDS)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.taming")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.TAMING)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Taming.Listener"), profile.getSkillLevel(SkillType.TAMING), profile.getSkillXpLevel(SkillType.TAMING), profile.getXpToLevel(SkillType.TAMING)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.unarmed")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.UNARMED)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Unarmed.Listener"), profile.getSkillLevel(SkillType.UNARMED), profile.getSkillXpLevel(SkillType.UNARMED), profile.getXpToLevel(SkillType.UNARMED)));
|
||||
}
|
||||
}
|
||||
@ -105,11 +106,11 @@ public final class CommandHelper {
|
||||
if (SkillTools.hasMiscSkills(inspect)) {
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.acrobatics")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.ACROBATICS)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Acrobatics.Listener"), profile.getSkillLevel(SkillType.ACROBATICS), profile.getSkillXpLevel(SkillType.ACROBATICS), profile.getXpToLevel(SkillType.ACROBATICS)));
|
||||
}
|
||||
|
||||
if (inspect.hasPermission("mcmmo.skills.repair")) {
|
||||
if (Permissions.skillEnabled(inspect, SkillType.REPAIR)) {
|
||||
display.sendMessage(LocaleLoader.getString("Skills.Stats", LocaleLoader.getString("Repair.Listener"), profile.getSkillLevel(SkillType.REPAIR), profile.getSkillXpLevel(SkillType.REPAIR), profile.getXpToLevel(SkillType.REPAIR)));
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public final class CommandRegistrationHelper {
|
||||
public static void registerMcmmoCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("mcmmo");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
|
||||
command.setPermission("mcmmo.commands.mcmmo;mcmmo.commands.mcmmo.help");
|
||||
command.setPermission("mcmmo.commands.mcmmo.description;mcmmo.commands.mcmmo.help");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmo"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "mcmmo", "help"));
|
||||
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -23,7 +24,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.addlevels")) {
|
||||
if (!Permissions.addlevels(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -71,7 +72,7 @@ public class AddlevelsCommand implements CommandExecutor{
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!sender.hasPermission("mcmmo.commands.addlevels.others")) {
|
||||
if (!Permissions.addlevelsOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -23,7 +24,7 @@ public class AddxpCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.addxp")) {
|
||||
if (!Permissions.addxp(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -69,7 +70,7 @@ public class AddxpCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!sender.hasPermission("mcmmo.commands.addxp.others")) {
|
||||
if (!Permissions.addxpOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class HardcoreCommand implements CommandExecutor{
|
||||
@ -17,7 +18,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -33,7 +34,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -43,7 +44,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.toggle")) {
|
||||
if (!Permissions.hardcoreToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -56,7 +57,7 @@ public class HardcoreCommand implements CommandExecutor{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.hardcore.modify")) {
|
||||
if (!Permissions.hardcoreModify(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McgodCommand implements CommandExecutor {
|
||||
@ -17,7 +18,7 @@ public class McgodCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcgod")) {
|
||||
if (!Permissions.mcgod(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -44,7 +45,7 @@ public class McgodCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcgod.others")) {
|
||||
if (!Permissions.mcgodOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrefreshCommand implements CommandExecutor {
|
||||
@ -17,7 +18,7 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrefresh")) {
|
||||
if (!Permissions.mcrefresh(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -37,7 +38,7 @@ public class McrefreshCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrefresh.others")) {
|
||||
if (!Permissions.mcrefreshOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -23,7 +24,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.mmoedit")) {
|
||||
if (!Permissions.mmoedit(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -67,7 +68,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 3:
|
||||
if (!sender.hasPermission("mcmmo.commands.mmoedit.others")) {
|
||||
if (!Permissions.mmoeditOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class SkillresetCommand implements CommandExecutor {
|
||||
@ -22,7 +23,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset")) {
|
||||
if (!Permissions.skillreset(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -47,7 +48,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset." + skillType.toString().toLowerCase())) {
|
||||
if (!Permissions.skillreset(sender, skillType)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
@ -61,7 +62,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
skillName = SkillTools.getSkillName(skill);
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset." + skill.toString().toLowerCase())) {
|
||||
if (!Permissions.skillreset(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -73,7 +74,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others")) {
|
||||
if (!Permissions.skillresetOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -90,7 +91,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skillName = SkillTools.getSkillName(skill);
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skill.toString().toLowerCase())) {
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -113,7 +114,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillType.toString().toLowerCase())) {
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
@ -136,7 +137,7 @@ public class SkillresetCommand implements CommandExecutor {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.skillreset.others." + skillType.toString().toLowerCase())) {
|
||||
if (!Permissions.skillresetOthers(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
continue;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class VampirismCommand implements CommandExecutor {
|
||||
@ -22,7 +23,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -38,7 +39,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("enabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -48,7 +49,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off") || args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("disabled")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.toggle")) {
|
||||
if (!Permissions.vampirismToggle(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -61,7 +62,7 @@ public class VampirismCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.vampirism.modify")) {
|
||||
if (!Permissions.vampirismModify(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class XprateCommand implements CommandExecutor {
|
||||
@ -20,7 +21,7 @@ public class XprateCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.xprate.reset")) {
|
||||
if (!Permissions.xprateReset(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -38,7 +39,7 @@ public class XprateCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sender.hasPermission("mcmmo.commands.xprate.set")) {
|
||||
if (!Permissions.xprateSet(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class InspectCommand implements CommandExecutor {
|
||||
@ -20,11 +21,6 @@ public class InspectCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.inspect")) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = Users.getPlayer(args[0]);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
@ -36,7 +32,8 @@ public class InspectCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !sender.hasPermission("mcmmo.commands.inspect.offline")) {
|
||||
// TODO: Why do we care if this is a player?
|
||||
if (sender instanceof Player && !Permissions.inspectOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
@ -67,7 +64,7 @@ public class InspectCommand implements CommandExecutor {
|
||||
if (sender instanceof Player) {
|
||||
Player inspector = (Player) sender;
|
||||
|
||||
if (!Misc.isNear(inspector.getLocation(), target.getLocation(), 5.0) && !inspector.hasPermission("mcmmo.commands.inspect.far")) {
|
||||
if (!Misc.isNear(inspector.getLocation(), target.getLocation(), 5.0) && !Permissions.inspectFar(inspector)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@ -17,7 +18,7 @@ public class McabilityCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcability")) {
|
||||
if (!Permissions.mcability(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -35,7 +36,7 @@ public class McabilityCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcability.others")) {
|
||||
if (!Permissions.mcabilityOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.commands.PartySubcommandType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
@Override
|
||||
@ -17,6 +19,11 @@ public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!Permissions.mcmmoDescription(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
String description = LocaleLoader.getString("mcMMO.Description");
|
||||
String[] mcSplit = description.split(",");
|
||||
sender.sendMessage(mcSplit);
|
||||
@ -36,7 +43,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("commands")) {
|
||||
if (!sender.hasPermission("mcmmo.commands.mcmmo.help")) {
|
||||
if (!Permissions.mcmmoHelp(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -54,20 +61,20 @@ public class McmmoCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void displayPartyCommands(CommandSender sender) {
|
||||
if (sender.hasPermission("mcmmo.commands.party")) {
|
||||
if (Permissions.party(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
|
||||
sender.sendMessage("/party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
|
||||
sender.sendMessage("/party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
|
||||
sender.sendMessage("/party quit " + LocaleLoader.getString("Commands.Party.Quit"));
|
||||
|
||||
if (sender.hasPermission("mcmmo.chat.party")) {
|
||||
if (Permissions.partyChat(sender)) {
|
||||
sender.sendMessage("/party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
|
||||
}
|
||||
|
||||
sender.sendMessage("/party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
|
||||
sender.sendMessage("/party accept " + LocaleLoader.getString("Commands.Party.Accept"));
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.ptp")) {
|
||||
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
|
||||
sender.sendMessage("/party teleport " + LocaleLoader.getString("Commands.Party.Teleport"));
|
||||
}
|
||||
}
|
||||
@ -78,27 +85,27 @@ public class McmmoCommand implements CommandExecutor {
|
||||
sender.sendMessage("/mcstats " + LocaleLoader.getString("Commands.Stats"));
|
||||
sender.sendMessage("/mctop " + LocaleLoader.getString("Commands.Leaderboards"));
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.skillreset")) {
|
||||
if (Permissions.skillreset(sender)) {
|
||||
sender.sendMessage("/skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.mcability")) {
|
||||
if (Permissions.mcability(sender)) {
|
||||
sender.sendMessage("/mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.chat.admin")) {
|
||||
if (Permissions.adminChat(sender)) {
|
||||
sender.sendMessage("/adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.inspect")) {
|
||||
if (Permissions.inspect(sender)) {
|
||||
sender.sendMessage("/inspect " + LocaleLoader.getString("Commands.Inspect"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.mmoedit")) {
|
||||
if (Permissions.mmoedit(sender)) {
|
||||
sender.sendMessage("/mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("mcmmo.commands.mcgod")) {
|
||||
if (Permissions.mcgod(sender)) {
|
||||
sender.sendMessage("/mcgod " + LocaleLoader.getString("Commands.mcgod"));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import com.gmail.nossr50.runnables.McRankAsync;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class McrankCommand implements CommandExecutor {
|
||||
@ -23,7 +24,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrank")) {
|
||||
if (!Permissions.mcrank(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -43,7 +44,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!sender.hasPermission("mcmmo.commands.mcrank.others")) {
|
||||
if (!Permissions.mcrankOthers(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
@ -58,7 +59,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && !!sender.hasPermission("mcmmo.commands.mcrank.others.offline")) {
|
||||
if (sender instanceof Player && !Permissions.mcrankOffline(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
@ -66,7 +67,7 @@ public class McrankCommand implements CommandExecutor {
|
||||
else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !sender.hasPermission("mcmmo.commands.mcrank.others.far")) {
|
||||
if (sender instanceof Player && !Misc.isNear(((Player) sender).getLocation(), target.getLocation(), 5.0) && !Permissions.mcrankFar(sender)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.TooFar"));
|
||||
return true;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.McTopAsync;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
|
||||
public class MctopCommand implements CommandExecutor {
|
||||
@ -72,7 +73,7 @@ public class MctopCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void flatfileDisplay(int page, String skill, CommandSender sender, Command command) {
|
||||
if (!skill.equalsIgnoreCase("all") && !sender.hasPermission("mcmmo.commands.mctop." + skill.toLowerCase())) {
|
||||
if (!skill.equalsIgnoreCase("all") && !Permissions.mctop(sender, SkillType.getSkill(skill))) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user