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;
}

View File

@ -669,7 +669,7 @@ public class EngineDynmap {
FPlayer playersLeaderObject = faction.getFPlayerAdmin();
String playersLeader = getHtmlPlayerName(playersLeaderObject);
ArrayList<FPlayer> playersAdminsList = faction.getFPlayersWhereRole(Role.ADMIN);
ArrayList<FPlayer> playersAdminsList = faction.getFPlayersWhereRole(Role.LEADER);
String playersAdminsCount = String.valueOf(playersAdminsList.size());
String playersAdmins = getHtmlPlayerString(playersAdminsList);

View File

@ -68,25 +68,125 @@ public class FactionsBlockListener implements Listener {
}
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true);
return;
public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) {
String name = player.getName();
if (Conf.playersWhoBypassAllProtection.contains(name)) {
return true;
}
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
if (me.isAdminBypassing()) {
return true;
}
FLocation loc = new FLocation(location);
Faction otherFaction = Board.getInstance().getFactionAt(loc);
if (otherFaction.isWilderness()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true;
}
if (! Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) {
return true; // This is not faction territory. Use whatever you like here.
}
if (! justCheck) {
me.msg("<b>You can't " + action + " in the wilderness.");
}
return false;
} else if (otherFaction.isSafeZone()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true;
}
if (! Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player)) {
return true;
}
if (! justCheck) {
me.msg("<b>You can't " + action + " in a safe zone.");
}
return false;
} else if (otherFaction.isWarZone()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true;
}
if (! Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player)) {
return true;
}
if (! justCheck) {
me.msg("<b>You can't " + action + " in a war zone.");
}
return false;
}
if (P.p.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() >= otherFaction.getPowerRounded()) {
return true;
}
Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction);
boolean online = otherFaction.hasPlayersOnline();
boolean pain = ! justCheck && rel.confPainBuild(online);
boolean deny = rel.confDenyBuild(online);
Access access = otherFaction.getAccess(me, PermissableAction.fromString(action));
if (access == Access.ALLOW && ((rel == Relation.ALLY) || (rel == Relation.ENEMY) || (rel == Relation.NEUTRAL) || (rel == Relation.TRUCE))) {
deny = false;
}
// hurt the player for building/destroying in other territory?
if (pain) {
player.damage(Conf.actionDeniedPainAmount);
if (! deny) {
me.msg("<b>It is painful to try to " + action + " in the territory of " + otherFaction.getTag(myFaction));
}
}
// cancel building/destroying in other territory?
if (deny) {
if (! justCheck) {
me.msg("<b>You can't " + action + " in the territory of " + otherFaction.getTag(myFaction));
}
return false;
}
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (!fme.hasFaction()) {
return;
}
if (event.getBlock().getType() == P.p.MOB_SPANWER) {
if (!fme.isAdminBypassing()) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
return;
// Also cancel and/or cause pain if player doesn't have ownership rights for this claim
if (Conf.ownedAreasEnabled && (Conf.ownedAreaDenyBuild || Conf.ownedAreaPainBuild) && ! otherFaction.playerHasOwnershipRights(me, loc)) {
if (! pain && Conf.ownedAreaPainBuild && ! justCheck) {
player.damage(Conf.actionDeniedPainAmount);
if (! Conf.ownedAreaDenyBuild) {
me.msg("<b>It is painful to try to " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc));
}
}
if (Conf.ownedAreaDenyBuild) {
if (! justCheck) {
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc));
return false;
}
}
}
// Check the permission just after making sure the land isn't owned by someone else to avoid bypass.
if (access != Access.ALLOW && me.getRole() != Role.LEADER) {
// TODO: Update this once new access values are added other than just allow / deny.
if (access == Access.DENY) {
me.msg(TL.GENERIC_NOPERMISSION, action);
return false;
} else if (myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && ! myFaction.getOwnerListString(loc).contains(player.getName())) {
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
return false;
}
}
return true;
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@ -277,124 +377,24 @@ public class FactionsBlockListener implements Listener {
return !rel.confDenyBuild(otherFaction.hasPlayersOnline());
}
public static boolean playerCanBuildDestroyBlock(Player player, Location location, String action, boolean justCheck) {
String name = player.getName();
if (Conf.playersWhoBypassAllProtection.contains(name)) {
return true;
}
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
if (me.isAdminBypassing()) {
return true;
}
FLocation loc = new FLocation(location);
Faction otherFaction = Board.getInstance().getFactionAt(loc);
if (otherFaction.isWilderness()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true;
}
if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName())) {
return true; // This is not faction territory. Use whatever you like here.
}
if (!justCheck) {
me.msg("<b>You can't " + action + " in the wilderness.");
}
return false;
} else if (otherFaction.isSafeZone()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true;
}
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player)) {
return true;
}
if (!justCheck) {
me.msg("<b>You can't " + action + " in a safe zone.");
}
return false;
} else if (otherFaction.isWarZone()) {
if (Conf.worldGuardBuildPriority && Worldguard.playerCanBuild(player, location)) {
return true;
}
if (!Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player)) {
return true;
}
if (!justCheck) {
me.msg("<b>You can't " + action + " in a war zone.");
}
return false;
}
if (P.p.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() >= otherFaction.getPowerRounded()) {
return true;
}
Faction myFaction = me.getFaction();
Relation rel = myFaction.getRelationTo(otherFaction);
boolean online = otherFaction.hasPlayersOnline();
boolean pain = !justCheck && rel.confPainBuild(online);
boolean deny = rel.confDenyBuild(online);
Access access = otherFaction.getAccess(me, PermissableAction.fromString(action));
if (access == Access.ALLOW && ((rel == Relation.ALLY) || (rel == Relation.ENEMY) || (rel == Relation.NEUTRAL) || (rel == Relation.TRUCE))) {
deny = false;
}
// hurt the player for building/destroying in other territory?
if (pain) {
player.damage(Conf.actionDeniedPainAmount);
if (!deny) {
me.msg("<b>It is painful to try to " + action + " in the territory of " + otherFaction.getTag(myFaction));
}
}
// cancel building/destroying in other territory?
if (deny) {
if (!justCheck) {
me.msg("<b>You can't " + action + " in the territory of " + otherFaction.getTag(myFaction));
}
return false;
}
// Also cancel and/or cause pain if player doesn't have ownership rights for this claim
if (Conf.ownedAreasEnabled && (Conf.ownedAreaDenyBuild || Conf.ownedAreaPainBuild) && !otherFaction.playerHasOwnershipRights(me, loc)) {
if (!pain && Conf.ownedAreaPainBuild && !justCheck) {
player.damage(Conf.actionDeniedPainAmount);
if (!Conf.ownedAreaDenyBuild) {
me.msg("<b>It is painful to try to " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc));
}
}
if (Conf.ownedAreaDenyBuild) {
if (!justCheck) {
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + otherFaction.getOwnerListString(loc));
return false;
}
}
}
// Check the permission just after making sure the land isn't owned by someone else to avoid bypass.
if (access != Access.ALLOW && me.getRole() != Role.ADMIN) {
// TODO: Update this once new access values are added other than just allow / deny.
if (access == Access.DENY) {
me.msg(TL.GENERIC_NOPERMISSION, action);
return false;
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) {
me.msg("<b>You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
return false;
}
}
return true;
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
if (! playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true);
return;
}
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (! fme.hasFaction()) {
return;
}
if (event.getBlock().getType() == P.p.MOB_SPANWER) {
if (! fme.isAdminBypassing()) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
return;
}
}
}
}
}

