New option to disallow players from leaving, joining, or being kicked from a faction while they have a negative power level - code by sp1ky, adapted from a pull request

This commit is contained in:
Brettflan 2011-05-29 16:41:50 -05:00
parent b490c5f196
commit 654e3b159b
4 changed files with 18 additions and 0 deletions

View File

@ -38,6 +38,9 @@ public class Conf {
public static boolean showMapFactionKey = true; public static boolean showMapFactionKey = true;
// Disallow joining/leaving/kicking while power is negative
public static boolean CanLeaveWithNegativePower = true;
// Configuration on the Faction tag in chat messages. // Configuration on the Faction tag in chat messages.
public static boolean chatTagEnabled = true; public static boolean chatTagEnabled = true;

View File

@ -375,6 +375,11 @@ public class FPlayer {
return; return;
} }
if (!Conf.CanLeaveWithNegativePower && this.getPower() < 0) {
sendMessage("You cannot leave until your power is positive.");
return;
}
if (myFaction.isNormal()) { if (myFaction.isNormal()) {
myFaction.sendMessage(this.getNameAndRelevant(myFaction) + Conf.colorSystem + " left your faction."); myFaction.sendMessage(this.getNameAndRelevant(myFaction) + Conf.colorSystem + " left your faction.");
} }

View File

@ -42,6 +42,11 @@ public class FCommandJoin extends FBaseCommand {
return; return;
} }
if (!Conf.CanLeaveWithNegativePower && me.getPower() < 0) {
sendMessage("You cannot join a faction until your power is positive.");
return;
}
if( ! faction.getOpen() && ! faction.isInvited(me)) { if( ! faction.getOpen() && ! faction.isInvited(me)) {
sendMessage("This guild requires invitation."); sendMessage("This guild requires invitation.");
faction.sendMessage(me.getNameAndRelevant(faction)+Conf.colorSystem+" tried to join your faction."); faction.sendMessage(me.getNameAndRelevant(faction)+Conf.colorSystem+" tried to join your faction.");

View File

@ -46,6 +46,11 @@ public class FCommandKick extends FBaseCommand {
return; return;
} }
if (!Conf.CanLeaveWithNegativePower && you.getPower() < 0) {
sendMessage("You cannot kick that member until their power is positive.");
return;
}
myFaction.deinvite(you); myFaction.deinvite(you);
you.resetFactionData(); you.resetFactionData();