mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 21:56:47 +01:00
53 lines
1.5 KiB
Java
53 lines
1.5 KiB
Java
package com.gmail.nossr50.commands.chat;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import com.gmail.nossr50.chat.PartyChatManager;
|
|
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
|
import com.gmail.nossr50.datatypes.party.Party;
|
|
import com.gmail.nossr50.locale.LocaleLoader;
|
|
import com.gmail.nossr50.party.PartyManager;
|
|
import com.gmail.nossr50.util.player.UserManager;
|
|
|
|
public class PartyChatCommand extends ChatCommand {
|
|
public PartyChatCommand() {
|
|
super(ChatMode.PARTY);
|
|
}
|
|
|
|
@Override
|
|
protected void handleChatSending(CommandSender sender, String[] args) {
|
|
Party party;
|
|
String message;
|
|
|
|
if (sender instanceof Player) {
|
|
party = UserManager.getPlayer((Player) sender).getParty();
|
|
|
|
if (party == null) {
|
|
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
|
return;
|
|
}
|
|
|
|
message = buildChatMessage(args, 0);
|
|
}
|
|
else {
|
|
if (args.length < 2) {
|
|
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
|
|
return;
|
|
}
|
|
|
|
party = PartyManager.getParty(args[0]);
|
|
|
|
if (party == null) {
|
|
sender.sendMessage(LocaleLoader.getString("Party.InvalidName"));
|
|
return;
|
|
}
|
|
|
|
message = buildChatMessage(args, 1);
|
|
}
|
|
|
|
((PartyChatManager) chatManager).setParty(party);
|
|
chatManager.handleChat(sender.getName(), getDisplayName(sender), message);
|
|
}
|
|
}
|