Skip to content

Commit 438ff3f

Browse files
committed
Temp revert
1 parent 0f7eeee commit 438ff3f

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/main/java/systems/kscott/randomspawnplus/spawn/SpawnFinder.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package systems.kscott.randomspawnplus.spawn;
22

3-
import io.papermc.lib.PaperLib;
4-
import org.bukkit.*;
3+
import org.bukkit.Bukkit;
4+
import org.bukkit.Location;
5+
import org.bukkit.Material;
6+
import org.bukkit.World;
57
import org.bukkit.block.Block;
68
import org.bukkit.configuration.file.FileConfiguration;
79
import systems.kscott.randomspawnplus.RandomSpawnPlus;
@@ -14,8 +16,6 @@
1416
import java.util.ArrayList;
1517
import java.util.List;
1618
import java.util.Random;
17-
import java.util.concurrent.CompletableFuture;
18-
import java.util.concurrent.ExecutionException;
1919

2020
public class SpawnFinder {
2121

@@ -173,20 +173,18 @@ public boolean checkSpawn(Location location) {
173173

174174
Location locClone = location.clone();
175175

176-
Chunk chunk;
177-
178-
CompletableFuture<Chunk> chunkCompletableFuture = PaperLib.getChunkAtAsync(location);
179-
180-
try {
181-
chunk = chunkCompletableFuture.get();
182-
} catch (InterruptedException | ExecutionException e) {
183-
e.printStackTrace();
176+
if (locClone == null) {
184177
return false;
185178
}
179+
// 89apt89 start - Fix Paper method use
180+
if (!location.getChunk().isLoaded()) {
181+
location.getChunk().load();
182+
}
183+
// 89apt89 end
186184

187-
Block block0 = chunk.getBlock(locClone.getBlockX() & 0xF, locClone.getBlockY() & 0xF, locClone.getBlockZ() & 0xF);
188-
Block block1 = chunk.getBlock(locClone.getBlockX() & 0xF, locClone.getBlockY() + 1 & 0xF, locClone.getBlockZ() & 0xF);
189-
Block block2 = chunk.getBlock(locClone.getBlockX() & 0xF, locClone.getBlockY() + 2 & 0xF, locClone.getBlockZ() & 0xF);
185+
Block block0 = locClone.getBlock();
186+
Block block1 = locClone.add(0, 1, 0).getBlock();
187+
Block block2 = locClone.add(0, 1, 0).getBlock();
190188

191189
if (block0 == null || block1 == null || block2 == null) {
192190
return false;

0 commit comments

Comments
 (0)