Updated Upstream (Bukkit/CraftBukkit) (#7604)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
33a2b476 PR-734: Make PlayerInventory#getItem Nullable

CraftBukkit Changes:
953d3ddc SPIGOT-3034: PlayerKickEvent.setLeaveMessage(String) doesn't actually do anything
2c47af0c SPIGOT-6963: CraftMetaBlockState#getBlockState applied TileEntity ids without the minecraft namespace prefix.
This commit is contained in:
Jake Potrebic 2022-03-16 08:57:51 -07:00
parent 5bbbb6fffc
commit d3087536e9
12 changed files with 69 additions and 22 deletions

View file

@ -235,6 +235,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/** /**
* Return the ItemStack from the helmet slot * Return the ItemStack from the helmet slot
@@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory {
*
* @param slot the slot to get the ItemStack
*
- * @return the ItemStack in the given slot or null if there is not one
+ * @return the ItemStack in the given slot
*/
- @Nullable
+ @NotNull // Paper
public ItemStack getItem(@NotNull EquipmentSlot slot);
/**
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java

View file

@ -122,16 +122,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Location getTo() { public Location getTo() {
return to; return to;
} }
diff --git a/src/main/java/org/bukkit/inventory/PlayerInventory.java b/src/main/java/org/bukkit/inventory/PlayerInventory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/PlayerInventory.java
+++ b/src/main/java/org/bukkit/inventory/PlayerInventory.java
@@ -0,0 +0,0 @@ public interface PlayerInventory extends Inventory {
*
* @return the ItemStack in the given slot
*/
- @NotNull
+ @Nullable
public ItemStack getItem(@NotNull EquipmentSlot slot);
/**

View file

@ -1283,8 +1283,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
return;
} }
this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
// Send the possibly modified leave message // Send the possibly modified leave message
- s = event.getReason(); - s = event.getReason();
- final Component ichatbasecomponent = CraftChatMessage.fromString(s, true)[0]; - final Component ichatbasecomponent = CraftChatMessage.fromString(s, true)[0];
@ -1468,7 +1468,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entityplayer.closeContainer(); entityplayer.closeContainer();
} }
- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), "\u00A7e" + entityplayer.getScoreboardName() + " left the game"); - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), entityplayer.kickLeaveMessage != null ? entityplayer.kickLeaveMessage : "\u00A7e" + entityplayer.getScoreboardName() + " left the game");
+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())));
this.cserver.getPluginManager().callEvent(playerQuitEvent); this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());

View file

@ -49,8 +49,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean sentListPacket = false; public boolean sentListPacket = false;
+ public boolean supressTrackerForLogin = false; // Paper + public boolean supressTrackerForLogin = false; // Paper
public Integer clientViewDistance; public Integer clientViewDistance;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java

View file

@ -4,10 +4,30 @@ Date: Wed, 7 Jul 2021 16:19:41 -0700
Subject: [PATCH] Fixes kick event leave message not being sent Subject: [PATCH] Fixes kick event leave message not being sent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
public boolean supressTrackerForLogin = false; // Paper
public boolean didPlayerJoinEvent = false; // Paper
public Integer clientViewDistance;
- public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Do not kick the player
return;
}
- this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
// Send the possibly modified leave message
final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> { this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> {
this.connection.disconnect(ichatbasecomponent); this.connection.disconnect(ichatbasecomponent);

View file

@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean supressTrackerForLogin = false; // Paper public boolean supressTrackerForLogin = false; // Paper
+ public boolean didPlayerJoinEvent = false; // Paper + public boolean didPlayerJoinEvent = false; // Paper
public Integer clientViewDistance; public Integer clientViewDistance;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/TicketType.java --- a/src/main/java/net/minecraft/server/level/TicketType.java

View file

@ -6006,7 +6006,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
public Integer clientViewDistance; public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper

View file

@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 15 Mar 2022 01:38:15 -0700
Subject: [PATCH] Make some itemstacks nonnull
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java
@@ -0,0 +0,0 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
case OFF_HAND:
return this.getItemInOffHand();
case FEET:
- return this.getBoots();
+ return java.util.Objects.requireNonNullElseGet(this.getBoots(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
case LEGS:
- return this.getLeggings();
+ return java.util.Objects.requireNonNullElseGet(this.getLeggings(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
case CHEST:
- return this.getChestplate();
+ return java.util.Objects.requireNonNullElseGet(this.getChestplate(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
case HEAD:
- return this.getHelmet();
+ return java.util.Objects.requireNonNullElseGet(this.getHelmet(), () -> new ItemStack(org.bukkit.Material.AIR)); // Paper - make nonnull
default:
throw new IllegalArgumentException("Not implemented. This is a bug");
}

View file

@ -71,8 +71,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Either;
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
public boolean sentListPacket = false;
public Integer clientViewDistance; public Integer clientViewDistance;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
+ public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper + public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper

View file

@ -5,7 +5,7 @@ PS1="$"
function changelog() { function changelog() {
base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1) base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1)
cd $1 && git log --oneline ${base}...HEAD | sed 's/\(^[0-9a-f]\{8,\}\s\|Revert\s"\)#\([0-9]\+\)/\1PR-\2/' cd $1 && git log --oneline ${base}...HEAD | sed -E 's/(^[0-9a-f]{8,} |Revert ")#([0-9]+)/\1PR-\2/'
} }
bukkit=$(changelog work/Bukkit) bukkit=$(changelog work/Bukkit)
cb=$(changelog work/CraftBukkit) cb=$(changelog work/CraftBukkit)

@ -1 +1 @@
Subproject commit 881e06e5db821ef829b41e372bbcafa1df9670ab Subproject commit 33a2b476bbde7c2c0c45e644dc99b10d65736d40

@ -1 +1 @@
Subproject commit 9ed7e4fbe4c0cd2076a52d65a9ea8ae810d0e176 Subproject commit 953d3ddc674e5fc3ef04588f9fdcc35643653463