mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-12-11 19:36:46 +01:00
Fix up default role and promote commands
This commit is contained in:
parent
5c2abb34de
commit
4110fb2ef4
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -85,6 +85,7 @@ public class MiscUtil {
|
||||
List<FPlayer> admins = new ArrayList<>();
|
||||
List<FPlayer> moderators = new ArrayList<>();
|
||||
List<FPlayer> normal = new ArrayList<>();
|
||||
List<FPlayer> recruit = new ArrayList<>();
|
||||
|
||||
for (FPlayer player : players) {
|
||||
switch (player.getRole()) {
|
||||
@ -99,6 +100,10 @@ public class MiscUtil {
|
||||
case NORMAL:
|
||||
normal.add(player);
|
||||
break;
|
||||
|
||||
case RECRUIT:
|
||||
recruit.add(player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +111,7 @@ public class MiscUtil {
|
||||
ret.addAll(admins);
|
||||
ret.addAll(moderators);
|
||||
ret.addAll(normal);
|
||||
ret.addAll(recruit);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
protected ConcurrentHashMap<String, String> warpPasswords = new ConcurrentHashMap<>();
|
||||
private long lastDeath;
|
||||
protected int maxVaults;
|
||||
protected Map<Relation, Map<Action, Access>> permissions = new HashMap<>();
|
||||
protected Role defaultRole;
|
||||
protected Map<Relation, Map<Action, Access>> permissions = new HashMap<>();
|
||||
|
||||
public HashMap<String, List<String>> getAnnouncements() {
|
||||
return this.announcements;
|
||||
@ -579,12 +579,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
}
|
||||
|
||||
public boolean addFPlayer(FPlayer fplayer) {
|
||||
if (!this.isPlayerFreeType() && fplayers.add(fplayer)) {
|
||||
fplayer.setRole(defaultRole); // set default role on join.
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return !this.isPlayerFreeType() && fplayers.add(fplayer);
|
||||
}
|
||||
|
||||
public boolean removeFPlayer(FPlayer fplayer) {
|
||||
|
@ -375,8 +375,10 @@ public enum TL {
|
||||
COMMAND_PERMANENT_REVOKE("removed permanent status from"),
|
||||
COMMAND_PERMANENT_YOURS("%1$s has %2$s your faction"),
|
||||
COMMAND_PERMANENT_OTHER("%s<i> has %s the faction '%s<i>'."),
|
||||
COMMAND_PROMOTE_TARGET("You've been promoted to %1$s"),
|
||||
COMMAND_PROMOTE_SUCCESS("You successfully promoted %1$s to %2$s"),
|
||||
COMMAND_PROMOTE_TARGET("You've been %1$s to %2$s"),
|
||||
COMMAND_PROMOTE_SUCCESS("You successfully %1$s %2$s to %3$s"),
|
||||
COMMAND_PROMOTE_PROMOTED("promoted"),
|
||||
COMMAND_PROMOTE_DEMOTED("demoted"),
|
||||
|
||||
COMMAND_PERMANENTPOWER_DESCRIPTION("Toggle faction power permanence"), //TODO: This a real word?
|
||||
COMMAND_PERMANENTPOWER_GRANT("added permanentpower status to"),
|
||||
|
Loading…
Reference in New Issue
Block a user