Skip to content

Commit a1ed007

Browse files
committed
Remove double line.
1 parent d732398 commit a1ed007

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/main/java/world/bentobox/stranger/listeners/NetherChunkMaker.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class NetherChunkMaker implements Listener {
6868
private static final Set<Material> NETHER_STRUCTURE_BLOCKS = Set.of(Material.NETHER_BRICKS, Material.NETHER_BRICK_FENCE,
6969
Material.NETHER_BRICK_SLAB, Material.NETHER_BRICK_STAIRS, Material.NETHER_BRICK_WALL, Material.CHISELED_NETHER_BRICKS
7070
, Material.CRACKED_NETHER_BRICKS, Material.BONE_BLOCK, Material.SPAWNER, Material.CHEST);
71-
7271
// Overworld Biome -> Nether Biome
7372
public static final Map<Biome, Biome> BIOME_MAPPING;
7473
static {
@@ -180,7 +179,7 @@ public void onNetherPortalEnter(EntityPortalEnterEvent e) {
180179
* @param e The event triggered
181180
*/
182181
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
183-
public void onNetherPortalExit(PlayerChangedWorldEvent e) {
182+
public void onNetherEnterViaTeleport(PlayerChangedWorldEvent e) {
184183
if (addon.inWorld(e.getPlayer().getWorld()) && e.getPlayer().getWorld().getEnvironment() == Environment.NETHER) {
185184
User.getInstance(e.getPlayer()).notify(addon.getNetherWorld(), "stranger.nether.welcome");
186185
}
@@ -245,14 +244,15 @@ public void onChunkLoad(ChunkLoadEvent e) {
245244
}
246245

247246
handler.saveObjectAsync(netherChunksMade); // Save to database
248-
clearTileEntities(e); // Clear tile entities in the chunk
249-
clearEntities(e); // Clear entities in the chunk
247+
Chunk chunk = e.getChunk();
248+
clearTileEntities(chunk); // Clear tile entities in the chunk
249+
clearEntities(chunk); // Clear entities in the chunk
250250
// Get the overworld chunk async
251-
Util.getChunkAtAsync(addon.getOverWorld(), e.getChunk().getX(), e.getChunk().getZ()).thenRun(() -> {
252-
convertBlocks(e);
253-
convertBlocks(e); // Convert blocks from overworld to Nether
254-
spawnNetherEntities(e); // Spawn Nether entities
251+
Util.getChunkAtAsync(addon.getOverWorld(), chunk.getX(), chunk.getZ()).thenRun(() -> {
252+
convertBlocks(chunk); // Convert blocks from overworld to Nether
253+
spawnNetherEntities(chunk); // Spawn Nether entities
255254
});
255+
256256
}
257257

258258
/**
@@ -270,33 +270,33 @@ private boolean isValidChunkLoadEvent(ChunkLoadEvent e) {
270270
/**
271271
* Clears tile entities in the loaded chunk that are below the roof height.
272272
*
273-
* @param e The chunk load event.
273+
* @param chunk The chunk.
274274
*/
275-
private void clearTileEntities(ChunkLoadEvent e) {
276-
Arrays.stream(e.getChunk().getTileEntities())
275+
private void clearTileEntities(Chunk chunk) {
276+
Arrays.stream(chunk.getTileEntities())
277277
.filter(en -> en.getLocation().getBlockY() < ROOF_HEIGHT && en instanceof InventoryHolder)
278278
.forEach(tileEntity -> ((InventoryHolder) tileEntity).getInventory().clear());
279279
}
280280

281281
/**
282282
* Clears entities in the loaded chunk that are below the roof height.
283283
*
284-
* @param e The chunk load event.
284+
* @param chunk The chunk.
285285
*/
286-
private void clearEntities(ChunkLoadEvent e) {
287-
Arrays.stream(e.getChunk().getEntities())
286+
private void clearEntities(Chunk chunk) {
287+
Arrays.stream(chunk.getEntities())
288288
.filter(en -> en.getType() != EntityType.PLAYER && en.getLocation().getBlockY() < ROOF_HEIGHT)
289289
.forEach(Entity::remove);
290290
}
291291

292292
/**
293293
* Converts blocks in the loaded chunk from overworld to Nether equivalents.
294294
*
295-
* @param e The chunk load event.
295+
* @param chunk The chunk
296296
*/
297-
private void convertBlocks(ChunkLoadEvent e) {
297+
private void convertBlocks(Chunk chunk) {
298298
// Get the overworld chunk we are copying from
299-
Chunk overworldChunk = addon.getOverWorld().getChunkAt(e.getChunk().getX(), e.getChunk().getZ());
299+
Chunk overworldChunk = addon.getOverWorld().getChunkAt(chunk.getX(), chunk.getZ());
300300
// Determine the attrition
301301
int rawAttritionValue = addon.getSettings().getAttrition();
302302
double attrition = (rawAttritionValue >= 0 && rawAttritionValue <= 100)
@@ -307,25 +307,25 @@ private void convertBlocks(ChunkLoadEvent e) {
307307

308308
// Check for structures
309309
List<BoundingBox> structures = new ArrayList<>();
310-
e.getChunk().getStructures().forEach(gs -> structures.add(gs.getBoundingBox()));
310+
chunk.getStructures().forEach(gs -> structures.add(gs.getBoundingBox()));
311311
// Loop through the chunk and set blocks
312-
for (int y = e.getWorld().getMinHeight() + NETHER_FLOOR; y < ROOF_HEIGHT; y++) {
312+
for (int y = chunk.getWorld().getMinHeight() + NETHER_FLOOR; y < ROOF_HEIGHT; y++) {
313313
for (int x = 0; x < 16; x++) {
314314
for (int z = 0; z < 16; z++) {
315-
if (y == e.getWorld().getMinHeight() + NETHER_FLOOR) {
315+
if (y == chunk.getWorld().getMinHeight() + NETHER_FLOOR) {
316316
// Bleed some netherrack into the deep dark
317317
for (int bleed = y - rand.nextInt(5); bleed < y; bleed++ ) {
318-
e.getChunk().getBlock(x, bleed, z).setType(Material.NETHERRACK, false);
318+
chunk.getBlock(x, bleed, z).setType(Material.NETHERRACK, false);
319319
}
320320
}
321321
Block overworldBlock = overworldChunk.getBlock(x, y, z);
322-
Block newBlock = e.getChunk().getBlock(x, y, z);
322+
Block newBlock = chunk.getBlock(x, y, z);
323323
newBlock.setBiome(BIOME_MAPPING.getOrDefault(overworldBlock.getBiome(), Biome.NETHER_WASTES)); // Set biome for the new block
324324
// Skip if the block should not be converted
325325
if (overworldBlock.getType() == newBlock.getType()
326326
|| newBlock.getType() == Material.NETHER_PORTAL // We must not touch these otherwise errors occur
327327
|| y > CEILING_START && rand.nextDouble() < attrition
328-
|| (inStructure(e.getChunk().getX(), e.getChunk().getZ(), x, y, z, structures)
328+
|| (inStructure(chunk.getX(), chunk.getZ(), x, y, z, structures)
329329
&& NETHER_STRUCTURE_BLOCKS.contains(newBlock.getType()))) {
330330
continue; // Skip if the block types are the same or if conditions are met
331331
}
@@ -366,7 +366,7 @@ private void convertBlocks(ChunkLoadEvent e) {
366366
}
367367
break;
368368
case NETHER_PORTAL:
369-
if (e.getChunk().getBlock(x, y, z).getType() == Material.NETHER_PORTAL) {
369+
if (chunk.getBlock(x, y, z).getType() == Material.NETHER_PORTAL) {
370370
newBlockData = Material.NETHER_PORTAL.createBlockData();
371371
} else {
372372
newBlockData = Material.AIR.createBlockData();
@@ -473,7 +473,7 @@ private void convertBlocks(ChunkLoadEvent e) {
473473
break;
474474
}
475475
}
476-
476+
477477
// Apply the new BlockData to the shadow world chunk
478478
newBlock.setBlockData(newBlockData, false);
479479

@@ -678,11 +678,11 @@ private void populateChest(Block overworldBlock, BlockData bd, Chest chest, Bloc
678678
/**
679679
* Spawns Nether entities based on the entities present in the loaded chunk.
680680
*
681-
* @param e The chunk load event.
681+
* @param chunk The chunk
682682
*/
683-
private void spawnNetherEntities(ChunkLoadEvent e) {
683+
private void spawnNetherEntities(Chunk chunk) {
684684
// Now do Mobs
685-
Arrays.stream(e.getChunk().getEntities())
685+
Arrays.stream(chunk.getEntities())
686686
.filter(en -> en instanceof LivingEntity)
687687
.forEach(en -> {
688688
EntityType newType = getNetherEnt(en.getType());

0 commit comments

Comments
 (0)