New command to set a faction as permanent: /f permanent <faction tag> (requires new admin-level permission "factions.setPermanent"). Permanent factions will not be deleted if they have no members, and faction admins of such factions are allowed to leave without a replacement available. Faction admins are also unable to disband their own faction if it is Permanent; only those with the admin-level "factions.disband" permission can disband such a faction while it is set as Permanent.
This commit is contained in:
@ -52,6 +52,11 @@ public class FCommandDisband extends FBaseCommand {
|
||||
}
|
||||
|
||||
faction = me.getFaction();
|
||||
|
||||
if (faction.isPermanent() && !Factions.hasPermDisband(sender)) {
|
||||
sendMessage("Your faction is designated as permanent, so you cannot disband it.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
|
@ -140,6 +140,7 @@ public class FCommandHelp extends FBaseCommand {
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add("Finally some commands for the server admins:");
|
||||
pageLines.add( new FCommandBypass().getUseageTemplate() );
|
||||
pageLines.add( new FCommandSafeclaim().getUseageTemplate() );
|
||||
pageLines.add( new FCommandAutoSafeclaim().getUseageTemplate() );
|
||||
pageLines.add( new FCommandSafeunclaimall().getUseageTemplate() );
|
||||
@ -151,8 +152,8 @@ public class FCommandHelp extends FBaseCommand {
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add("More commands for server admins:");
|
||||
pageLines.add( new FCommandBypass().getUseageTemplate() );
|
||||
pageLines.add( new FCommandPeaceful().getUseageTemplate() );
|
||||
pageLines.add( new FCommandPermanent().getUseageTemplate() );
|
||||
pageLines.add("Peaceful factions are protected from PvP and land capture.");
|
||||
pageLines.add( new FCommandLock().getUseageTemplate() );
|
||||
pageLines.add( new FCommandReload().getUseageTemplate() );
|
||||
|
@ -71,7 +71,7 @@ public class FCommandKick extends FBaseCommand {
|
||||
yourFaction.deinvite(you);
|
||||
you.resetFactionData();
|
||||
|
||||
if (yourFaction.getFPlayers().isEmpty()) {
|
||||
if (yourFaction.getFPlayers().isEmpty() && !yourFaction.isPermanent()) {
|
||||
// Remove this faction
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
fplayer.sendMessage("The faction "+yourFaction.getTag(fplayer)+Conf.colorSystem+" was disbanded.");
|
||||
|
@ -0,0 +1,57 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
|
||||
|
||||
public class FCommandPermanent extends FBaseCommand {
|
||||
|
||||
public FCommandPermanent() {
|
||||
aliases.add("permanent");
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
requiredParameters.add("faction tag");
|
||||
|
||||
helpDescription = "Designate a faction as permanent";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return Factions.hasPermSetPermanent(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if( parameters.size() > 0) {
|
||||
Faction faction = Faction.findByTag(parameters.get(0));
|
||||
|
||||
if (faction == null) {
|
||||
sendMessage("No faction found with the tag \"" + parameters.get(0) + "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
String change;
|
||||
if(faction.isPermanent()) {
|
||||
change = "removed permanent status from";
|
||||
faction.setPermanent(false);
|
||||
} else {
|
||||
change = "added permanent status to";
|
||||
faction.setPermanent(true);
|
||||
}
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" your faction.");
|
||||
} else {
|
||||
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -70,6 +70,10 @@ public class FCommandShow extends FBaseCommand {
|
||||
sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+(faction.getOpen() ? "no invitation is needed" : "invitation is required")+peaceStatus);
|
||||
sendMessage(Conf.colorChrome+"Land / Power / Maxpower: "+Conf.colorSystem+ faction.getLandRounded()+" / "+faction.getPowerRounded()+" / "+faction.getPowerMaxRounded());
|
||||
|
||||
if (faction.isPermanent()) {
|
||||
sendMessage(Conf.colorChrome+"This faction is permanent, remaining even with no members.");
|
||||
}
|
||||
|
||||
// show the land value
|
||||
if (Econ.enabled()) {
|
||||
double value = Econ.calculateTotalLandValue(faction.getLandRounded());
|
||||
|
Reference in New Issue
Block a user