Fixed LootPopulator

This commit is contained in:
Auxilor 2021-03-02 12:54:57 +00:00
parent 77b27bb00d
commit 5c2d6b959f
2 changed files with 11 additions and 7 deletions

View File

@ -127,9 +127,17 @@ public class EcoEnchantsPlugin extends AbstractEcoPlugin {
*/
@Override
public void postLoad() {
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();
}

View File

@ -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)) {