Prevent Ghost Players Caused by Plugins

Check if the player is still connected after firing event. Fixes BUKKIT-4327

By: Alex Ciuba <alexciuba@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2013-06-11 15:23:03 -04:00
parent b934e29ae6
commit a702945c70
2 changed files with 71 additions and 62 deletions

View file

@ -112,10 +112,11 @@
@Nullable @Nullable
private Vec3 startingToFallPosition; private Vec3 startingToFallPosition;
@Nullable @Nullable
@@ -259,6 +292,22 @@ @@ -258,6 +291,22 @@
private final CommandSource commandSource;
private int containerCounter; private int containerCounter;
public boolean wonGame; public boolean wonGame;
+
+ // CraftBukkit start + // CraftBukkit start
+ public CraftPlayer.TransferCookieConnection transferCookieConnection; + public CraftPlayer.TransferCookieConnection transferCookieConnection;
+ public String displayName; + public String displayName;
@ -131,10 +132,9 @@
+ public boolean sentListPacket = false; + public boolean sentListPacket = false;
+ public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent + public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
+ // CraftBukkit end + // CraftBukkit end
+
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
this.chatVisibility = ChatVisiblity.FULL;
@@ -340,6 +389,13 @@ @@ -340,6 +389,13 @@
public void sendSystemMessage(Component message) { public void sendSystemMessage(Component message) {
ServerPlayer.this.sendSystemMessage(message); ServerPlayer.this.sendSystemMessage(message);
@ -158,8 +158,8 @@
+ this.displayName = this.getScoreboardName(); + this.displayName = this.getScoreboardName();
+ this.bukkitPickUpLoot = true; + this.bukkitPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth(); + this.maxHealthCache = this.getMaxHealth();
} + }
+
+ // Use method to resend items in hands in case of client desync, because the item use got cancelled. + // Use method to resend items in hands in case of client desync, because the item use got cancelled.
+ // For example, when cancelling the leash event + // For example, when cancelling the leash event
+ public void resendItemInHands() { + public void resendItemInHands() {
@ -205,9 +205,9 @@
+ } + }
+ +
+ return blockposition; + return blockposition;
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) { public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) {
AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO); AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO);
@ -588,7 +588,7 @@
if (!this.canHarmPlayer(entityhuman1)) { if (!this.canHarmPlayer(entityhuman1)) {
return false; return false;
@@ -1088,33 +1322,58 @@ @@ -1088,33 +1322,63 @@
} }
@Override @Override
@ -646,6 +646,11 @@
+ +
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason); + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason);
+ this.level().getCraftServer().getPluginManager().callEvent(respawnEvent); + this.level().getCraftServer().getPluginManager().callEvent(respawnEvent);
+ // Spigot Start
+ if (this.connection.isDisconnected()) {
+ return null;
+ }
+ // Spigot End
+ +
+ location = respawnEvent.getRespawnLocation(); + location = respawnEvent.getRespawnLocation();
+ +
@ -654,7 +659,7 @@
} }
public static Optional<ServerPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(ServerLevel world, BlockPos pos, float spawnAngle, boolean spawnForced, boolean alive) { public static Optional<ServerPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(ServerLevel world, BlockPos pos, float spawnAngle, boolean spawnForced, boolean alive) {
@@ -1129,11 +1388,11 @@ @@ -1129,11 +1393,11 @@
} }
return optional.map((vec3d) -> { return optional.map((vec3d) -> {
@ -668,7 +673,7 @@
}); });
} else if (!spawnForced) { } else if (!spawnForced) {
return Optional.empty(); return Optional.empty();
@@ -1142,7 +1401,7 @@ @@ -1142,7 +1406,7 @@
BlockState iblockdata1 = world.getBlockState(pos.above()); BlockState iblockdata1 = world.getBlockState(pos.above());
boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1); boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1);
@ -677,7 +682,7 @@
} }
} }
@@ -1160,6 +1419,7 @@ @@ -1160,6 +1424,7 @@
@Nullable @Nullable
@Override @Override
public ServerPlayer teleport(TeleportTransition teleportTarget) { public ServerPlayer teleport(TeleportTransition teleportTarget) {
@ -685,7 +690,7 @@
if (this.isRemoved()) { if (this.isRemoved()) {
return null; return null;
} else { } else {
@@ -1169,39 +1429,73 @@ @@ -1169,39 +1434,73 @@
ServerLevel worldserver = teleportTarget.newLevel(); ServerLevel worldserver = teleportTarget.newLevel();
ServerLevel worldserver1 = this.serverLevel(); ServerLevel worldserver1 = this.serverLevel();
@ -767,7 +772,7 @@
this.connection.resetPosition(); this.connection.resetPosition();
worldserver.addDuringTeleport(this); worldserver.addDuringTeleport(this);
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@@ -1215,12 +1509,30 @@ @@ -1215,12 +1514,30 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -798,7 +803,7 @@
public void forceSetRotation(float yaw, float pitch) { public void forceSetRotation(float yaw, float pitch) {
this.connection.send(new ClientboundPlayerRotationPacket(yaw, pitch)); this.connection.send(new ClientboundPlayerRotationPacket(yaw, pitch));
} }
@@ -1228,13 +1540,21 @@ @@ -1228,13 +1545,21 @@
public void triggerDimensionChangeTriggers(ServerLevel origin) { public void triggerDimensionChangeTriggers(ServerLevel origin) {
ResourceKey<Level> resourcekey = origin.dimension(); ResourceKey<Level> resourcekey = origin.dimension();
ResourceKey<Level> resourcekey1 = this.level().dimension(); ResourceKey<Level> resourcekey1 = this.level().dimension();
@ -823,7 +828,7 @@
this.enteredNetherPosition = null; this.enteredNetherPosition = null;
} }
@@ -1251,36 +1571,63 @@ @@ -1251,36 +1576,63 @@
this.containerMenu.broadcastChanges(); this.containerMenu.broadcastChanges();
} }
@ -902,7 +907,7 @@
this.awardStat(Stats.SLEEP_IN_BED); this.awardStat(Stats.SLEEP_IN_BED);
CriteriaTriggers.SLEPT_IN_BED.trigger(this); CriteriaTriggers.SLEPT_IN_BED.trigger(this);
}); });
@@ -1293,9 +1640,8 @@ @@ -1293,9 +1645,8 @@
return either; return either;
} }
} }
@ -913,7 +918,7 @@
} }
@Override @Override
@@ -1322,13 +1668,31 @@ @@ -1322,13 +1673,31 @@
@Override @Override
public void stopSleepInBed(boolean skipSleepTimer, boolean updateSleepingPlayers) { public void stopSleepInBed(boolean skipSleepTimer, boolean updateSleepingPlayers) {
@ -946,7 +951,7 @@
} }
} }
@@ -1387,8 +1751,9 @@ @@ -1387,8 +1756,9 @@
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), front)); this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), front));
} }
@ -957,7 +962,7 @@
} }
@Override @Override
@@ -1396,13 +1761,35 @@ @@ -1396,13 +1766,35 @@
if (factory == null) { if (factory == null) {
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -993,7 +998,7 @@
if (container == null) { if (container == null) {
if (this.isSpectator()) { if (this.isSpectator()) {
this.displayClientMessage(Component.translatable("container.spectatorCantOpen").withStyle(ChatFormatting.RED), true); this.displayClientMessage(Component.translatable("container.spectatorCantOpen").withStyle(ChatFormatting.RED), true);
@@ -1410,9 +1797,11 @@ @@ -1410,9 +1802,11 @@
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -1007,7 +1012,7 @@
return OptionalInt.of(this.containerCounter); return OptionalInt.of(this.containerCounter);
} }
} }
@@ -1425,15 +1814,26 @@ @@ -1425,15 +1819,26 @@
@Override @Override
public void openHorseInventory(AbstractHorse horse, Container inventory) { public void openHorseInventory(AbstractHorse horse, Container inventory) {
@ -1036,7 +1041,7 @@
this.initMenu(this.containerMenu); this.initMenu(this.containerMenu);
} }
@@ -1456,6 +1856,7 @@ @@ -1456,6 +1861,7 @@
@Override @Override
public void closeContainer() { public void closeContainer() {
@ -1044,7 +1049,7 @@
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
this.doCloseContainer(); this.doCloseContainer();
} }
@@ -1485,19 +1886,19 @@ @@ -1485,19 +1891,19 @@
i = Math.round((float) Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) * 100.0F); i = Math.round((float) Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ) * 100.0F);
if (i > 0) { if (i > 0) {
this.awardStat(Stats.SWIM_ONE_CM, i); this.awardStat(Stats.SWIM_ONE_CM, i);
@ -1067,7 +1072,7 @@
} }
} else if (this.onClimbable()) { } else if (this.onClimbable()) {
if (deltaY > 0.0D) { if (deltaY > 0.0D) {
@@ -1508,13 +1909,13 @@ @@ -1508,13 +1914,13 @@
if (i > 0) { if (i > 0) {
if (this.isSprinting()) { if (this.isSprinting()) {
this.awardStat(Stats.SPRINT_ONE_CM, i); this.awardStat(Stats.SPRINT_ONE_CM, i);
@ -1084,7 +1089,7 @@
} }
} }
} else if (this.isFallFlying()) { } else if (this.isFallFlying()) {
@@ -1557,7 +1958,7 @@ @@ -1557,7 +1963,7 @@
@Override @Override
public void awardStat(Stat<?> stat, int amount) { public void awardStat(Stat<?> stat, int amount) {
this.stats.increment(this, stat, amount); this.stats.increment(this, stat, amount);
@ -1093,7 +1098,7 @@
scoreaccess.add(amount); scoreaccess.add(amount);
}); });
} }
@@ -1565,7 +1966,7 @@ @@ -1565,7 +1971,7 @@
@Override @Override
public void resetStat(Stat<?> stat) { public void resetStat(Stat<?> stat) {
this.stats.setValue(this, stat, 0); this.stats.setValue(this, stat, 0);
@ -1102,7 +1107,7 @@
} }
@Override @Override
@@ -1597,9 +1998,9 @@ @@ -1597,9 +2003,9 @@
super.jumpFromGround(); super.jumpFromGround();
this.awardStat(Stats.JUMP); this.awardStat(Stats.JUMP);
if (this.isSprinting()) { if (this.isSprinting()) {
@ -1114,7 +1119,7 @@
} }
} }
@@ -1625,6 +2026,7 @@ @@ -1625,6 +2031,7 @@
public void resetSentInfo() { public void resetSentInfo() {
this.lastSentHealth = -1.0E8F; this.lastSentHealth = -1.0E8F;
@ -1122,7 +1127,7 @@
} }
@Override @Override
@@ -1661,7 +2063,7 @@ @@ -1661,7 +2068,7 @@
this.onUpdateAbilities(); this.onUpdateAbilities();
if (alive) { if (alive) {
this.getAttributes().assignBaseValues(oldPlayer.getAttributes()); this.getAttributes().assignBaseValues(oldPlayer.getAttributes());
@ -1131,7 +1136,7 @@
this.setHealth(oldPlayer.getHealth()); this.setHealth(oldPlayer.getHealth());
this.foodData = oldPlayer.foodData; this.foodData = oldPlayer.foodData;
Iterator iterator = oldPlayer.getActiveEffects().iterator(); Iterator iterator = oldPlayer.getActiveEffects().iterator();
@@ -1669,7 +2071,7 @@ @@ -1669,7 +2076,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
@ -1140,7 +1145,7 @@
} }
this.getInventory().replaceWith(oldPlayer.getInventory()); this.getInventory().replaceWith(oldPlayer.getInventory());
@@ -1680,7 +2082,7 @@ @@ -1680,7 +2087,7 @@
this.portalProcess = oldPlayer.portalProcess; this.portalProcess = oldPlayer.portalProcess;
} else { } else {
this.getAttributes().assignBaseValues(oldPlayer.getAttributes()); this.getAttributes().assignBaseValues(oldPlayer.getAttributes());
@ -1149,7 +1154,7 @@
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || oldPlayer.isSpectator()) { if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || oldPlayer.isSpectator()) {
this.getInventory().replaceWith(oldPlayer.getInventory()); this.getInventory().replaceWith(oldPlayer.getInventory());
this.experienceLevel = oldPlayer.experienceLevel; this.experienceLevel = oldPlayer.experienceLevel;
@@ -1696,7 +2098,7 @@ @@ -1696,7 +2103,7 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -1158,7 +1163,7 @@
this.seenCredits = oldPlayer.seenCredits; this.seenCredits = oldPlayer.seenCredits;
this.enteredNetherPosition = oldPlayer.enteredNetherPosition; this.enteredNetherPosition = oldPlayer.enteredNetherPosition;
this.chunkTrackingView = oldPlayer.chunkTrackingView; this.chunkTrackingView = oldPlayer.chunkTrackingView;
@@ -1752,19 +2154,19 @@ @@ -1752,19 +2159,19 @@
} }
@Override @Override
@ -1182,7 +1187,7 @@
} }
return flag1; return flag1;
@@ -1878,6 +2280,16 @@ @@ -1878,6 +2285,16 @@
} }
public void updateOptions(ClientInformation clientOptions) { public void updateOptions(ClientInformation clientOptions) {
@ -1199,7 +1204,7 @@
this.language = clientOptions.language(); this.language = clientOptions.language();
this.requestedViewDistance = clientOptions.viewDistance(); this.requestedViewDistance = clientOptions.viewDistance();
this.chatVisibility = clientOptions.chatVisibility(); this.chatVisibility = clientOptions.chatVisibility();
@@ -1962,7 +2374,7 @@ @@ -1962,7 +2379,7 @@
if (world instanceof ServerLevel) { if (world instanceof ServerLevel) {
ServerLevel worldserver = (ServerLevel) world; ServerLevel worldserver = (ServerLevel) world;
@ -1208,7 +1213,7 @@
} }
if (entity != null) { if (entity != null) {
@@ -1999,11 +2411,11 @@ @@ -1999,11 +2416,11 @@
@Nullable @Nullable
public Component getTabListDisplayName() { public Component getTabListDisplayName() {
@ -1222,7 +1227,7 @@
} }
@Override @Override
@@ -2046,17 +2458,43 @@ @@ -2046,17 +2463,43 @@
} }
public void setRespawnPosition(ResourceKey<Level> dimension, @Nullable BlockPos pos, float angle, boolean forced, boolean sendMessage) { public void setRespawnPosition(ResourceKey<Level> dimension, @Nullable BlockPos pos, float angle, boolean forced, boolean sendMessage) {
@ -1273,7 +1278,7 @@
} else { } else {
this.respawnPosition = null; this.respawnPosition = null;
this.respawnDimension = Level.OVERWORLD; this.respawnDimension = Level.OVERWORLD;
@@ -2088,18 +2526,44 @@ @@ -2088,18 +2531,44 @@
} }
@Override @Override
@ -1322,7 +1327,7 @@
} }
this.awardStat(Stats.DROP); this.awardStat(Stats.DROP);
@@ -2375,16 +2839,160 @@ @@ -2375,16 +2844,160 @@
return TicketType.ENDER_PEARL.timeout(); return TicketType.ENDER_PEARL.timeout();
} }
@ -1355,8 +1360,8 @@
+ } else { + } else {
+ // Adds timeOffset to the beginning of this day. + // Adds timeOffset to the beginning of this day.
+ return this.level().getDayTime() - (this.level().getDayTime() % 24000) + this.timeOffset; + return this.level().getDayTime() - (this.level().getDayTime() % 24000) + this.timeOffset;
+ } }
+ } }
+ +
+ public WeatherType weather = null; + public WeatherType weather = null;
+ +
@ -1394,7 +1399,7 @@
+ if (this.pluginRainPositionPrevious != this.pluginRainPosition) { + if (this.pluginRainPositionPrevious != this.pluginRainPosition) {
+ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.RAIN_LEVEL_CHANGE, this.pluginRainPosition)); + this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.RAIN_LEVEL_CHANGE, this.pluginRainPosition));
+ } + }
} + }
+ +
+ if (oldThunder != newThunder) { + if (oldThunder != newThunder) {
+ if (this.weather == WeatherType.DOWNFALL || this.weather == null) { + if (this.weather == WeatherType.DOWNFALL || this.weather == null) {
@ -1403,7 +1408,7 @@
+ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, 0)); + this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.THUNDER_LEVEL_CHANGE, 0));
+ } + }
+ } + }
} + }
+ +
+ public void tickWeather() { + public void tickWeather() {
+ if (this.weather == null) return; + if (this.weather == null) return;

View file

@ -460,11 +460,10 @@
} }
- return ichatmutablecomponent; - return ichatmutablecomponent;
- } else {
- return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(profile) ? Component.translatable("multiplayer.disconnect.server_full") : null;
+ // return chatmessage; + // return chatmessage;
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent));
+ } else { } else {
- return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(profile) ? Component.translatable("multiplayer.disconnect.server_full") : null;
+ // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; + // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;
+ if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) { + if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) {
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot + event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot
@ -574,7 +573,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
String s = (String) iterator.next(); String s = (String) iterator.next();
@@ -462,41 +662,81 @@ @@ -462,41 +662,86 @@
entityplayer1.addTag(s); entityplayer1.addTag(s);
} }
@ -587,6 +586,11 @@
+ } else { + } else {
+ teleporttransition = new TeleportTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING); + teleporttransition = new TeleportTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING);
+ } + }
+ // Spigot Start
+ if (teleporttransition == null) {
+ return entityplayer;
+ }
+ // Spigot End
+ ServerLevel worldserver = teleporttransition.newLevel(); + ServerLevel worldserver = teleporttransition.newLevel();
+ entityplayer1.spawnIn(worldserver); + entityplayer1.spawnIn(worldserver);
+ entityplayer1.unsetRemoved(); + entityplayer1.unsetRemoved();
@ -664,7 +668,7 @@
return entityplayer1; return entityplayer1;
} }
@@ -524,7 +764,18 @@ @@ -524,7 +769,18 @@
public void tick() { public void tick() {
if (++this.sendAllPlayerInfoIn > 600) { if (++this.sendAllPlayerInfoIn > 600) {
@ -684,7 +688,7 @@
this.sendAllPlayerInfoIn = 0; this.sendAllPlayerInfoIn = 0;
} }
@@ -541,6 +792,25 @@ @@ -541,6 +797,25 @@
} }
@ -710,7 +714,7 @@
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) { public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
@@ -554,7 +824,7 @@ @@ -554,7 +829,7 @@
} }
@ -719,7 +723,7 @@
PlayerTeam scoreboardteam = source.getTeam(); PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam != null) { if (scoreboardteam != null) {
@@ -573,7 +843,7 @@ @@ -573,7 +848,7 @@
} }
} }
@ -728,7 +732,7 @@
PlayerTeam scoreboardteam = source.getTeam(); PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam == null) { if (scoreboardteam == null) {
@@ -619,7 +889,7 @@ @@ -619,7 +894,7 @@
} }
public void deop(GameProfile profile) { public void deop(GameProfile profile) {
@ -737,7 +741,7 @@
ServerPlayer entityplayer = this.getPlayer(profile.getId()); ServerPlayer entityplayer = this.getPlayer(profile.getId());
if (entityplayer != null) { if (entityplayer != null) {
@@ -643,6 +913,7 @@ @@ -643,6 +918,7 @@
player.connection.send(new ClientboundEntityEventPacket(player, b0)); player.connection.send(new ClientboundEntityEventPacket(player, b0));
} }
@ -745,7 +749,7 @@
this.server.getCommands().sendCommands(player); this.server.getCommands().sendCommands(player);
} }
@@ -669,10 +940,16 @@ @@ -669,10 +945,16 @@
return null; return null;
} }
@ -763,7 +767,7 @@
if (entityplayer != player && entityplayer.level().dimension() == worldKey) { if (entityplayer != player && entityplayer.level().dimension() == worldKey) {
double d4 = x - entityplayer.getX(); double d4 = x - entityplayer.getX();
double d5 = y - entityplayer.getY(); double d5 = y - entityplayer.getY();
@@ -712,15 +989,19 @@ @@ -712,15 +994,19 @@
public void reloadWhiteList() {} public void reloadWhiteList() {}
public void sendLevelInfo(ServerPlayer player, ServerLevel world) { public void sendLevelInfo(ServerPlayer player, ServerLevel world) {
@ -787,7 +791,7 @@
} }
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F)); player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
@@ -729,8 +1010,16 @@ @@ -729,8 +1015,16 @@
public void sendAllPlayerInfo(ServerPlayer player) { public void sendAllPlayerInfo(ServerPlayer player) {
player.inventoryMenu.sendAllDataToRemote(); player.inventoryMenu.sendAllDataToRemote();
@ -805,7 +809,7 @@
} }
public int getPlayerCount() { public int getPlayerCount() {
@@ -786,12 +1075,22 @@ @@ -786,12 +1080,22 @@
} }
public void removeAll() { public void removeAll() {
@ -830,7 +834,7 @@
public void broadcastSystemMessage(Component message, boolean overlay) { public void broadcastSystemMessage(Component message, boolean overlay) {
this.broadcastSystemMessage(message, (entityplayer) -> { this.broadcastSystemMessage(message, (entityplayer) -> {
return message; return message;
@@ -849,16 +1148,23 @@ @@ -849,16 +1153,23 @@
return message.hasSignature() && !message.hasExpiredServer(Instant.now()); return message.hasSignature() && !message.hasExpiredServer(Instant.now());
} }
@ -858,7 +862,7 @@
Path path = file2.toPath(); Path path = file2.toPath();
if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) { if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -867,7 +1173,7 @@ @@ -867,7 +1178,7 @@
} }
serverstatisticmanager = new ServerStatsCounter(this.server, file1); serverstatisticmanager = new ServerStatsCounter(this.server, file1);
@ -867,7 +871,7 @@
} }
return serverstatisticmanager; return serverstatisticmanager;
@@ -875,13 +1181,13 @@ @@ -875,13 +1186,13 @@
public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) { public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) {
UUID uuid = player.getUUID(); UUID uuid = player.getUUID();
@ -883,7 +887,7 @@
} }
advancementdataplayer.setPlayer(player); advancementdataplayer.setPlayer(player);
@@ -932,15 +1238,28 @@ @@ -932,15 +1243,28 @@
} }
public void reloadResources() { public void reloadResources() {