Changed the enum for Leader to actually be leader and not admin.

This commit is contained in:
ProSavage
2018-10-18 19:39:48 -05:00
parent 713aab8bfa
commit 80e66d7d6c
32 changed files with 181 additions and 182 deletions

View File

@@ -45,7 +45,7 @@ public class CmdAdmin extends FCommand {
return;
}
if (fme != null && fme.getRole() != Role.ADMIN && !permAny) {
if (fme != null && fme.getRole() != Role.LEADER && ! permAny) {
msg(TL.COMMAND_ADMIN_NOTADMIN);
return;
}
@@ -83,7 +83,7 @@ public class CmdAdmin extends FCommand {
if (admin != null) {
admin.setRole(Role.COLEADER);
}
fyou.setRole(Role.ADMIN);
fyou.setRole(Role.LEADER);
msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true));
// Inform all players

View File

@@ -37,7 +37,7 @@ public class CmdBan extends FCommand {
// Adds bypass to admins and clean permission check
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban");
return;
}

View File

@@ -35,7 +35,7 @@ public class CmdChest extends FCommand {
// This permission check is way too explicit but it's clean
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.CHEST);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
return;
}

View File

@@ -39,7 +39,7 @@ public class CmdClaim extends FCommand {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory");
return;
}

View File

@@ -55,7 +55,7 @@ public class CmdColeader extends FCommand {
return;
}
if (fme != null && fme.getRole() != Role.ADMIN && !permAny) {
if (fme != null && fme.getRole() != Role.LEADER && ! permAny) {
msg(TL.COMMAND_COLEADER_NOTADMIN);
return;
}
@@ -65,7 +65,7 @@ public class CmdColeader extends FCommand {
return;
}
if (you.getRole() == Role.ADMIN) {
if (you.getRole() == Role.LEADER) {
msg(TL.COMMAND_COLEADER_TARGETISADMIN);
return;
}

View File

@@ -89,7 +89,7 @@ public class CmdCreate extends FCommand {
// We should consider adding the role just AFTER joining the faction.
// That way we don't have to mess up deleting more stuff.
// And prevent the user from being returned to NORMAL after deleting his old faction.
fme.setRole(Role.ADMIN);
fme.setRole(Role.LEADER);
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));

View File

@@ -36,7 +36,7 @@ public class CmdDeinvite extends FCommand {
FPlayer you = this.argAsBestFPlayerMatch(0);
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}

View File

@@ -48,7 +48,7 @@ public class CmdDisband extends FCommand {
if (!fme.isAdminBypassing()) {
Access access = faction.getAccess(fme, PermissableAction.DISBAND);
if (access != Access.ALLOW || fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW || fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband " + faction.getTag());
return;
}

View File

@@ -33,7 +33,7 @@ public class CmdFWarp extends FCommand {
//TODO: check if in combat.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.WARP);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps");
return;
}

View File

@@ -51,7 +51,7 @@ public class CmdHome extends FCommand {
}
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}

View File

@@ -50,7 +50,7 @@ public class CmdInvite extends FCommand {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}

View File

@@ -47,7 +47,7 @@ public class CmdKick extends FCommand {
String s = player.getName();
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) {
if (fme.getRole() == Role.LEADER) {
// Only add coleader to this for the leader.
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.COLEADER)) {
String s = player.getName();
@@ -80,7 +80,7 @@ public class CmdKick extends FCommand {
// - Make sure the kicked player has lower rank than the kicker.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
return;
}
@@ -124,7 +124,7 @@ public class CmdKick extends FCommand {
if (Conf.logFactionKick) {
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + toKick.getName() + " from the faction: " + toKickFaction.getTag());
}
if (toKick.getRole() == Role.ADMIN) {
if (toKick.getRole() == Role.LEADER) {
toKickFaction.promoteNewLeader();
}
toKickFaction.deinvite(toKick);

View File

@@ -52,7 +52,7 @@ public class CmdMod extends FCommand {
return;
}
if (fme != null && fme.getRole() != Role.ADMIN && !permAny) {
if (fme != null && fme.getRole() != Role.LEADER && ! permAny) {
msg(TL.COMMAND_MOD_NOTADMIN);
return;
}
@@ -62,7 +62,7 @@ public class CmdMod extends FCommand {
return;
}
if (you.getRole() == Role.ADMIN) {
if (you.getRole() == Role.LEADER) {
msg(TL.COMMAND_MOD_TARGETISADMIN);
return;
}

View File

@@ -45,7 +45,7 @@ public class CmdOwner extends FCommand {
return;
}
if (!hasBypass && !assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.ADMIN)) {
if (! hasBypass && ! assertMinRole(Conf.ownedAreasModeratorsCanSet ? Role.MODERATOR : Role.LEADER)) {
return;
}

View File

@@ -30,7 +30,7 @@ public class CmdSetDefaultRole extends FCommand {
return;
}
if (target == Role.ADMIN) {
if (target == Role.LEADER) {
msg(TL.COMMAND_SETDEFAULTROLE_NOTTHATROLE, argAsString(0));
return;
}

View File

@@ -39,7 +39,7 @@ public class CmdSetFWarp extends FCommand {
// the old setting of allowing moderators to set warps.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
return;
}

View File

@@ -42,7 +42,7 @@ public class CmdSethome extends FCommand {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.SETHOME);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN && !Permission.SETHOME_ANY.has(sender, true)) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER && ! Permission.SETHOME_ANY.has(sender, true)) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home");
return;
}

View File

@@ -38,7 +38,7 @@ public class CmdTnt extends FCommand {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TNTBANK);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt bank");
return;
}

View File

@@ -36,7 +36,7 @@ public class CmdTntFill extends FCommand {
public void perform() {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TNTFILL);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt fill");
return;
}

View File

@@ -28,7 +28,7 @@ public class CmdUnban extends FCommand {
public void perform() {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN && !Permission.BAN.has(sender, true)) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER && ! Permission.BAN.has(sender, true)) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans");
return;
}

View File

@@ -37,7 +37,7 @@ public class CmdUnclaim extends FCommand {
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory");
return;
}

View File

@@ -105,7 +105,7 @@ public abstract class FCommand extends MCommand<P> {
return false;
}
if (this.senderMustBeAdmin && !fme.getRole().isAtLeast(Role.ADMIN)) {
if (this.senderMustBeAdmin && ! fme.getRole().isAtLeast(Role.LEADER)) {
sender.sendMessage(p.txt.parse("<b>Only faction admins can %s.", this.getHelpShort()));
return false;
}
@@ -261,11 +261,11 @@ public abstract class FCommand extends MCommand<P> {
return false;
}
if (i.getRole().value > you.getRole().value || i.getRole().equals(Role.ADMIN)) {
if (i.getRole().value > you.getRole().value || i.getRole().equals(Role.LEADER)) {
return true;
}
if (you.getRole().equals(Role.ADMIN)) {
if (you.getRole().equals(Role.LEADER)) {
i.sendMessage(p.txt.parse("<b>Only the faction admin can do that."));
} else if ((you.getRole().equals(Role.COLEADER))) {

View File

@@ -44,7 +44,7 @@ public class FPromoteCommand extends FCommand {
// Now it ain't that messy
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.PROMOTE);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_NOPERMISSION, "manage ranks");
return;
}