mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-03-12 14:49:40 +01:00
Fix cannot remove block currency with mvm set command.
Setting currency to 0 is now considered as no currency value.
This commit is contained in:
parent
d041e0a8d1
commit
48601e4215
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user