package com.massivecraft.factions.cmd; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; import mkremins.fanciful.FancyMessage; import org.bukkit.ChatColor; public class CmdDeinvite extends FCommand { public CmdDeinvite() { super(); this.aliases.add("deinvite"); this.aliases.add("deinv"); this.optionalArgs.put("player name", "name"); //this.optionalArgs.put("", ""); this.permission = Permission.DEINVITE.node; this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = true; senderMustBeAdmin = false; } @Override public void perform() { FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) { FancyMessage msg = new FancyMessage("Players you can deinvite: ").color(ChatColor.GOLD); for (String id : myFaction.getInvites()) { FPlayer fp = FPlayers.getInstance().getById(id); String name = fp != null ? fp.getName() : id; msg.then(name + " ").color(ChatColor.WHITE).tooltip("Click to revoke invite for " + name).command("f deinvite " + name); } sendFancyMessage(msg); return; } if (you.getFaction() == myFaction) { msg("%s is already a member of %s", you.getName(), myFaction.getTag()); msg("You might want to: %s", p.cmdBase.cmdKick.getUseageTemplate(false)); return; } myFaction.deinvite(you); you.msg("%s revoked your invitation to %s.", fme.describeTo(you), myFaction.describeTo(you)); myFaction.msg("%s revoked %s's invitation.", fme.describeTo(myFaction), you.describeTo(myFaction)); } }