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:
Brettflan
2011-08-05 03:50:47 -05:00
parent 4ad9829fd4
commit 68e1313776
11 changed files with 237 additions and 28 deletions

View File

@@ -31,6 +31,8 @@ public class Faction {
private Map<FLocation, Set<String>> claimOwnership = new HashMap<FLocation, Set<String>>();
private Set<String> invites; // Where string is a lowercase player name
private boolean open;
private boolean peaceful;
private boolean peacefulExplosionsEnabled;
private String tag;
private String description;
private Location home;
@@ -120,7 +122,34 @@ public class Faction {
sendMessage("Your faction home has been un-set since it is no longer in your territory.");
this.home = null;
}
// "peaceful" status can only be set by server admins/moderators/ops, and prevents PvP and land capture to/from the faction
public boolean isPeaceful() {
return peaceful;
}
public void setPeaceful(boolean isPeaceful) {
peaceful = isPeaceful;
}
public void setPeacefulExplosions(boolean disable) {
peacefulExplosionsEnabled = disable;
}
public void setPeacefulExplosions() {
setPeacefulExplosions(!peacefulExplosionsEnabled);
}
public boolean noPvPInTerritory() {
return isSafeZone() || (peaceful && Conf.peacefulTerritoryDisablePVP);
}
public boolean noMonstersInTerritory() {
return isSafeZone() || (peaceful && Conf.peacefulTerritoryDisableMonsters);
}
public boolean noExplosionsInTerritory() {
return peaceful && !peacefulExplosionsEnabled;
}
// -------------------------------
// Understand the types
// -------------------------------
@@ -177,12 +206,19 @@ public class Faction {
}
public Relation getRelation(Faction otherFaction) {
return getRelation(otherFaction, false);
}
public Relation getRelation(Faction otherFaction, boolean ignorePeaceful) {
if (!otherFaction.isNormal() || !this.isNormal()) {
return Relation.NEUTRAL;
}
if (otherFaction.equals(this)) {
return Relation.MEMBER;
}
if (!ignorePeaceful && (this.peaceful || otherFaction.isPeaceful())) {
return Relation.NEUTRAL;
}
if(this.getRelationWish(otherFaction).value >= otherFaction.getRelationWish(this).value) {
return otherFaction.getRelationWish(this);
}