Fixed LootPopulator
This commit is contained in:
@@ -127,9 +127,17 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
|
||||
*/
|
||||
@Override
|
||||
public void postLoad() {
|
||||
Bukkit.getServer().getWorlds().forEach(world -> {
|
||||
world.getPopulators().add(new LootPopulator(this));
|
||||
});
|
||||
if (this.getConfigYml().getBool("loot.enabled")) {
|
||||
Bukkit.getServer().getWorlds().forEach(world -> {
|
||||
List<BlockPopulator> populators = new ArrayList<>(world.getPopulators());
|
||||
populators.forEach((blockPopulator -> {
|
||||
if (blockPopulator instanceof LootPopulator) {
|
||||
world.getPopulators().remove(blockPopulator);
|
||||
}
|
||||
}));
|
||||
world.getPopulators().add(new LootPopulator(this));
|
||||
});
|
||||
}
|
||||
EssentialsManager.registerEnchantments();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,10 +51,6 @@ public class LootPopulator extends BlockPopulator {
|
||||
public void populate(@NotNull final World world,
|
||||
@NotNull final Random random,
|
||||
@NotNull final Chunk chunk) {
|
||||
if (!plugin.getConfigYml().getBool("loot.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockState state : chunk.getTileEntities()) {
|
||||
Block block = state.getBlock();
|
||||
if (!(block.getState() instanceof Chest)) {
|
||||
|
||||
Reference in New Issue
Block a user