Fix a bunch of vanilla bugs

https://bugs.mojang.com/browse/MC-253721
  wrong msg for opping multiple players

https://bugs.mojang.com/browse/MC-248588
  respect mob griefing gamerule for draining water cauldrons

https://bugs.mojang.com/browse/MC-244739
  play goat eating sound for last item in stack

https://bugs.mojang.com/browse/MC-243057
  ignore furnace fuel slot in recipe book click

https://bugs.mojang.com/browse/MC-147659
  Some witch huts spawn the incorrect cat
  Note: Marked as Won't Fix, makes 0 sense

https://bugs.mojang.com/browse/MC-179072
  Creepers do not defuse when switching from Survival to Creative/Spectator

https://bugs.mojang.com/browse/MC-259571
  Fix changeGameModeForPlayer to use gameModeForPlayer

https://bugs.mojang.com/browse/MC-262422
  Fix lightning being able to hit spectators

https://bugs.mojang.com/browse/MC-263999
  Fix mobs breaking doors not spawning block break particles

https://bugs.mojang.com/browse/MC-210802
  Fixes sheep eating blocks outside of ticking range

https://bugs.mojang.com/browse/MC-123848
  Fixes item frames dropping items above when pointing down

https://bugs.mojang.com/browse/MC-174630
  Fix secondary beacon effect remaining after switching effect

https://bugs.mojang.com/browse/MC-153086
  Fix the beacon deactivation sound always playing when broken

https://bugs.mojang.com/browse/MC-200092
  Fix yaw being ignored for a player's first spawn pos

https://bugs.mojang.com/browse/MC-158900
  Fix error when joining after tempban expired

https://bugs.mojang.com/browse/MC-99075
  Fix inventory desync within spawn protected area

https://bugs.mojang.com/browse/MC-273635
  Fix TrialSpawner forgets assigned mob when placed by player

== AT ==
public net/minecraft/world/entity/Mob leashInfoTag
public net/minecraft/server/level/ChunkMap anyPlayerCloseEnoughForSpawning(Lnet/minecraft/world/level/ChunkPos;)Z

Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Jake Potrebic
2022-07-11 11:56:41 -07:00
parent 492ebf1459
commit 0b9ef3701e
20 changed files with 256 additions and 83 deletions

View File

