mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Change /mcmmo to use Bukkit CommandAPI. Addresses #628
This commit is contained in:
parent
ea32cb9e12
commit
f6aca88b36
@ -15,6 +15,7 @@ import com.gmail.nossr50.commands.admin.SkillresetCommand;
|
|||||||
import com.gmail.nossr50.commands.admin.XprateCommand;
|
import com.gmail.nossr50.commands.admin.XprateCommand;
|
||||||
import com.gmail.nossr50.commands.player.InspectCommand;
|
import com.gmail.nossr50.commands.player.InspectCommand;
|
||||||
import com.gmail.nossr50.commands.player.McabilityCommand;
|
import com.gmail.nossr50.commands.player.McabilityCommand;
|
||||||
|
import com.gmail.nossr50.commands.player.McmmoCommand;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
|
import com.gmail.nossr50.skills.acrobatics.AcrobaticsCommand;
|
||||||
import com.gmail.nossr50.skills.archery.ArcheryCommand;
|
import com.gmail.nossr50.skills.archery.ArcheryCommand;
|
||||||
@ -203,4 +204,17 @@ public final class CommandRegistrationHelper {
|
|||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcability", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcability", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||||
command.setExecutor(new McabilityCommand());
|
command.setExecutor(new McabilityCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerMcmmoCommand() {
|
||||||
|
List<String> aliasList = new ArrayList<String>();
|
||||||
|
aliasList.add("mcinfo");
|
||||||
|
|
||||||
|
PluginCommand command = mcMMO.p.getCommand("mcmmo");
|
||||||
|
command.setDescription(LocaleLoader.getString("Commands.Description.mcmmo"));
|
||||||
|
command.setPermission("mcmmo.commands.mcmmo");
|
||||||
|
command.setPermissionMessage(permissionsMessage);
|
||||||
|
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcmmo"));
|
||||||
|
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "mcmmo", "?"));
|
||||||
|
command.setExecutor(new McmmoCommand());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,12 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
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.Anniversary;
|
import com.gmail.nossr50.util.Anniversary;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
|
||||||
|
|
||||||
public class McmmoCommand implements CommandExecutor {
|
public class McmmoCommand 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 (!Permissions.hasPermission(sender, "mcmmo.commands.mcmmo")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (args.length == 0 || (args.length == 1 && args[0].equals("?"))) {
|
||||||
String description = LocaleLoader.getString("mcMMO.Description");
|
String description = LocaleLoader.getString("mcMMO.Description");
|
||||||
String[] mcSplit = description.split(",");
|
String[] mcSplit = description.split(",");
|
||||||
sender.sendMessage(mcSplit);
|
sender.sendMessage(mcSplit);
|
||||||
@ -27,16 +24,19 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||||
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
|
if (mcMMO.spoutEnabled && sender instanceof SpoutPlayer) {
|
||||||
SpoutPlayer spoutPlayer = (SpoutPlayer) sender;
|
SpoutPlayer spoutPlayer = (SpoutPlayer) sender;
|
||||||
|
|
||||||
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND);
|
spoutPlayer.sendNotification(LocaleLoader.getString("Spout.Donate"), ChatColor.GREEN + "gjmcferrin@gmail.com", Material.DIAMOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
||||||
|
|
||||||
Anniversary.anniversaryCheck(sender);
|
Anniversary.anniversaryCheck(sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import com.gmail.nossr50.chat.commands.ACommand;
|
|||||||
import com.gmail.nossr50.chat.commands.PCommand;
|
import com.gmail.nossr50.chat.commands.PCommand;
|
||||||
import com.gmail.nossr50.commands.CommandRegistrationHelper;
|
import com.gmail.nossr50.commands.CommandRegistrationHelper;
|
||||||
import com.gmail.nossr50.commands.player.MccCommand;
|
import com.gmail.nossr50.commands.player.MccCommand;
|
||||||
import com.gmail.nossr50.commands.player.McmmoCommand;
|
|
||||||
import com.gmail.nossr50.commands.player.McrankCommand;
|
import com.gmail.nossr50.commands.player.McrankCommand;
|
||||||
import com.gmail.nossr50.commands.player.McstatsCommand;
|
import com.gmail.nossr50.commands.player.McstatsCommand;
|
||||||
import com.gmail.nossr50.commands.player.MctopCommand;
|
import com.gmail.nossr50.commands.player.MctopCommand;
|
||||||
@ -444,7 +443,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
CommandRegistrationHelper.registerMcabilityCommand();
|
CommandRegistrationHelper.registerMcabilityCommand();
|
||||||
getCommand("mcc").setExecutor(new MccCommand());
|
getCommand("mcc").setExecutor(new MccCommand());
|
||||||
CommandRegistrationHelper.registerMcgodCommand();
|
CommandRegistrationHelper.registerMcgodCommand();
|
||||||
getCommand("mcmmo").setExecutor(new McmmoCommand());
|
CommandRegistrationHelper.registerMcmmoCommand();
|
||||||
CommandRegistrationHelper.registerMcrefreshCommand();
|
CommandRegistrationHelper.registerMcrefreshCommand();
|
||||||
getCommand("mctop").setExecutor(new MctopCommand());
|
getCommand("mctop").setExecutor(new MctopCommand());
|
||||||
getCommand("mcrank").setExecutor(new McrankCommand());
|
getCommand("mcrank").setExecutor(new McrankCommand());
|
||||||
|
@ -488,6 +488,7 @@ Commands.SkillInfo=/<skill> [[RED]]- View detailed information about a skill
|
|||||||
Commands.Stats.Self=YOUR STATS
|
Commands.Stats.Self=YOUR STATS
|
||||||
Commands.Stats=[[RED]]- View your mcMMO stats
|
Commands.Stats=[[RED]]- View your mcMMO stats
|
||||||
Commands.ToggleAbility=[[RED]]- Toggle ability activation with right click
|
Commands.ToggleAbility=[[RED]]- Toggle ability activation with right click
|
||||||
|
Commands.Usage.0=[[RED]]Proper usage is /{0}
|
||||||
Commands.Usage.1=[[RED]]Proper usage is /{0} {1}
|
Commands.Usage.1=[[RED]]Proper usage is /{0} {1}
|
||||||
Commands.Usage.2=[[RED]]Proper usage is /{0} {1} {2}
|
Commands.Usage.2=[[RED]]Proper usage is /{0} {1} {2}
|
||||||
Commands.Usage.3=[[RED]]Proper usage is /{0} {1} {2} {3}
|
Commands.Usage.3=[[RED]]Proper usage is /{0} {1} {2} {3}
|
||||||
@ -693,6 +694,7 @@ Commands.Description.addxp=Add mcMMO XP to a user
|
|||||||
Commands.Description.inspect=View detailed mcMMO info on another player
|
Commands.Description.inspect=View detailed mcMMO info on another player
|
||||||
Commands.Description.mcability=Toggle mcMMO abilities being readied on right-click on/off
|
Commands.Description.mcability=Toggle mcMMO abilities being readied on right-click on/off
|
||||||
Commands.Description.mcgod=Toggle mcMMO god-mode on/off
|
Commands.Description.mcgod=Toggle mcMMO god-mode on/off
|
||||||
|
Commands.Description.mcmmo=Show a brief description of mcMMO
|
||||||
Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO
|
Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO
|
||||||
Commands.Description.mmoedit=Edit mcMMO levels for a user
|
Commands.Description.mmoedit=Edit mcMMO levels for a user
|
||||||
Commands.Description.Skill=Display detailed mcMMO skill info for {0}
|
Commands.Description.Skill=Display detailed mcMMO skill info for {0}
|
||||||
|
@ -32,7 +32,6 @@ commands:
|
|||||||
aliases: []
|
aliases: []
|
||||||
description: Lists mcMMO commands
|
description: Lists mcMMO commands
|
||||||
mcmmo:
|
mcmmo:
|
||||||
aliases: []
|
|
||||||
description: Shows a brief mod description
|
description: Shows a brief mod description
|
||||||
mctop:
|
mctop:
|
||||||
aliases: []
|
aliases: []
|
||||||
|
Loading…
Reference in New Issue
Block a user