2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.commands;
|
|
|
|
|
|
|
|
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
|
|
|
import com.gmail.nossr50.config.Config;
|
|
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
2019-01-15 07:11:58 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.util.Permissions;
|
2019-01-15 07:11:58 +01:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public class McmmoCommand implements CommandExecutor {
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
|
|
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);
|
|
|
|
|
|
|
|
if (Config.getInstance().getDonateMessageEnabled()) {
|
2013-09-16 00:07:40 +02:00
|
|
|
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
2018-12-25 02:52:39 +01:00
|
|
|
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2014-02-17 16:31:59 +01:00
|
|
|
if (Permissions.showversion(sender)) {
|
|
|
|
sender.sendMessage(LocaleLoader.getString("MOTD.Version", mcMMO.p.getDescription().getVersion()));
|
|
|
|
}
|
|
|
|
|
2014-01-12 12:08:47 +01:00
|
|
|
mcMMO.getHolidayManager().anniversaryCheck(sender);
|
2013-03-01 06:52:01 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
if (args[0].equalsIgnoreCase("?") || args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("commands")) {
|
|
|
|
if (!Permissions.mcmmoHelp(sender)) {
|
|
|
|
sender.sendMessage(command.getPermissionMessage());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.mcc.Header"));
|
2014-01-12 13:51:12 +01:00
|
|
|
displayGeneralCommands(sender);
|
2013-03-01 06:52:01 +01:00
|
|
|
displayOtherCommands(sender);
|
2014-01-12 13:51:12 +01:00
|
|
|
displayPartyCommands(sender);
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
private void displayGeneralCommands(CommandSender sender) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /mcstats " + LocaleLoader.getString("Commands.Stats"));
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /<skill>" + LocaleLoader.getString("Commands.SkillInfo"));
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /mctop " + LocaleLoader.getString("Commands.Leaderboards"));
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
if (Permissions.inspect(sender)) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /inspect " + LocaleLoader.getString("Commands.Inspect"));
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
if (Permissions.mcability(sender)) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /mcability " + LocaleLoader.getString("Commands.ToggleAbility"));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void displayOtherCommands(CommandSender sender) {
|
2019-01-21 14:17:59 +01:00
|
|
|
//Don't show them this category if they have none of the permissions
|
|
|
|
if(!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
|
|
|
|
return;
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
|
|
|
|
|
|
|
if (Permissions.skillreset(sender)) {
|
2014-01-12 13:51:12 +01:00
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /skillreset <skill|all> " + LocaleLoader.getString("Commands.Reset"));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
if (Permissions.mmoedit(sender)) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /mmoedit " + LocaleLoader.getString("Commands.mmoedit"));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Permissions.adminChat(sender)) {
|
2014-01-12 13:51:12 +01:00
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /adminchat " + LocaleLoader.getString("Commands.AdminToggle"));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
if (Permissions.mcgod(sender)) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /mcgod " + LocaleLoader.getString("Commands.mcgod"));
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
2014-01-12 13:51:12 +01:00
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
private void displayPartyCommands(CommandSender sender) {
|
|
|
|
if (Permissions.party(sender)) {
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Commands.Party.Commands"));
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party create <" + LocaleLoader.getString("Commands.Usage.PartyName") + "> " + LocaleLoader.getString("Commands.Party1"));
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party join <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party2"));
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party quit " + LocaleLoader.getString("Commands.Party.Quit"));
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
if (Permissions.partyChat(sender)) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party chat " + LocaleLoader.getString("Commands.Party.Toggle"));
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2014-01-12 13:51:12 +01:00
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party invite <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Invite"));
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party accept " + LocaleLoader.getString("Commands.Party.Accept"));
|
|
|
|
|
|
|
|
if (Permissions.partySubcommand(sender, PartySubcommandType.TELEPORT)) {
|
|
|
|
sender.sendMessage(ChatColor.DARK_AQUA + " /party teleport <" + LocaleLoader.getString("Commands.Usage.Player") + "> " + LocaleLoader.getString("Commands.Party.Teleport"));
|
|
|
|
}
|
|
|
|
}
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
}
|