use of net.minecraft.server.network.ServerPlayerConnection in project Denizen-For-Bukkit by DenizenScript.
the class EntityHelperImpl method getPlayersThatSee.
@Override
public List<Player> getPlayersThatSee(Entity entity) {
ChunkMap tracker = ((ServerLevel) ((CraftEntity) entity).getHandle().level).getChunkSource().chunkMap;
ChunkMap.TrackedEntity entityTracker = tracker.entityMap.get(entity.getEntityId());
ArrayList<Player> output = new ArrayList<>();
if (entityTracker == null) {
return output;
}
for (ServerPlayerConnection player : entityTracker.seenBy) {
output.add(player.getPlayer().getBukkitEntity());
}
return output;
}
use of net.minecraft.server.network.ServerPlayerConnection in project Denizen-For-Bukkit by DenizenScript.
the class EntityHelperImpl method getPlayersThatSee.
@Override
public List<Player> getPlayersThatSee(Entity entity) {
ChunkMap tracker = ((ServerLevel) ((CraftEntity) entity).getHandle().level).getChunkProvider().chunkMap;
ChunkMap.TrackedEntity entityTracker = tracker.G.get(entity.getEntityId());
ArrayList<Player> output = new ArrayList<>();
if (entityTracker == null) {
return output;
}
for (ServerPlayerConnection player : entityTracker.seenBy) {
output.add(player.getPlayer().getBukkitEntity());
}
return output;
}
use of net.minecraft.server.network.ServerPlayerConnection in project Denizen-For-Bukkit by DenizenScript.
the class DenizenNetworkManagerImpl method enableNetworkManager.
public static void enableNetworkManager() {
for (World w : Bukkit.getWorlds()) {
for (ChunkMap.TrackedEntity tracker : ((CraftWorld) w).getHandle().getChunkSource().chunkMap.entityMap.values()) {
ArrayList<ServerPlayerConnection> connections = new ArrayList<>(tracker.seenBy);
tracker.seenBy.clear();
for (ServerPlayerConnection connection : connections) {
tracker.seenBy.add(connection.getPlayer().connection);
}
}
}
}
Aggregations