2014-10-14 20:30:05 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
2014-12-19 13:51:24 +01:00
|
|
|
import com.massivecraft.factions.Conf;
|
2014-10-14 20:30:05 +02:00
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.FPlayers;
|
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2014-12-08 00:12:52 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2015-05-25 01:05:27 +02:00
|
|
|
import net.md_5.bungee.api.chat.BaseComponent;
|
|
|
|
import net.md_5.bungee.api.chat.ClickEvent;
|
|
|
|
import net.md_5.bungee.api.chat.HoverEvent;
|
|
|
|
import net.md_5.bungee.api.chat.TextComponent;
|
2014-10-14 20:30:05 +02:00
|
|
|
|
|
|
|
public class CmdShowInvites extends FCommand {
|
|
|
|
|
|
|
|
public CmdShowInvites() {
|
|
|
|
super();
|
|
|
|
aliases.add("showinvites");
|
|
|
|
permission = Permission.SHOW_INVITES.node;
|
|
|
|
|
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
2015-05-25 01:05:27 +02:00
|
|
|
TextComponent component = new TextComponent(TL.COMMAND_SHOWINVITES_PENDING.toString());
|
|
|
|
component.setColor(net.md_5.bungee.api.ChatColor.GOLD);
|
2014-10-14 20:30:05 +02:00
|
|
|
for (String id : myFaction.getInvites()) {
|
2014-10-19 07:37:25 +02:00
|
|
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
2014-11-14 17:03:57 +01:00
|
|
|
String name = fp != null ? fp.getName() : id;
|
2015-05-25 01:05:27 +02:00
|
|
|
TextComponent then = new TextComponent(name + " ");
|
|
|
|
then.setColor(net.md_5.bungee.api.ChatColor.WHITE);
|
|
|
|
then.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new BaseComponent[]{new TextComponent(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name))}));
|
|
|
|
then.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, Conf.baseCommandAliases.get(0) + " deinvite " + name));
|
|
|
|
component.addExtra(then);
|
2014-10-14 20:30:05 +02:00
|
|
|
}
|
2014-11-14 17:03:57 +01:00
|
|
|
|
2015-05-25 01:05:27 +02:00
|
|
|
fme.getPlayer().spigot().sendMessage(component);
|
2014-10-14 20:30:05 +02:00
|
|
|
}
|
2014-11-14 17:03:57 +01:00
|
|
|
|
2015-01-22 00:58:33 +01:00
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_SHOWINVITES_DESCRIPTION;
|
|
|
|
}
|
|
|
|
|
2014-11-14 17:03:57 +01:00
|
|
|
|
2014-10-14 20:30:05 +02:00
|
|
|
}
|