View File

@ -326,7 +326,7 @@ public class FactionsPlayerListener implements Listener {
}
if (access != Access.ALLOW && me.getRole() != Role.ADMIN) {
if (access != Access.ALLOW && me.getRole() != Role.LEADER) {
// TODO: Update this once new access values are added other than just allow / deny.
if ((myFaction.getOwnerListString(loc) != null && ! myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) {
return true;
@ -1004,7 +1004,7 @@ public class FactionsPlayerListener implements Listener {
// if player was banned (not just kicked), get rid of their stored info
if (Conf.removePlayerDataWhenBanned && event.getReason().equals("Banned by admin.")) {
if (badGuy.getRole() == Role.ADMIN) {
if (badGuy.getRole() == Role.LEADER) {
badGuy.getFaction().promoteNewLeader();
}

View File

@ -15,7 +15,7 @@ import java.util.ArrayList;
import java.util.List;
public enum Role implements Permissable {
ADMIN(4, TL.ROLE_ADMIN),
LEADER(4, TL.ROLE_LEADER),
COLEADER(3, TL.ROLE_COLEADER),
MODERATOR(2, TL.ROLE_MODERATOR),
NORMAL(1, TL.ROLE_NORMAL),
@ -47,7 +47,7 @@ public enum Role implements Permissable {
case 3:
return COLEADER;
case 4:
return ADMIN;
return LEADER;
}
return null;
@ -56,7 +56,7 @@ public enum Role implements Permissable {
public static Role fromString(String check) {
switch (check.toLowerCase()) {
case "admin":
return ADMIN;
return LEADER;
case "coleader":
return COLEADER;
case "mod":
@ -91,7 +91,7 @@ public enum Role implements Permissable {
}
public String getPrefix() {
if (this == Role.ADMIN) {
if (this == Role.LEADER) {
return Conf.prefixAdmin;
}
if (this == Role.COLEADER) {

View File

@ -60,7 +60,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
}
// if player is faction admin, sort out the faction since he's going away
if (fplayer.getRole() == Role.ADMIN) {
if (fplayer.getRole() == Role.LEADER) {
Faction faction = fplayer.getFaction();
if (faction != null) {
fplayer.getFaction().promoteNewLeader();

View File

@ -99,7 +99,7 @@ public class MiscUtil {
}
switch (player.getRole()) {
case ADMIN:
case LEADER:
admins.add(player);
break;

View File

@ -653,7 +653,7 @@ public abstract class MemoryFPlayer implements FPlayer {
boolean perm = myFaction.isPermanent();
if (!perm && this.getRole() == Role.ADMIN && myFaction.getFPlayers().size() > 1) {
if (! perm && this.getRole() == Role.LEADER && myFaction.getFPlayers().size() > 1) {
msg(TL.LEAVE_PASSADMIN);
return;
}
@ -894,7 +894,7 @@ public abstract class MemoryFPlayer implements FPlayer {
public boolean canFlyAtLocation(FLocation location) {
Faction faction = Board.getInstance().getFactionAt(location);
if ((faction == getFaction() && getRole() == Role.ADMIN) || isAdminBypassing) {
if ((faction == getFaction() && getRole() == Role.LEADER) || isAdminBypassing) {
return true;
}
@ -1196,7 +1196,7 @@ public abstract class MemoryFPlayer implements FPlayer {
if (getRole() == Role.COLEADER) {
return Conf.prefixCoLeader;
}
if (getRole() == Role.ADMIN) {
if (getRole() == Role.LEADER) {
return Conf.prefixAdmin;
}
return null;

View File

@ -11,7 +11,6 @@ import com.massivecraft.factions.struct.BanInfo;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.InventoryUtil;
import com.massivecraft.factions.util.LazyLocation;
import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.util.RelationUtil;
@ -657,7 +656,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
// And each role.
for (Role role : Role.values()) {
if (role != Role.ADMIN) {
if (role != Role.LEADER) {
permissions.put(role, new HashMap<>(freshMap));
}
}
@ -910,7 +909,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
for (FPlayer fplayer : fplayers) {
if (fplayer.getRole() == Role.ADMIN) {
if (fplayer.getRole() == Role.LEADER) {
return fplayer;
}
}
@ -1014,7 +1013,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
if (oldLeader != null) {
oldLeader.setRole(Role.NORMAL);
}
replacements.get(0).setRole(Role.ADMIN);
replacements.get(0).setRole(Role.LEADER);
//TODO:TL
this.msg("<i>Faction admin <h>%s<i> has been removed. %s<i> has been promoted as the new faction admin.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName());
P.p.log("Faction " + this.getTag() + " (" + this.getId() + ") admin was removed. Replacement admin: " + replacements.get(0).getName());
@ -1156,7 +1155,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
public boolean playerHasOwnershipRights(FPlayer fplayer, FLocation loc) {
// in own faction, with sufficient role or permission to bypass
// ownership?
if (fplayer.getFaction() == this && (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.ADMIN) || Permission.OWNERSHIP_BYPASS.has(fplayer.getPlayer()))) {
if (fplayer.getFaction() == this && (fplayer.getRole().isAtLeast(Conf.ownedAreaModeratorsBypass ? Role.MODERATOR : Role.LEADER) || Permission.OWNERSHIP_BYPASS.has(fplayer.getPlayer()))) {
return true;
}

View File

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