Some more cleanup

This commit is contained in:
Bjarne Koll 2024-12-21 16:03:29 +01:00
parent 70ef43b8dd
commit 286e3468d7
No known key found for this signature in database
GPG key ID: 9576DAF3FDDB088F
3 changed files with 12 additions and 17 deletions

View file

@ -27976,10 +27976,10 @@ index 4eb040006f5d41b47e5ac9df5d9f19c4315d6343..7fa41dea184b01891f45d8e404bc1cba
this.generatingStep = generatingStep;
this.cache = cache;
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 3d5d84c1c1d431e9b369aa727ab0876f90ff5d61..6abe5fd39583663af0feb98607cff75c42d96729 100644
index ff0315cffdb282fdc0a1ffd15e2954caa76835c9..5e94dd9e26aa4fd6545dbaae2ae0cb51cb6f13e0 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -1317,7 +1317,7 @@ public abstract class PlayerList {
@@ -1312,7 +1312,7 @@ public abstract class PlayerList {
public void setViewDistance(int viewDistance) {
this.viewDistance = viewDistance;
@ -27988,7 +27988,7 @@ index 3d5d84c1c1d431e9b369aa727ab0876f90ff5d61..6abe5fd39583663af0feb98607cff75c
for (ServerLevel serverLevel : this.server.getAllLevels()) {
if (serverLevel != null) {
@@ -1328,7 +1328,7 @@ public abstract class PlayerList {
@@ -1323,7 +1323,7 @@ public abstract class PlayerList {
public void setSimulationDistance(int simulationDistance) {
this.simulationDistance = simulationDistance;

View file

@ -95,7 +95,7 @@ index e61fe83479f095e8addbd3e8f1d5179c998ae1eb..0a7e5106a1d39150326e7c323030df5d
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
private static final int FLY_STAT_RECORDING_SPEED = 25;
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 6abe5fd39583663af0feb98607cff75c42d96729..65c16eddff43c875be72b08f61d6f321a6876a48 100644
index 5e94dd9e26aa4fd6545dbaae2ae0cb51cb6f13e0..03feaf0adb8ee87e33744a4615dc2507a02f92d7 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -482,6 +482,7 @@ public abstract class PlayerList {
@ -106,7 +106,7 @@ index 6abe5fd39583663af0feb98607cff75c42d96729..65c16eddff43c875be72b08f61d6f321
this.playerIo.save(player);
ServerStatsCounter serverStatsCounter = player.getStats(); // CraftBukkit
if (serverStatsCounter != null) {
@@ -1069,9 +1070,23 @@ public abstract class PlayerList {
@@ -1064,9 +1065,23 @@ public abstract class PlayerList {
}
public void saveAll() {

View file

@ -450,12 +450,12 @@
+ // this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID())));
+ ClientboundPlayerInfoRemovePacket packet = new ClientboundPlayerInfoRemovePacket(List.of(player.getUUID()));
+ for (int i = 0; i < this.players.size(); i++) {
+ ServerPlayer entityplayer2 = (ServerPlayer) this.players.get(i);
+ ServerPlayer otherPlayer = (ServerPlayer) this.players.get(i);
+
+ if (entityplayer2.getBukkitEntity().canSee(player.getBukkitEntity())) {
+ entityplayer2.connection.send(packet);
+ if (otherPlayer.getBukkitEntity().canSee(player.getBukkitEntity())) {
+ otherPlayer.connection.send(packet);
+ } else {
+ entityplayer2.getBukkitEntity().onEntityRemove(player);
+ otherPlayer.getBukkitEntity().onEntityRemove(player);
+ }
+ }
+ // This removes the scoreboard (and player reference) for the specific player in the manager
@ -758,7 +758,7 @@
return serverPlayer;
}
@@ -482,24 +_,65 @@
@@ -482,24 +_,60 @@
}
public void sendActiveEffects(LivingEntity entity, ServerGamePacketListenerImpl connection) {
@ -791,14 +791,9 @@
- this.broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), this.players));
+ // CraftBukkit start
+ for (int i = 0; i < this.players.size(); ++i) {
+ final ServerPlayer target = (ServerPlayer) this.players.get(i);
+ final ServerPlayer target = this.players.get(i);
+
+ target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), this.players.stream().filter(new Predicate<ServerPlayer>() {
+ @Override
+ public boolean test(ServerPlayer input) {
+ return target.getBukkitEntity().canSee(input.getBukkitEntity());
+ }
+ }).collect(java.util.stream.Collectors.toList())));
+ target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY), com.google.common.collect.Collections2.filter(this.players, t -> target.getBukkitEntity().canSee(t.getBukkitEntity()))));
+ }
+ // CraftBukkit end
this.sendAllPlayerInfoIn = 0;