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:
parent
b490c5f196
commit
654e3b159b
@ -38,6 +38,9 @@ public class Conf {
|
||||
|
||||
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.
|
||||
|
||||
public static boolean chatTagEnabled = true;
|
||||
|
@ -375,6 +375,11 @@ public class FPlayer {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.CanLeaveWithNegativePower && this.getPower() < 0) {
|
||||
sendMessage("You cannot leave until your power is positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.isNormal()) {
|
||||
myFaction.sendMessage(this.getNameAndRelevant(myFaction) + Conf.colorSystem + " left your faction.");
|
||||
}
|
||||
|
@ -42,6 +42,11 @@ public class FCommandJoin extends FBaseCommand {
|
||||
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)) {
|
||||
sendMessage("This guild requires invitation.");
|
||||
faction.sendMessage(me.getNameAndRelevant(faction)+Conf.colorSystem+" tried to join your faction.");
|
||||
|
@ -46,6 +46,11 @@ public class FCommandKick extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.CanLeaveWithNegativePower && you.getPower() < 0) {
|
||||
sendMessage("You cannot kick that member until their power is positive.");
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.deinvite(you);
|
||||
you.resetFactionData();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user