diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 70c436cf..157e445d 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -51,6 +51,9 @@ public class Conf public static boolean newFactionsDefaultOpen = false; + // when faction membership hits this limit, players will no longer be able to join using /f join; default is 0, no limit + public static int factionMemberLimit = 0; + // what faction ID to start new players in when they first join the server; default is 0, "no faction" public static String newPlayerStartingFactionID = "0"; diff --git a/src/com/massivecraft/factions/cmd/CmdJoin.java b/src/com/massivecraft/factions/cmd/CmdJoin.java index 32eecec7..4870c567 100644 --- a/src/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdJoin.java @@ -35,25 +35,31 @@ public class CmdJoin extends FCommand msg("You may only join normal factions. This is a system faction."); return; }*/ - + if (faction == myFaction) { msg("You are already a member of %s", faction.getTag(fme)); return; } - + + if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit) + { + msg("The faction %s is at the limit of %d members, so you cannot currently join.", faction.getTag(fme)); + return; + } + if (fme.hasFaction()) { msg("You must leave your current faction first."); return; } - + if (!Conf.canLeaveWithNegativePower && fme.getPower() < 0) { msg("You cannot join a faction until your power is positive."); return; } - + if( ! (faction.getOpen() || faction.isInvited(fme) || fme.hasAdminMode() || Permission.JOIN_ANY.has(sender, false))) { msg("This faction requires invitation."); @@ -66,7 +72,7 @@ public class CmdJoin extends FCommand fme.msg("You successfully joined %s", faction.getTag(fme)); faction.msg("%s joined your faction.", fme.describeTo(faction, true)); - + fme.resetFactionData(); fme.setFaction(faction); faction.deinvite(fme);