mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-07 03:00:29 +01:00
Simplified some code
This commit is contained in:
parent
8631b3b5cd
commit
5648f5ea48
@ -1,5 +1,6 @@
|
|||||||
package com.songoda.skyblock.biome;
|
package com.songoda.skyblock.biome;
|
||||||
|
|
||||||
|
import com.songoda.core.compatibility.ServerVersion;
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import com.songoda.skyblock.island.IslandEnvironment;
|
import com.songoda.skyblock.island.IslandEnvironment;
|
||||||
@ -61,19 +62,19 @@ public class BiomeManager {
|
|||||||
chunkClass = NMSUtil.getNMSClass("Chunk");
|
chunkClass = NMSUtil.getNMSClass("Chunk");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player all : skyblock.getIslandManager().getPlayersAtIsland(island, IslandWorld.Normal)) {
|
for (Player player : skyblock.getIslandManager().getPlayersAtIsland(island, IslandWorld.Normal)) {
|
||||||
try {
|
try {
|
||||||
if (NMSUtil.getVersionNumber() < 9) {
|
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9)) {
|
||||||
NMSUtil.sendPacket(all,
|
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)
|
packetPlayOutMapChunkClass.getConstructor(chunkClass, boolean.class, int.class)
|
||||||
.newInstance(all.getLocation().getChunk().getClass().getMethod("getHandle")
|
.newInstance(player.getLocation().getChunk().getClass().getMethod("getHandle")
|
||||||
.invoke(chunk), true, 20));
|
.invoke(chunk), true, 20));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
NMSUtil.sendPacket(all,
|
|
||||||
packetPlayOutMapChunkClass.getConstructor(chunkClass, int.class).newInstance(all
|
|
||||||
.getLocation().getChunk().getClass().getMethod("getHandle").invoke(chunk),
|
|
||||||
65535));
|
|
||||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||||
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user