Fix up default role and promote commands

This commit is contained in:
Trent Hensler
2018-01-04 18:10:49 -08:00
parent 5c2abb34de
commit 4110fb2ef4
7 changed files with 19 additions and 16 deletions

View File

@@ -101,6 +101,7 @@ public class CmdJoin extends FCommand {
fplayer.resetFactionData();
fplayer.setFaction(faction);
faction.deinvite(fplayer);
fme.setRole(faction.getDefaultRole());
if (Conf.logFactionJoin) {
if (samePlayer) {

View File

@@ -15,7 +15,6 @@ public class CmdSetDefaultRole extends FCommand {
this.aliases.add("def");
this.requiredArgs.add("role");
this.senderMustBeMember = true;
this.senderMustBeAdmin = true;
this.senderMustBePlayer = true;

View File

@@ -54,7 +54,7 @@ public class CmdShow extends FCommand {
return;
}
if (!fme.getPlayer().hasPermission("factions.show.bypassexempt")
if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")
&& P.p.getConfig().getStringList("show-exempt").contains(faction.getTag())) {
msg(TL.COMMAND_SHOW_EXEMPT);
return;

View File

@@ -14,8 +14,7 @@ public class FPromoteCommand extends FCommand {
public FPromoteCommand() {
super();
this.optionalArgs.put("player name", "name");
//this.optionalArgs.put("", "");
this.requiredArgs.add("player");
this.permission = Permission.MOD.node;
this.disableOnLock = true;
@@ -44,7 +43,6 @@ public class FPromoteCommand extends FCommand {
// Well this is messy.
if (access == null || access == Access.UNDEFINED) {
if (!assertMinRole(Role.MODERATOR)) {
msg(TL.COMMAND_NOACCESS);
return;
}
} else if (access == Access.DENY) {
@@ -59,13 +57,15 @@ public class FPromoteCommand extends FCommand {
return;
}
String action = relative > 0 ? TL.COMMAND_PROMOTE_PROMOTED.toString() : TL.COMMAND_PROMOTE_DEMOTED.toString();
// Success!
target.setRole(promotion);
if (target.isOnline()) {
target.msg(TL.COMMAND_PROMOTE_TARGET, promotion.nicename);
target.msg(TL.COMMAND_PROMOTE_TARGET, action, promotion.nicename);
}
target.msg(TL.COMMAND_PROMOTE_SUCCESS, target.getName(), promotion.nicename);
fme.msg(TL.COMMAND_PROMOTE_SUCCESS, action, target.getName(), promotion.nicename);
}
@Override