Forgot to send the permissions message.

This commit is contained in:
GJ 2013-02-12 21:58:53 -05:00
parent fe1cf40bbb
commit e37f5e765e

View File

@ -22,18 +22,18 @@ public class MctopCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
display(1, "ALL", sender, useMySQL); display(1, "ALL", sender, useMySQL, command);
return true; return true;
case 1: case 1:
if (Misc.isInt(args[0])) { if (Misc.isInt(args[0])) {
display(Integer.valueOf(args[0]), "ALL", sender, useMySQL); display(Integer.valueOf(args[0]), "ALL", sender, useMySQL, command);
} }
else if (SkillTools.isSkill(args[0])) { else if (SkillTools.isSkill(args[0])) {
display(1, args[0], sender, useMySQL); display(1, args[0], sender, useMySQL, command);
} }
else if (SkillTools.isLocalizedSkill(args[0])) { else if (SkillTools.isLocalizedSkill(args[0])) {
display(1, SkillTools.translateLocalizedSkill(args[0]), sender, useMySQL); display(1, SkillTools.translateLocalizedSkill(args[0]), sender, useMySQL, command);
} }
else { else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
@ -47,10 +47,10 @@ public class MctopCommand implements CommandExecutor {
} }
if (SkillTools.isSkill(args[0])) { if (SkillTools.isSkill(args[0])) {
display(Integer.valueOf(args[1]), args[0], sender, useMySQL); display(Integer.valueOf(args[1]), args[0], sender, useMySQL, command);
} }
else if (SkillTools.isLocalizedSkill(args[0])) { else if (SkillTools.isLocalizedSkill(args[0])) {
display(Integer.valueOf(args[1]), SkillTools.translateLocalizedSkill(args[0]), sender, useMySQL); display(Integer.valueOf(args[1]), SkillTools.translateLocalizedSkill(args[0]), sender, useMySQL, command);
} }
else { else {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid")); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Invalid"));
@ -63,22 +63,23 @@ public class MctopCommand implements CommandExecutor {
} }
} }
private void display(int page, String skill, CommandSender sender, boolean sql) { private void display(int page, String skill, CommandSender sender, boolean sql, Command command) {
if (sql) { if (sql) {
if (skill.equalsIgnoreCase("all")) { if (skill.equalsIgnoreCase("all")) {
sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender); sqlDisplay(page, "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing", sender, command);
} }
else { else {
sqlDisplay(page, skill, sender); sqlDisplay(page, skill, sender, command);
} }
} }
else { else {
flatfileDisplay(page, skill, sender); flatfileDisplay(page, skill, sender, command);
} }
} }
private void flatfileDisplay(int page, String skill, CommandSender sender) { 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") && !sender.hasPermission("mcmmo.commands.mctop." + skill.toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
return; return;
} }
@ -113,9 +114,10 @@ public class MctopCommand implements CommandExecutor {
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip")); sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
} }
private void sqlDisplay(int page, String query, CommandSender sender) { private void sqlDisplay(int page, String query, CommandSender sender, Command command) {
if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) { if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
if (!sender.hasPermission("mcmmo.commands.mctop." + query.toLowerCase())) { if (!sender.hasPermission("mcmmo.commands.mctop." + query.toLowerCase())) {
sender.sendMessage(command.getPermissionMessage());
return; return;
} }
} }