diff --git a/src/main/java/com/onarandombox/MultiverseCore/configuration/EntryFee.java b/src/main/java/com/onarandombox/MultiverseCore/configuration/EntryFee.java index be66fb3a..3fff6fe3 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/configuration/EntryFee.java +++ b/src/main/java/com/onarandombox/MultiverseCore/configuration/EntryFee.java @@ -22,6 +22,8 @@ public class EntryFee extends SerializationConfig { @Nullable private Material currency; + private final Material DISABLED_MATERIAL = Material.AIR; + public EntryFee() { super(); } @@ -51,6 +53,9 @@ public class EntryFee extends SerializationConfig { */ @Nullable public Material getCurrency() { + if (currency == null || currency.equals(DISABLED_MATERIAL)) { + return null; + } return currency; } diff --git a/src/test/java/com/onarandombox/MultiverseCore/TestEntryFeeConversion.java b/src/test/java/com/onarandombox/MultiverseCore/TestEntryFeeConversion.java index 05b94d33..110e9dd3 100644 --- a/src/test/java/com/onarandombox/MultiverseCore/TestEntryFeeConversion.java +++ b/src/test/java/com/onarandombox/MultiverseCore/TestEntryFeeConversion.java @@ -50,6 +50,10 @@ public class TestEntryFeeConversion { WorldProperties props = new WorldProperties(config); assertNull(props.entryfee.getCurrency()); + entryFee.put("currency", 0); + props = new WorldProperties(config); + assertNull(props.entryfee.getCurrency()); + entryFee.put("currency", 1); props = new WorldProperties(config); assertEquals(Material.STONE, props.entryfee.getCurrency());