mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-12-04 08:03:25 +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.resetFactionData();
|
||||||
fplayer.setFaction(faction);
|
fplayer.setFaction(faction);
|
||||||
faction.deinvite(fplayer);
|
faction.deinvite(fplayer);
|
||||||
|
fme.setRole(faction.getDefaultRole());
|
||||||
|
|
||||||
if (Conf.logFactionJoin) {
|
if (Conf.logFactionJoin) {
|
||||||
if (samePlayer) {
|
if (samePlayer) {
|
||||||
|
@ -15,7 +15,6 @@ public class CmdSetDefaultRole extends FCommand {
|
|||||||
this.aliases.add("def");
|
this.aliases.add("def");
|
||||||
this.requiredArgs.add("role");
|
this.requiredArgs.add("role");
|
||||||
|
|
||||||
this.senderMustBeMember = true;
|
|
||||||
this.senderMustBeAdmin = true;
|
this.senderMustBeAdmin = true;
|
||||||
this.senderMustBePlayer = true;
|
this.senderMustBePlayer = true;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class CmdShow extends FCommand {
|
|||||||
return;
|
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())) {
|
&& P.p.getConfig().getStringList("show-exempt").contains(faction.getTag())) {
|
||||||
msg(TL.COMMAND_SHOW_EXEMPT);
|
msg(TL.COMMAND_SHOW_EXEMPT);
|
||||||
return;
|
return;
|
||||||
|
@ -14,8 +14,7 @@ public class FPromoteCommand extends FCommand {
|
|||||||
public FPromoteCommand() {
|
public FPromoteCommand() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.optionalArgs.put("player name", "name");
|
this.requiredArgs.add("player");
|
||||||
//this.optionalArgs.put("", "");
|
|
||||||
|
|
||||||
this.permission = Permission.MOD.node;
|
this.permission = Permission.MOD.node;
|
||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
@ -44,7 +43,6 @@ public class FPromoteCommand extends FCommand {
|
|||||||
// Well this is messy.
|
// Well this is messy.
|
||||||
if (access == null || access == Access.UNDEFINED) {
|
if (access == null || access == Access.UNDEFINED) {
|
||||||
if (!assertMinRole(Role.MODERATOR)) {
|
if (!assertMinRole(Role.MODERATOR)) {
|
||||||
msg(TL.COMMAND_NOACCESS);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (access == Access.DENY) {
|
} else if (access == Access.DENY) {
|
||||||
@ -59,13 +57,15 @@ public class FPromoteCommand extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String action = relative > 0 ? TL.COMMAND_PROMOTE_PROMOTED.toString() : TL.COMMAND_PROMOTE_DEMOTED.toString();
|
||||||
|
|
||||||
// Success!
|
// Success!
|
||||||
target.setRole(promotion);
|
target.setRole(promotion);
|
||||||
if (target.isOnline()) {
|
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
|
@Override
|
||||||
|
@ -85,6 +85,7 @@ public class MiscUtil {
|
|||||||
List<FPlayer> admins = new ArrayList<>();
|
List<FPlayer> admins = new ArrayList<>();
|
||||||
List<FPlayer> moderators = new ArrayList<>();
|
List<FPlayer> moderators = new ArrayList<>();
|
||||||
List<FPlayer> normal = new ArrayList<>();
|
List<FPlayer> normal = new ArrayList<>();
|
||||||
|
List<FPlayer> recruit = new ArrayList<>();
|
||||||
|
|
||||||
for (FPlayer player : players) {
|
for (FPlayer player : players) {
|
||||||
switch (player.getRole()) {
|
switch (player.getRole()) {
|
||||||
@ -99,6 +100,10 @@ public class MiscUtil {
|
|||||||
case NORMAL:
|
case NORMAL:
|
||||||
normal.add(player);
|
normal.add(player);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RECRUIT:
|
||||||
|
recruit.add(player);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +111,7 @@ public class MiscUtil {
|
|||||||
ret.addAll(admins);
|
ret.addAll(admins);
|
||||||
ret.addAll(moderators);
|
ret.addAll(moderators);
|
||||||
ret.addAll(normal);
|
ret.addAll(normal);
|
||||||
|
ret.addAll(recruit);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
protected ConcurrentHashMap<String, String> warpPasswords = new ConcurrentHashMap<>();
|
protected ConcurrentHashMap<String, String> warpPasswords = new ConcurrentHashMap<>();
|
||||||
private long lastDeath;
|
private long lastDeath;
|
||||||
protected int maxVaults;
|
protected int maxVaults;
|
||||||
protected Map<Relation, Map<Action, Access>> permissions = new HashMap<>();
|
|
||||||
protected Role defaultRole;
|
protected Role defaultRole;
|
||||||
|
protected Map<Relation, Map<Action, Access>> permissions = new HashMap<>();
|
||||||
|
|
||||||
public HashMap<String, List<String>> getAnnouncements() {
|
public HashMap<String, List<String>> getAnnouncements() {
|
||||||
return this.announcements;
|
return this.announcements;
|
||||||
@ -579,12 +579,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean addFPlayer(FPlayer fplayer) {
|
public boolean addFPlayer(FPlayer fplayer) {
|
||||||
if (!this.isPlayerFreeType() && fplayers.add(fplayer)) {
|
return !this.isPlayerFreeType() && fplayers.add(fplayer);
|
||||||
fplayer.setRole(defaultRole); // set default role on join.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeFPlayer(FPlayer fplayer) {
|
public boolean removeFPlayer(FPlayer fplayer) {
|
||||||
|
@ -375,8 +375,10 @@ public enum TL {
|
|||||||
COMMAND_PERMANENT_REVOKE("removed permanent status from"),
|
COMMAND_PERMANENT_REVOKE("removed permanent status from"),
|
||||||
COMMAND_PERMANENT_YOURS("%1$s has %2$s your faction"),
|
COMMAND_PERMANENT_YOURS("%1$s has %2$s your faction"),
|
||||||
COMMAND_PERMANENT_OTHER("%s<i> has %s the faction '%s<i>'."),
|
COMMAND_PERMANENT_OTHER("%s<i> has %s the faction '%s<i>'."),
|
||||||
COMMAND_PROMOTE_TARGET("You've been promoted to %1$s"),
|
COMMAND_PROMOTE_TARGET("You've been %1$s to %2$s"),
|
||||||
COMMAND_PROMOTE_SUCCESS("You successfully promoted %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_DESCRIPTION("Toggle faction power permanence"), //TODO: This a real word?
|
||||||
COMMAND_PERMANENTPOWER_GRANT("added permanentpower status to"),
|
COMMAND_PERMANENTPOWER_GRANT("added permanentpower status to"),
|
||||||
|
Loading…
Reference in New Issue
Block a user