Fixes reloading of data in YAML database

https://github.com/BentoBoxWorld/addon-limits/issues/6
This commit is contained in:
tastybento 2019-02-07 19:39:27 -08:00
parent 18a3e21a5b
commit 337635d1d8
3 changed files with 10 additions and 2 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>limits</artifactId> <artifactId>limits</artifactId>
<version>0.0.2-SNAPSHOT</version> <version>0.0.3-SNAPSHOT</version>
<name>addon-limits</name> <name>addon-limits</name>
<description>An add-on for BentoBox that limits blocks and entities on islands.</description> <description>An add-on for BentoBox that limits blocks and entities on islands.</description>
<url>https://github.com/BentoBoxWorld/addon-level</url> <url>https://github.com/BentoBoxWorld/addon-level</url>

View File

@ -71,6 +71,7 @@ public class BlockLimitsListener implements Listener {
ConfigurationSection limitConfig = addon.getConfig().getConfigurationSection("blocklimits"); ConfigurationSection limitConfig = addon.getConfig().getConfigurationSection("blocklimits");
defaultLimitMap = loadLimits(limitConfig); defaultLimitMap = loadLimits(limitConfig);
} }
// Load specific worlds // Load specific worlds
if (addon.getConfig().isConfigurationSection("worlds")) { if (addon.getConfig().isConfigurationSection("worlds")) {
@ -257,7 +258,11 @@ public class BlockLimitsListener implements Listener {
} }
} }
// Check default limit map // Check default limit map
if (defaultLimitMap.containsKey(m) && countMap.get(id).isAtLimit(m, defaultLimitMap.get(m))) { if (defaultLimitMap.containsKey(m)
&& countMap
.get(id)
.isAtLimit(m,
defaultLimitMap.get(m))) {
return defaultLimitMap.get(m); return defaultLimitMap.get(m);
} }
// No limit // No limit

View File

@ -24,6 +24,9 @@ public class IslandBlockCount implements DataObject {
@Expose @Expose
private Map<Material, Integer> blockCount = new HashMap<>(); private Map<Material, Integer> blockCount = new HashMap<>();
// Required for YAML database
public IslandBlockCount() {}
public IslandBlockCount(String uniqueId2) { public IslandBlockCount(String uniqueId2) {
this.uniqueId = uniqueId2; this.uniqueId = uniqueId2;
} }