Merge coleader

This commit is contained in:
Trent Hensler 2018-03-20 23:06:31 -07:00
commit 104e7916f8
6 changed files with 36 additions and 11 deletions

View File

@ -36,10 +36,11 @@ public class Conf {
public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less
public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts) public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts)
public static String prefixAdmin = "**"; public static String prefixAdmin = "***";
public static String prefixColeader = "**";
public static String prefixMod = "*"; public static String prefixMod = "*";
public static String prefixRecruit = "-";
public static String prefixNormal = "+"; public static String prefixNormal = "+";
public static String prefixRecruit = "-";
public static int factionTagLengthMin = 3; public static int factionTagLengthMin = 3;
public static int factionTagLengthMax = 10; public static int factionTagLengthMax = 10;

View File

@ -41,11 +41,19 @@ public class CmdKick extends FCommand {
String s = player.getName(); String s = player.getName();
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s); msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
} }
if (fme.getRole() == Role.ADMIN) { if (fme.getRole().isAtLeast(Role.COLEADER)) {
// For both coleader and admin, add mods.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) { for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
String s = player.getName(); String s = player.getName();
msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s); msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
} }
if (fme.getRole() == Role.ADMIN) {
// Only add coleader to this for the leader.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.COLEADER)) {
String s = player.getName();
msg.then(s + " ").color(ChatColor.RED).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " kick " + s);
}
}
} }
sendFancyMessage(msg); sendFancyMessage(msg);
@ -115,7 +123,6 @@ public class CmdKick extends FCommand {
} }
if (Conf.logFactionKick) { if (Conf.logFactionKick) {
//TODO:TL
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag()); P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
} }

View File

@ -15,7 +15,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public enum Role implements Permissable { public enum Role implements Permissable {
ADMIN(3, TL.ROLE_ADMIN), ADMIN(4, TL.ROLE_ADMIN),
COLEADER(3, TL.ROLE_COLEADER),
MODERATOR(2, TL.ROLE_MODERATOR), MODERATOR(2, TL.ROLE_MODERATOR),
NORMAL(1, TL.ROLE_NORMAL), NORMAL(1, TL.ROLE_NORMAL),
RECRUIT(0, TL.ROLE_RECRUIT); RECRUIT(0, TL.ROLE_RECRUIT);
@ -52,6 +53,8 @@ public enum Role implements Permissable {
case 2: case 2:
return MODERATOR; return MODERATOR;
case 3: case 3:
return COLEADER;
case 4 :
return ADMIN; return ADMIN;
} }
@ -62,6 +65,9 @@ public enum Role implements Permissable {
switch (check.toLowerCase()) { switch (check.toLowerCase()) {
case "admin": case "admin":
return ADMIN; return ADMIN;
case "coleader":
case "coowner":
return COLEADER;
case "mod": case "mod":
case "moderator": case "moderator":
return MODERATOR; return MODERATOR;
@ -90,6 +96,10 @@ public enum Role implements Permissable {
return Conf.prefixAdmin; return Conf.prefixAdmin;
} }
if (this == Role.COLEADER) {
return Conf.prefixColeader;
}
if (this == Role.MODERATOR) { if (this == Role.MODERATOR) {
return Conf.prefixMod; return Conf.prefixMod;
} }

View File

@ -803,8 +803,12 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
FPlayer oldLeader = this.getFPlayerAdmin(); FPlayer oldLeader = this.getFPlayerAdmin();
// get list of moderators, or list of normal members if there are no moderators // get list of coleaders, or mods, or list of normal members if there are no moderators
ArrayList<FPlayer> replacements = this.getFPlayersWhereRole(Role.MODERATOR); ArrayList<FPlayer> replacements = this.getFPlayersWhereRole(Role.COLEADER);
if (replacements == null || replacements.isEmpty()) {
replacements = this.getFPlayersWhereRole(Role.MODERATOR);
}
if (replacements == null || replacements.isEmpty()) { if (replacements == null || replacements.isEmpty()) {
replacements = this.getFPlayersWhereRole(Role.NORMAL); replacements = this.getFPlayersWhereRole(Role.NORMAL);
} }

View File

@ -706,6 +706,7 @@ public enum TL {
* Roles * Roles
*/ */
ROLE_ADMIN("admin"), ROLE_ADMIN("admin"),
ROLE_COLEADER("coleader"),
ROLE_MODERATOR("moderator"), ROLE_MODERATOR("moderator"),
ROLE_NORMAL("normal member"), ROLE_NORMAL("normal member"),
ROLE_RECRUIT("recruit"), ROLE_RECRUIT("recruit"),

View File

@ -399,15 +399,17 @@ fperm-gui:
recruit: 10 recruit: 10
normal: 11 normal: 11
moderator: 12 moderator: 12
truce: 13 coleader: 13
ally: 14 truce: 14
enemy: 15 ally: 15
neutral: 16 enemy: 16
neutral: 17
# Material to be displayed # Material to be displayed
materials: materials:
recruit: WOOD_SWORD recruit: WOOD_SWORD
normal: STONE_SWORD normal: STONE_SWORD
moderator: IRON_SWORD moderator: IRON_SWORD
coleader: SPONGE
truce: IRON_AXE truce: IRON_AXE
ally: DIAMOND_SWORD ally: DIAMOND_SWORD
enemy: DIAMOND_AXE enemy: DIAMOND_AXE