PVP Message can now be disabled

Closes https://github.com/taoneill/war/issues/138
This commit is contained in:
TimWolla 2011-07-08 22:35:47 +02:00
parent 84452d6654
commit d57d181f68
3 changed files with 18 additions and 1 deletions

View File

@ -83,6 +83,7 @@ public class War extends JavaPlugin {
private boolean pvpInZonesOnly = false; private boolean pvpInZonesOnly = false;
private boolean buildInZonesOnly = false; private boolean buildInZonesOnly = false;
private boolean disablePVPMessage = false;
private WarHub warHub; private WarHub warHub;
@ -1594,6 +1595,14 @@ public class War extends JavaPlugin {
public boolean isBuildInZonesOnly() { public boolean isBuildInZonesOnly() {
return buildInZonesOnly; return buildInZonesOnly;
} }
public void setDisablePVPMessage(boolean disablePVPMessage) {
this.disablePVPMessage = disablePVPMessage;
}
public boolean isDisablePVPMessage() {
return disablePVPMessage;
}
public void setDefaultUnbreakableZoneBlocks(boolean defaultUnbreakableZoneBlocks) { public void setDefaultUnbreakableZoneBlocks(boolean defaultUnbreakableZoneBlocks) {
this.defaultUnbreakableZoneBlocks = defaultUnbreakableZoneBlocks; this.defaultUnbreakableZoneBlocks = defaultUnbreakableZoneBlocks;

View File

@ -106,7 +106,9 @@ public class WarEntityListener extends EntityListener {
} else if (attackerTeam == null && defenderTeam == null && (!war.isPvpInZonesOnly() || a.getLocation().getWorld().getName().equals("pvp"))){ } else if (attackerTeam == null && defenderTeam == null && (!war.isPvpInZonesOnly() || a.getLocation().getWorld().getName().equals("pvp"))){
// let normal PVP through is its not turned off // let normal PVP through is its not turned off
} else if (attackerTeam == null && defenderTeam == null && war.isPvpInZonesOnly()) { } else if (attackerTeam == null && defenderTeam == null && war.isPvpInZonesOnly()) {
war.badMsg(a, "Your attack missed! Global PVP is turned off. You can only attack other players in warzones. Try /warhub, /zones and /zone."); if (!war.isDisablePVPMessage()) {
war.badMsg(a, "Your attack missed! Global PVP is turned off. You can only attack other players in warzones. Try /warhub, /zones and /zone.");
}
event.setCancelled(true); // global pvp is off event.setCancelled(true); // global pvp is off
} else { } else {
war.badMsg(a, "Your attack missed!"); war.badMsg(a, "Your attack missed!");

View File

@ -106,6 +106,9 @@ public class WarMapper {
// buildInZonesOnly // buildInZonesOnly
war.setBuildInZonesOnly(warConfig.getBoolean("buildInZonesOnly")); war.setBuildInZonesOnly(warConfig.getBoolean("buildInZonesOnly"));
// disablePVPMessage
war.setDisablePVPMessage(warConfig.getBoolean("disablePVPMessage"));
// defaultSpawnStyle // defaultSpawnStyle
String spawnStyle = warConfig.getString("defaultspawnStyle"); String spawnStyle = warConfig.getString("defaultspawnStyle");
if(spawnStyle != null && !spawnStyle.equals("")){ if(spawnStyle != null && !spawnStyle.equals("")){
@ -214,6 +217,9 @@ public class WarMapper {
// buildInZonesOnly // buildInZonesOnly
warConfig.setBoolean("buildInZonesOnly", war.isBuildInZonesOnly()); warConfig.setBoolean("buildInZonesOnly", war.isBuildInZonesOnly());
// disablePVPMessage
warConfig.setBoolean("disablePVPMessage", war.isDisablePVPMessage());
// spawnStyle // spawnStyle
warConfig.setString("spawnStyle", war.getDefaultSpawnStyle()); warConfig.setString("spawnStyle", war.getDefaultSpawnStyle());