-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor
-
None
-
Affects Version/s: None
-
Environment:
Mac OS 10.14.5
MacBook Pro (15-inch, 2017)
java version "11.0.1" 2018-10-16 LTS
-
This server is running CraftBukkit version git-Spigot-df0eb25-f2757f9 (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT)
-
Test plugin.
-
Yes
A few World.class methods never return, and freeze the threads they're being called on.
The methods I couldn't use:
public boolean isChunkGenerated(int x, int z); public boolean isChunkLoaded(int x, int z); public Biome getBiome(int x, int z);
This is a snippet of code I used to make sure that those methods are at fault.
package com.dan.NextWorldGenerator; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.craftbukkit.libs.org.apache.commons.lang3.Validate; import org.bukkit.generator.BlockPopulator; import java.util.Random; public class ObjectPopulator extends BlockPopulator { private TerrainPopulator terrainPopulator; public ObjectPopulator(TerrainPopulator terrainPopulator) { Validate.notNull(terrainPopulator); this.terrainPopulator = terrainPopulator; } @Override public void populate(World world, Random rand, Chunk chunk) { System.out.println("Before method attempt..."); world.isChunkGenerated(chunk.getX() + 5, chunk.getZ() - 5); System.out.println("After method attempt."); // terrainPopulator.generateObjects(world, chunk.getX(), chunk.getZ()); } }
I also have this inside the main class of the plugin:
@Override public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { Validate.notNull(worldName); return new TerrainGenerator( futureHandler, new ProcessTimer("ChunkGenerator", getLogger()), terrainPopulator, true); }
And this inside the TerrainGenerator class:
@Override public List<BlockPopulator> getDefaultPopulators(World world) { Validate.notNull(world); List<BlockPopulator> populators = new ArrayList<>(1); populators.add(new ObjectPopulator(terrainPopulator)); return populators; }
When I remove that method from the class the terrain generates properly.
I included a test plugin to demonstrate the issue. To trigger the bug:
- delete the world folder from your server
- place the plugin jar inside plugins
- add these lines at the end of bukkit.yml:
worlds: world: generator: WorldsMethodsBugExample
4. start the server
5. log in and move a little bit around the world
- duplicates
-
SPIGOT-4849 Spigot crashes running custom ChunkGenerators
- Resolved