From 2011aac3245402745d5b1d8756fa6f5315084906 Mon Sep 17 00:00:00 2001 From: Austin Mayes Date: Sat, 1 Jun 2019 15:02:42 -0500 Subject: [PATCH] Default wool pre touch metric to off --- PGM/src/main/java/tc/oc/pgm/goals/ProximityMetric.java | 1 + PGM/src/main/java/tc/oc/pgm/map/ProtoVersions.java | 5 ++++- PGM/src/main/java/tc/oc/pgm/wool/WoolParser.java | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/PGM/src/main/java/tc/oc/pgm/goals/ProximityMetric.java b/PGM/src/main/java/tc/oc/pgm/goals/ProximityMetric.java index d5a98fd..449f3a7 100644 --- a/PGM/src/main/java/tc/oc/pgm/goals/ProximityMetric.java +++ b/PGM/src/main/java/tc/oc/pgm/goals/ProximityMetric.java @@ -70,6 +70,7 @@ public class ProximityMetric { public static ProximityMetric parse(Element el, String prefix, ProximityMetric def) throws InvalidXMLException { if(!prefix.isEmpty()) prefix = prefix + "-"; + if (def == null && el.getAttribute(prefix + "proximity-metric") == null) return null; return new ProximityMetric(XMLUtils.parseEnum(Node.fromAttr(el, prefix + "proximity-metric"), ProximityMetric.Type.class, "proximity metric", def.type), XMLUtils.parseBoolean(el.getAttribute(prefix + "proximity-horizontal"), def.horizontal)); } diff --git a/PGM/src/main/java/tc/oc/pgm/map/ProtoVersions.java b/PGM/src/main/java/tc/oc/pgm/map/ProtoVersions.java index 62ca0e1..27a0150 100644 --- a/PGM/src/main/java/tc/oc/pgm/map/ProtoVersions.java +++ b/PGM/src/main/java/tc/oc/pgm/map/ProtoVersions.java @@ -45,6 +45,9 @@ public class ProtoVersions { // Enable block 36 to be used, protos before this will remove it from the map public static final SemanticVersion ENABLE_BLOCK_36 = new SemanticVersion(1, 4, 3); + // Wool pre touch metric defaults to null + public static final SemanticVersion WOOL_PRE_TOUCH_OFF = new SemanticVersion(1, 4, 4); + // Current version - change this whenever we bump the proto - public static final SemanticVersion CURRENT = ENABLE_BLOCK_36; + public static final SemanticVersion CURRENT = WOOL_PRE_TOUCH_OFF; } diff --git a/PGM/src/main/java/tc/oc/pgm/wool/WoolParser.java b/PGM/src/main/java/tc/oc/pgm/wool/WoolParser.java index 72ed0f1..6a7d581 100644 --- a/PGM/src/main/java/tc/oc/pgm/wool/WoolParser.java +++ b/PGM/src/main/java/tc/oc/pgm/wool/WoolParser.java @@ -41,7 +41,11 @@ public class WoolParser implements FeatureDefinitionParser teamParser.property(el, "owner") .alias("team") .required(), - ProximityMetric.parse(el, "wool", new ProximityMetric(ProximityMetric.Type.CLOSEST_KILL, false)), + ProximityMetric.parse(el, "wool", + proto.isOlderThan(ProtoVersions.WOOL_PRE_TOUCH_OFF) ? + new ProximityMetric(ProximityMetric.Type.CLOSEST_KILL, false) : + null + ), ProximityMetric.parse(el, "monument", new ProximityMetric(ProximityMetric.Type.CLOSEST_BLOCK, false)), dyeColors.property(el, "color").required(), location,