New "peaceful" status for factions which can only be set by server admins/moderators. Members of peaceful factions cannot deal or receive PvP damage (unless in a war zone which has friendly fire enabled), cannot claim land from another faction and likewise can't have their land claimed, and cannot be considered as ally or enemy of any other faction. Faction admins and moderators of peaceful factions can enable/disable all explosions inside their faction's territory at will. The main purpose of this is to provide a way for more peaceful players who don't want to take part in faction wars (or just want to take a break from them) to still have fun on the server. It is also meant to allow groups of players to make protected buildings, monuments, grand constructions, and so forth without having to worry about another faction destroying them.
New conf.json settings: "peacefulTerritoryDisablePVP" (default true) prevents PvP damage for anyone inside a peaceful faction's territory "peacefulTerritoryDisableMonsters" (default false) provides protection against monsters spawning or attacking inside a peaceful faction's territory "peacefulMembersDisablePowerLoss" (default true) which keeps members of peaceful factions from suffering power loss when they die. New commands: /f peaceful [faction tag] - toggle the indicated faction's "peaceful" status /f noboom - enable/disable explosions inside your faction's territory; only available to faction admin and faction moderators for peaceful factions New permission nodes: factions.setPeaceful - ability to use the /f peaceful command (admins) factions.peacefulExplosionToggle - ability to use /f noboom (everyone)
This commit is contained in:
@ -92,7 +92,7 @@ public class FCommandHelp extends FBaseCommand {
|
||||
|
||||
pageLines = new ArrayList<String>();
|
||||
pageLines.add( new FCommandMap().getUseageTemplate() );
|
||||
pageLines.add("");
|
||||
pageLines.add( new FCommandNoBoom().getUseageTemplate() );
|
||||
pageLines.add("");
|
||||
pageLines.add( new FCommandOwner().getUseageTemplate() );
|
||||
pageLines.add( new FCommandOwnerList().getUseageTemplate() );
|
||||
@ -153,6 +153,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("Peaceful factions are protected from PvP and land capture.");
|
||||
pageLines.add( new FCommandLock().getUseageTemplate() );
|
||||
pageLines.add( new FCommandReload().getUseageTemplate() );
|
||||
pageLines.add( new FCommandSaveAll().getUseageTemplate() );
|
||||
|
58
src/com/massivecraft/factions/commands/FCommandNoBoom.java
Normal file
58
src/com/massivecraft/factions/commands/FCommandNoBoom.java
Normal file
@ -0,0 +1,58 @@
|
||||
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.struct.Role;
|
||||
|
||||
public class FCommandNoBoom extends FBaseCommand {
|
||||
|
||||
public FCommandNoBoom() {
|
||||
aliases.add("noboom");
|
||||
|
||||
helpDescription = "Peaceful factions only: toggle explosions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return Factions.hasPermPeacefulExplosionToggle(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if ( ! assertHasFaction()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( isLocked() ) {
|
||||
sendLockMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! assertMinRole(Role.MODERATOR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (!myFaction.isPeaceful()) {
|
||||
me.sendMessage("This command is only usable by factions which are specially designated as peaceful.");
|
||||
return;
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!payForCommand(Conf.econCostNoBoom)) {
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.setPeacefulExplosions();
|
||||
|
||||
String enabled = myFaction.noExplosionsInTerritory() ? "disabled" : "enabled";
|
||||
|
||||
// Inform
|
||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" has "+enabled+" explosions in your faction's territory.");
|
||||
}
|
||||
|
||||
}
|
45
src/com/massivecraft/factions/commands/FCommandPeaceful.java
Normal file
45
src/com/massivecraft/factions/commands/FCommandPeaceful.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandPeaceful extends FBaseCommand {
|
||||
|
||||
public FCommandPeaceful() {
|
||||
aliases.add("peaceful");
|
||||
|
||||
senderMustBePlayer = false;
|
||||
|
||||
requiredParameters.add("faction tag");
|
||||
|
||||
helpDescription = "Designate a faction as peaceful";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(CommandSender sender) {
|
||||
return Factions.hasPermSetPeaceful(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;
|
||||
}
|
||||
|
||||
if( faction != null && faction.isPeaceful() ) {
|
||||
sendMessage("Faction \"" + parameters.get(0) + "\" peaceful designation removed");
|
||||
faction.setPeaceful(false);
|
||||
} else {
|
||||
sendMessage("Faction \"" + faction.getTag() + "\" has been designated as peaceful");
|
||||
faction.setPeaceful(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -62,11 +62,12 @@ public class FCommandShow extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(faction.getOpen()) {
|
||||
sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"no invitation is needed");
|
||||
} else {
|
||||
sendMessage(Conf.colorChrome+"Joining: "+Conf.colorSystem+"invitation is required");
|
||||
String peaceStatus = "";
|
||||
if (faction.isPeaceful()) {
|
||||
peaceStatus = " "+Conf.colorNeutral+"This faction is Peaceful";
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
// show the land value
|
||||
|
@ -54,9 +54,9 @@ public class FRelationCommand extends FBaseCommand {
|
||||
}
|
||||
|
||||
myFaction.setRelationWish(otherFaction, whishedRelation);
|
||||
Relation currentRelation = myFaction.getRelation(otherFaction);
|
||||
Relation currentRelation = myFaction.getRelation(otherFaction, true);
|
||||
ChatColor currentRelationColor = currentRelation.getColor();
|
||||
if (whishedRelation == currentRelation) {
|
||||
if (whishedRelation.value == currentRelation.value) {
|
||||
otherFaction.sendMessage(Conf.colorSystem+"Your faction is now "+currentRelationColor+whishedRelation.toString()+Conf.colorSystem+" to "+currentRelationColor+myFaction.getTag());
|
||||
myFaction.sendMessage(Conf.colorSystem+"Your faction is now "+currentRelationColor+whishedRelation.toString()+Conf.colorSystem+" to "+currentRelationColor+otherFaction.getTag());
|
||||
} else {
|
||||
@ -64,5 +64,13 @@ public class FRelationCommand extends FBaseCommand {
|
||||
otherFaction.sendMessage(Conf.colorSystem+"Type "+Conf.colorCommand+Factions.instance.getBaseCommand()+" "+whishedRelation+" "+myFaction.getTag()+Conf.colorSystem+" to accept.");
|
||||
myFaction.sendMessage(currentRelationColor+otherFaction.getTag()+Conf.colorSystem+ " were informed that you wish to be "+whishedRelation.getColor()+whishedRelation);
|
||||
}
|
||||
if (!whishedRelation.isNeutral() && otherFaction.isPeaceful()) {
|
||||
otherFaction.sendMessage(Conf.colorSystem+"This will have no effect while your faction is peaceful.");
|
||||
myFaction.sendMessage(Conf.colorSystem+"This will have no effect while their faction is peaceful.");
|
||||
}
|
||||
if (!whishedRelation.isNeutral() && myFaction.isPeaceful()) {
|
||||
otherFaction.sendMessage(Conf.colorSystem+"This will have no effect while their faction is peaceful.");
|
||||
myFaction.sendMessage(Conf.colorSystem+"This will have no effect while your faction is peaceful.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user