mcMMO/src/main/java/com/gmail/nossr50/chat/commands/PartyChatCommand.java

49 lines
1.6 KiB
Java
Raw Normal View History

2013-02-02 06:09:47 +01:00
package com.gmail.nossr50.chat.commands;
2012-01-09 20:00:13 +01:00
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.gmail.nossr50.mcMMO;
2013-02-02 06:09:47 +01:00
import com.gmail.nossr50.chat.ChatManager;
2013-02-07 21:59:18 +01:00
import com.gmail.nossr50.chat.ChatMode;
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
2012-06-08 23:48:41 +02:00
import com.gmail.nossr50.party.PartyManager;
2012-04-27 11:47:11 +02:00
import com.gmail.nossr50.util.Users;
2012-01-09 20:00:13 +01:00
2013-02-07 21:59:18 +01:00
public class PartyChatCommand extends ChatCommand {
public PartyChatCommand() {
super(ChatMode.PARTY);
}
2013-02-07 21:59:18 +01:00
@Override
protected void handleChatSending(CommandSender sender, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
Party party = Users.getPlayer(player).getParty();
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
return;
}
2013-02-07 21:59:18 +01:00
ChatManager.handlePartyChat(mcMMO.p, party, player.getName(), player.getDisplayName(), buildChatMessage(args, 0));
}
else {
if (args.length < 2) {
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
return;
}
2013-02-07 21:59:18 +01:00
Party party = PartyManager.getParty(args[0]);
2013-02-07 21:59:18 +01:00
if (party == null) {
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
return;
}
2013-02-07 21:59:18 +01:00
ChatManager.handlePartyChat(mcMMO.p, party, LocaleLoader.getString("Commands.Chat.Console"), buildChatMessage(args, 1));
}
}
2012-01-09 20:00:13 +01:00
}