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;
|
|
|
|
|
2012-06-07 00:02:22 +02:00
|
|
|
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;
|
2012-04-22 21:36:48 +02:00
|
|
|
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-06 23:57:16 +01:00
|
|
|
|
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-06 23:57:16 +01:00
|
|
|
}
|
|
|
|
|
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;
|
2012-04-22 21:36:48 +02:00
|
|
|
}
|
|
|
|
|
2013-02-07 21:59:18 +01:00
|
|
|
Party party = PartyManager.getParty(args[0]);
|
2012-07-05 15:21:07 +02:00
|
|
|
|
2013-02-07 21:59:18 +01:00
|
|
|
if (party == null) {
|
|
|
|
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
|
|
|
|
return;
|
2012-04-22 21:36:48 +02:00
|
|
|
}
|
|
|
|
|
2013-02-07 21:59:18 +01:00
|
|
|
ChatManager.handlePartyChat(mcMMO.p, party, LocaleLoader.getString("Commands.Chat.Console"), buildChatMessage(args, 1));
|
2012-04-22 21:36:48 +02:00
|
|
|
}
|
|
|
|
}
|
2012-01-09 20:00:13 +01:00
|
|
|
}
|