New setting factionMemberLimit (default 0, no limit), which will prevent players from joining any faction that has reached this membership limit.
This commit is contained in:
parent
2a667a294d
commit
817a43b5e0
@ -51,6 +51,9 @@ public class Conf
|
|||||||
|
|
||||||
public static boolean newFactionsDefaultOpen = false;
|
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"
|
// what faction ID to start new players in when they first join the server; default is 0, "no faction"
|
||||||
public static String newPlayerStartingFactionID = "0";
|
public static String newPlayerStartingFactionID = "0";
|
||||||
|
|
||||||
|
@ -35,25 +35,31 @@ public class CmdJoin extends FCommand
|
|||||||
msg("<b>You may only join normal factions. This is a system faction.");
|
msg("<b>You may only join normal factions. This is a system faction.");
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (faction == myFaction)
|
if (faction == myFaction)
|
||||||
{
|
{
|
||||||
msg("<b>You are already a member of %s", faction.getTag(fme));
|
msg("<b>You are already a member of %s", faction.getTag(fme));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Conf.factionMemberLimit > 0 && faction.getFPlayers().size() >= Conf.factionMemberLimit)
|
||||||
|
{
|
||||||
|
msg("<b>The faction %s is at the limit of %d members, so you cannot currently join.", faction.getTag(fme));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (fme.hasFaction())
|
if (fme.hasFaction())
|
||||||
{
|
{
|
||||||
msg("<b>You must leave your current faction first.");
|
msg("<b>You must leave your current faction first.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Conf.canLeaveWithNegativePower && fme.getPower() < 0)
|
if (!Conf.canLeaveWithNegativePower && fme.getPower() < 0)
|
||||||
{
|
{
|
||||||
msg("<b>You cannot join a faction until your power is positive.");
|
msg("<b>You cannot join a faction until your power is positive.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! (faction.getOpen() || faction.isInvited(fme) || fme.hasAdminMode() || Permission.JOIN_ANY.has(sender, false)))
|
if( ! (faction.getOpen() || faction.isInvited(fme) || fme.hasAdminMode() || Permission.JOIN_ANY.has(sender, false)))
|
||||||
{
|
{
|
||||||
msg("<i>This faction requires invitation.");
|
msg("<i>This faction requires invitation.");
|
||||||
@ -66,7 +72,7 @@ public class CmdJoin extends FCommand
|
|||||||
|
|
||||||
fme.msg("<i>You successfully joined %s", faction.getTag(fme));
|
fme.msg("<i>You successfully joined %s", faction.getTag(fme));
|
||||||
faction.msg("<i>%s joined your faction.", fme.describeTo(faction, true));
|
faction.msg("<i>%s joined your faction.", fme.describeTo(faction, true));
|
||||||
|
|
||||||
fme.resetFactionData();
|
fme.resetFactionData();
|
||||||
fme.setFaction(faction);
|
fme.setFaction(faction);
|
||||||
faction.deinvite(fme);
|
faction.deinvite(fme);
|
||||||
|
Loading…
Reference in New Issue
Block a user