mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-24 00:41:23 +01:00
Fixed LootPopulator
This commit is contained in:
parent
77b27bb00d
commit
5c2d6b959f
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user