Addressed Issue #72
This commit is contained in:
parent
d1252df3ba
commit
0395280a9e
@ -25,36 +25,17 @@ public class CmdDeinvite extends FCommand {
|
|||||||
this.optionalArgs.put("player name", "name");
|
this.optionalArgs.put("player name", "name");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.DEINVITE)
|
this.requirements = new CommandRequirements.Builder(Permission.DEINVITE)
|
||||||
|
.withAction(PermissableAction.INVITE)
|
||||||
.memberOnly()
|
.memberOnly()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (context.args.size() == 0) {
|
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
|
||||||
for (String id : context.faction.getInvites()) {
|
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
|
||||||
String name = fp != null ? fp.getName() : id;
|
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
|
||||||
}
|
|
||||||
context.sendFancyMessage(msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||||
if (!context.fPlayer.isAdminBypassing()) {
|
|
||||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
|
||||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
|
||||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (you == null) {
|
if (you == null) {
|
||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||||
for (String id : context.faction.getInvites()) {
|
for (String id : context.faction.getInvites()) {
|
||||||
if (context.faction.getInvites().isEmpty()) return;
|
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : id;
|
String name = fp != null ? fp.getName() : id;
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
@ -65,15 +46,16 @@ public class CmdDeinvite extends FCommand {
|
|||||||
|
|
||||||
if (you.getFaction() == context.faction) {
|
if (you.getFaction() == context.faction) {
|
||||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FCmdRoot.instance.cmdKick.getUsageTemplate(context));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.faction.deinvite(you);
|
context.faction.deinvite(you);
|
||||||
|
|
||||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||||
|
|
||||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
||||||
|
Loading…
Reference in New Issue
Block a user