@@ -180,7 +180,7 @@
+ }
+ if (optional.isEmpty() || invalidPlayerWorld[0]) {
+ // Paper end - reset to main world spawn if first spawn or invalid world
+ player.moveTo(player.adjustSpawnLocation(worldserver1, worldserver1.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
+ player.moveTo(player.adjustSpawnLocation(worldserver1, worldserver1.getSharedSpawnPos()).getBottomCenter(), worldserver1.getSharedSpawnAngle(), 0.0F); // Paper - MC-200092 - fix first spawn pos yaw being ignored
+ }
+ // Paper end - Entity#getEntitySpawnReason
player.setServerLevel(worldserver1);
@@ -391,7 +391,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.save();
@@ -334,95 +519,207 @@
@@ -334,95 +519,209 @@
}
@@ -560,8 +560,10 @@
+ Player player = entity.getBukkitEntity();
+ PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.connection.channel.remoteAddress()).getAddress());
+
+ if (this.bans.isBanned(gameprofile)) {
+ UserBanListEntry gameprofilebanentry = (UserBanListEntry) this.bans.get(gameprofile);
+ // Paper start - Fix MC-158900
+ UserBanListEntry gameprofilebanentry;
+ if (this.bans.isBanned(gameprofile) && (gameprofilebanentry = this.bans.get(gameprofile)) != null) {
+ // Paper end - Fix MC-158900
+
ichatmutablecomponent = Component.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
if (gameprofilebanentry.getExpires() != null) {
@@ -587,11 +589,10 @@
}
- return ichatmutablecomponent;
- } else {
- return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(profile) ? Component.translatable("multiplayer.disconnect.server_full") : null;
+ // return chatmessage;
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
+ } 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;
+ if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) {
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
@@ -638,7 +639,7 @@
if (entityplayer1 != null) {
set.add(entityplayer1);
@@ -431,72 +728,160 @@
@@ -431,72 +730,160 @@
Iterator iterator1 = set.iterator();
while (iterator1.hasNext()) {
@@ -820,7 +821,7 @@
return entityplayer1;
}
@@ -516,15 +901,32 @@
@@ -516,15 +903,32 @@
}
public void sendPlayerPermissionLevel(ServerPlayer player) {
@@ -855,14 +856,10 @@
this.sendAllPlayerInfoIn = 0;
}
@@ -537,9 +939,28 @@
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
@@ -541,6 +945,25 @@
}
entityplayer.connection.send(packet);
+ }
+
+ }
+
+ // CraftBukkit start - add a world/entity limited version
+ public void broadcastAll(Packet packet, net.minecraft.world.entity.player.Player entityhuman) {
+ for (int i = 0; i < this.players.size(); ++i) {
@@ -877,14 +874,15 @@
+ public void broadcastAll(Packet packet, Level world) {
+ for (int i = 0; i < world.players().size(); ++i) {
+ ((ServerPlayer) world.players().get(i)).connection.send(packet);
}
}
+ }
+
+ }
+ // CraftBukkit end
+
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
Iterator iterator = this.players.iterator();
@@ -554,7 +975,7 @@
@@ -554,7 +977,7 @@
}
@@ -893,7 +891,7 @@
PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam != null) {
@@ -573,7 +994,7 @@
@@ -573,7 +996,7 @@
}
}
@@ -902,7 +900,7 @@
PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam == null) {
@@ -619,7 +1040,7 @@
@@ -619,7 +1042,7 @@
}
public void deop(GameProfile profile) {
@@ -911,7 +909,7 @@
ServerPlayer entityplayer = this.getPlayer(profile.getId());
if (entityplayer != null) {
@@ -629,6 +1050,11 @@
@@ -629,6 +1052,11 @@
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
@@ -923,7 +921,7 @@
if (player.connection != null) {
byte b0;
@@ -643,36 +1069,53 @@
@@ -643,36 +1071,53 @@
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
@@ -990,7 +988,7 @@
if (entityplayer != player && entityplayer.level().dimension() == worldKey) {
double d4 = x - entityplayer.getX();
double d5 = y - entityplayer.getY();
@@ -687,10 +1130,12 @@
@@ -687,10 +1132,12 @@
}
public void saveAll() {
@@ -1003,7 +1001,7 @@
}
public UserWhiteList getWhiteList() {
@@ -712,15 +1157,19 @@
@@ -712,15 +1159,19 @@
public void reloadWhiteList() {}
public void sendLevelInfo(ServerPlayer player, ServerLevel world) {
@@ -1027,7 +1025,7 @@
}
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
@@ -729,8 +1178,16 @@
@@ -729,8 +1180,16 @@
public void sendAllPlayerInfo(ServerPlayer player) {
player.inventoryMenu.sendAllDataToRemote();
@@ -1045,7 +1043,7 @@
}
public int getPlayerCount() {
@@ -746,6 +1203,7 @@
@@ -746,6 +1205,7 @@
}
public void setUsingWhiteList(boolean whitelistEnabled) {
@@ -1053,7 +1051,7 @@
this.doWhiteList = whitelistEnabled;
}
@@ -786,12 +1244,36 @@
@@ -786,12 +1246,36 @@
}
public void removeAll() {
@@ -1092,7 +1090,7 @@
public void broadcastSystemMessage(Component message, boolean overlay) {
this.broadcastSystemMessage(message, (entityplayer) -> {
return message;
@@ -819,24 +1301,43 @@
@@ -819,24 +1303,43 @@
}
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) {
@@ -1139,7 +1137,7 @@
}
if (flag1 && sender != null) {
@@ -845,20 +1346,27 @@
@@ -845,20 +1348,27 @@
}
@@ -1172,7 +1170,7 @@
Path path = file2.toPath();
if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -867,7 +1375,7 @@
@@ -867,7 +1377,7 @@
}
serverstatisticmanager = new ServerStatsCounter(this.server, file1);
@@ -1181,7 +1179,7 @@
}
return serverstatisticmanager;
@@ -875,13 +1383,13 @@
@@ -875,13 +1385,13 @@
public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) {
UUID uuid = player.getUUID();
@@ -1197,7 +1195,7 @@
}
advancementdataplayer.setPlayer(player);
@@ -932,15 +1440,28 @@
@@ -932,15 +1442,28 @@
}
public void reloadResources() {