Simplified some code

This commit is contained in:
Fabrizio La Rosa 2020-06-23 18:00:24 +02:00
parent 8631b3b5cd
commit 5648f5ea48
2 changed files with 10 additions and 27 deletions

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.biome;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandEnvironment;
@ -61,19 +62,19 @@ public class BiomeManager {
chunkClass = NMSUtil.getNMSClass("Chunk");
}
for (Player all : skyblock.getIslandManager().getPlayersAtIsland(island, IslandWorld.Normal)) {
for (Player player : skyblock.getIslandManager().getPlayersAtIsland(island, IslandWorld.Normal)) {
try {
if (NMSUtil.getVersionNumber() < 9) {
NMSUtil.sendPacket(all,
packetPlayOutMapChunkClass.getConstructor(chunkClass, boolean.class, int.class)
.newInstance(all.getLocation().getChunk().getClass().getMethod("getHandle")
.invoke(chunk), true, 20));
return;
}
NMSUtil.sendPacket(all,
packetPlayOutMapChunkClass.getConstructor(chunkClass, int.class).newInstance(all
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
NMSUtil.sendPacket(player,
packetPlayOutMapChunkClass.getConstructor(chunkClass, int.class).newInstance(player
.getLocation().getChunk().getClass().getMethod("getHandle").invoke(chunk),
65535));
} else {
NMSUtil.sendPacket(player,
packetPlayOutMapChunkClass.getConstructor(chunkClass, boolean.class, int.class)
.newInstance(player.getLocation().getChunk().getClass().getMethod("getHandle")
.invoke(chunk), true, 20));
}
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();

View File

@ -673,24 +673,6 @@ public class IslandManager {
});
});
}
/*new ChunkLoader(island, IslandWorld.Normal, skyblock.isPaperAsync(), (asyncPositions, syncPositions) -> {
if(skyblock.isPaperAsync()){
Bukkit.getScheduler().runTaskAsynchronously(skyblock, () -> {
List<Chunk> positions = new LinkedList<>();
for (CompletableFuture<Chunk> chunk : asyncPositions) {
positions.add(chunk.join());
}
snapshots.put(world, positions.stream().map(Chunk::getChunkSnapshot).collect(Collectors.toList()));
ChunkDeleteSplitter.startDeletion(snapshots);
});
} else {
final List<ChunkSnapshot> list = syncPositions.stream().map(Chunk::getChunkSnapshot).collect(Collectors.toList());
snapshots.put(world, list);
ChunkDeleteSplitter.startDeletion(snapshots);
}
});*/
}
}