13
0
geforkt von Mirrors/Paper

moaaaaaaaar patches

Dieser Commit ist enthalten in:
Jake 2021-11-24 12:15:19 -08:00 committet von MiniDigger | Martin
Ursprung 6f5b43e290
Commit 1cb76e15be
31 geänderte Dateien mit 96 neuen und 106 gelöschten Zeilen

Datei anzeigen

@ -105,6 +105,20 @@ index 2ff1b1308571d8f8056d3359e8a8ba4a589c3726..e669ad8ecd182c6899c7820414e6ee1f
@NotNull
public int[] getExpLevelCostsOffered() {
int[] levelOffers = new int[offers.length];
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..c0ff615fe7ce8b398d49f52937c378eda8e79914 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -158,8 +158,7 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return An array of ItemStacks from the inventory. Individual items may be null.
*/
- @NotNull
- public ItemStack[] getContents();
+ public @Nullable ItemStack @NotNull [] getContents(); // Paper - make array elements nullable instead array
/**
* Completely replaces the inventory's contents. Removes all existing
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index 71e5ee496a947fbd8e3ec579833b157c76b51833..d773e8594f91017bddd7ea8aada3a1ff2781d05b 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java

Datei anzeigen

@ -28,10 +28,10 @@ index 83a4642119c3f33749e04c774cf2b39839f797e2..a39d2f1acbbd84ae0e2cf29f85594e09
public Location getLocation() {
return getInventory().getLocation();
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..6386206188e820206bb1a9f516b5e194fdc9d952 100644
index c0ff615fe7ce8b398d49f52937c378eda8e79914..3fa4fa4170633abf472a60d5bd07fb3ac7c58947 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -384,6 +384,17 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -383,6 +383,17 @@ public interface Inventory extends Iterable<ItemStack> {
@Nullable
public InventoryHolder getHolder();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
index 9738a3aac9738a59d152e2ffec7472fda3ccbb0b..0006a5a53dfa9fc81c608423e8740a9c820659a3 100644
index 40fc747fa229d8ae682e8b126de98de6471eef6b..e959f844581eaa88f581a4fabcb39148624bbe9b 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
@@ -219,6 +219,15 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement Keyed on World
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 8c99c26559a8aa7c79115c3cb68ae2d5e714c4b7..f8ff4e39bb9b5c5bcba7cdc25a853d49a51b1125 100644
index 60528523299f92f842700cafd513a8ef6fd3c290..71423daecacf5cc8ec797ddfc8d74ca0af85b7b4 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -694,6 +694,18 @@ public final class Bukkit {
@@ -708,6 +708,18 @@ public final class Bukkit {
public static World getWorld(@NotNull UUID uid) {
return server.getWorld(uid);
}
@ -28,10 +28,10 @@ index 8c99c26559a8aa7c79115c3cb68ae2d5e714c4b7..f8ff4e39bb9b5c5bcba7cdc25a853d49
/**
* Gets the map from the given item ID.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8d65a4773a51a9d9d5bfba9d4f6a8d5cf221e7fd..748d6873a000808731b16cdb208752357bf8dfb0 100644
index 5e0124fbfa7caa4ed321bf1e01ad0fde9941d7ef..6aee6423d9c68e567f581899a2d83dc35e56bd55 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -589,6 +589,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -601,6 +601,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public World getWorld(@NotNull UUID uid);
@ -50,7 +50,7 @@ index 8d65a4773a51a9d9d5bfba9d4f6a8d5cf221e7fd..748d6873a000808731b16cdb20875235
* Gets the map from the given item ID.
*
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index dfae149ae00e292b82dab9dae589878d8f148bd8..8e2c410e755fd6094671e3a05fe119917c88cdff 100644
index 9506523227af07667fe2aaa7479f87e4a79b369f..49cbc8c1f05f2d48177f1b8fec25e2e1439be0d8 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -41,7 +41,7 @@ import org.jetbrains.annotations.Nullable;

Datei anzeigen

@ -45,7 +45,7 @@ index 7680c269c2fe0cf2a51d0ebeb34624181826d578..49f3b25d28072b61f5cc97260df61df8
}
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..0c40e0f8904880e1f01349953f44d1d330a5a696 100644
index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..312775d0430f793720211dc29bb293503e799d11 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
@@ -21,18 +21,25 @@ public class PlayerSensor extends Sensor<LivingEntity> {
@ -55,7 +55,7 @@ index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..0c40e0f8904880e1f01349953f44d1d3
- List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((player) -> {
- return entity.closerThan(player, 16.0D);
- }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList());
+ List<Player> players= new java.util.ArrayList<>(world.players());
+ List<Player> players = new java.util.ArrayList<>(world.players());
+ players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D));
+ players.sort(Comparator.comparingDouble(entity::distanceTo));
Brain<?> brain = entity.getBrain();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Throw proper exception on empty JsonList file
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index 2567e51f7de898ea0a2411a176af70bdc4551260..9152c6c9e7e5c8fdb9183c2b4f088a810621b333 100644
index fb5d34913fb7db7d75d974118eb77c3d9833d742..8982562721c3a5a5a3305e90bd8b5bc21585a425 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -187,6 +187,7 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {

Datei anzeigen

@ -39,7 +39,7 @@ index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d142579905
+ }
}
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index 703d2bb93d6ab76fc117a320f155570addcc543c..07f0c5f629741e4ecc1fcbc122ba7700174e5c9d 100644
index e5f071c6449dc12cfed939b6b8a21a20cd7c38f7..d105b4133a906342a8ee76df3030cef8557fde53 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -32,6 +32,11 @@ import net.minecraft.DefaultUncaughtExceptionHandler;

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] fix converting txt to json file
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
index aeb91eefa0949b2a53d77f1e4a48a29b9d1bc3fe..918f5221e94cbc867349c69c83563e225d2fef1d 100644
index 04d2ed6ae4c2f250bb13ea732280108f91dc5660..21613cd49ebcccfd3837991dba1df0a188c42760 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java
@@ -16,6 +16,11 @@ public class DedicatedPlayerList extends PlayerList {
DedicatedServerProperties dedicatedServerProperties = server.getProperties();
@@ -17,6 +17,11 @@ public class DedicatedPlayerList extends PlayerList {
this.setViewDistance(dedicatedServerProperties.viewDistance);
this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
+ // Paper start - moved from constructor
+ }
@ -21,10 +21,10 @@ index aeb91eefa0949b2a53d77f1e4a48a29b9d1bc3fe..918f5221e94cbc867349c69c83563e22
this.saveUserBanList();
this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 286863b7eb9ee0389154304e61942dd68f978ff1..67afb97e6cb545d319202f3eca771015065089f6 100644
index e968b880e435b8753314d85b919a0abc4f35be25..02d7b16f81ebf9f902a36d4f31802b20d1820d6e 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -205,6 +205,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -203,6 +203,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
@ -37,7 +37,7 @@ index 286863b7eb9ee0389154304e61942dd68f978ff1..67afb97e6cb545d319202f3eca771015
// Paper start
try {
com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings"));
@@ -267,9 +273,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -265,9 +271,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
@ -48,7 +48,7 @@ index 286863b7eb9ee0389154304e61942dd68f978ff1..67afb97e6cb545d319202f3eca771015
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4662c7461a9d9a7f7989003ec00d4bd97a549bde..cad35d9c45513b7db7714b7dd294cf0445b4908c 100644
index 7057f7aa02b819e32f2067d3c1c7c0eefb082fce..8784748564021eecf0e2553925d234c789fc9c5a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -174,6 +174,7 @@ public abstract class PlayerList {
@ -58,4 +58,4 @@ index 4662c7461a9d9a7f7989003ec00d4bd97a549bde..cad35d9c45513b7db7714b7dd294cf04
+ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor
public void placeNewPlayer(Connection connection, ServerPlayer player) {
player.isRealPlayer = true; // Paper - Chunk priority
ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add worldborder events
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index c2c54dc4bbfe469f2b8c751012b93d5e728936d6..1e1a9102e067762c9d1bd091388f108ef8170989 100644
index 2442c287a7f26cfee10a19e9015558cdebdcf3ac..3063a45e5d124d4405e940daff24877866165d3f 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -108,15 +108,19 @@ public class WorldBorder {
@@ -123,15 +123,19 @@ public class WorldBorder {
}
public void setCenter(double x, double z) {
@ -31,7 +31,7 @@ index c2c54dc4bbfe469f2b8c751012b93d5e728936d6..1e1a9102e067762c9d1bd091388f108e
}
}
@@ -134,25 +138,43 @@ public class WorldBorder {
@@ -149,25 +153,43 @@ public class WorldBorder {
}
public void setSize(double size) {
@ -79,7 +79,7 @@ index c2c54dc4bbfe469f2b8c751012b93d5e728936d6..1e1a9102e067762c9d1bd091388f108e
}
}
@@ -457,6 +479,7 @@ public class WorldBorder {
@@ -472,6 +494,7 @@ public class WorldBorder {
@Override
public WorldBorder.BorderExtent update() {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent grindstones from overstacking items
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index dda6c4948b903221fa8020c76d109216d2dd82bf..51f3650bc19bddc71731c0cb36e600cc8d16a495 100644
index aa47947ea2f04afd3cca4b359891609025c112d5..0bdf874ddb951daf8d469575a44144504472d12d 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -199,13 +199,13 @@ public class GrindstoneMenu extends AbstractContainerMenu {
@@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu {
i = Math.max(item.getMaxDamage() - l, 0);
itemstack2 = this.mergeEnchants(itemstack, itemstack1);
if (!itemstack2.isDamageableItem()) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add recipe to cook events
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index e898083a3450b496beacffa44f3e2e3b8b67d109..5be5f94ff820ba8f60b229816c8b37dc5311c1f9 100644
index b05019614a172ef071aaefc5fcc1d18627cc0402..4e40eb50effb5508cdbfdc5d55a4b75c832a1ff3 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -422,7 +422,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -421,7 +421,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
@ -18,10 +18,10 @@ index e898083a3450b496beacffa44f3e2e3b8b67d109..5be5f94ff820ba8f60b229816c8b37dc
if (furnaceSmeltEvent.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index ad35d82f03f7643507dde6adbb38c911d12ec6c1..9f00de75b6f206c11ce7d1c59ba98fafe02fa9ab 100644
index dd272fe24d330c04f2f3f44db9357b3d35034c4e..7c48b26dc4baa3b4046840356132170c6e05a1d6 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -53,7 +53,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -52,7 +52,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
@ -33,7 +33,7 @@ index ad35d82f03f7643507dde6adbb38c911d12ec6c1..9f00de75b6f206c11ce7d1c59ba98faf
return recipecampfire.assemble(inventorysubcontainer);
}).orElse(itemstack);
@@ -61,7 +64,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -60,7 +63,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 4d6a5f6db4803aa04d2eb25ef849b7d76de00e6b..ea1fa9758fcaa87de11b84d5a2e1d36b0e8930ee 100644
index 4c30b6d0d70a48b39bd99b5e9761f950b8b0c340..011f34034bf6d8481e91b08894c68d87de41f2c1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -659,5 +659,9 @@ public class CraftBlock implements Block {
@@ -672,5 +672,9 @@ public class CraftBlock implements Block {
}
return speed;
}

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index dfd4aac7a6e184a79bfdf15d9b5a92dbcb06fadd..080b5d5d78e5f65c4367f07abcf1c47356354365 100644
index 3c5dd72a4c98703602c41f2a04f1c793a6faf2ea..dd90952fe0c2a46d8dddc1e2a37ed68d07f7900a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -818,5 +818,10 @@ public class PaperWorldConfig {
fixWitherTargetingBug = getBoolean("fix-wither-targeting-bug", false);
log("Withers properly target players: " + fixWitherTargetingBug);
@@ -727,4 +727,9 @@ public class PaperWorldConfig {
expMergeMaxValue = getInt("experience-merge-max-value", -1);
log("Experience Merge Max Value: " + expMergeMaxValue);
}
+
+ public boolean allowUsingSignsInsideSpawnProtection = false;
@ -18,17 +18,16 @@ index dfd4aac7a6e184a79bfdf15d9b5a92dbcb06fadd..080b5d5d78e5f65c4367f07abcf1c473
+ allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6de62cbd8475d04c765d532731336638225525bc..2d459cf7899461fbacaa22b0b2d68a73578bc95f 100644
index f9490e629b8aa94158724850812414ede2df7e92..91ed360b7e326ddac93abd61dfbaf6b8e83bb6e6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1723,7 +1723,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1728,7 +1728,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int i = this.player.level.getMaxBuildHeight();
if (blockposition.getY() < i) {
- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition)) {
+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper
- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper
// CraftBukkit start - Check if we can actually do something over this large a distance
// Paper - move check up
this.player.stopUsingItem(); // SPIGOT-4706

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement Keyed on World
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 35c7ecad55f63701fcb86fb6051723662268b7c9..b6e02cb09427931b7556833d8c03ec45c8a0469f 100644
index 5c8dc52d012117ebf9721fb26d3c0e9d84a751f4..9d77ecf330d93b3c2925d097b753c887838cb1ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1199,7 +1199,7 @@ public final class CraftServer implements Server {
@@ -1239,7 +1239,7 @@ public final class CraftServer implements Server {
} else if (name.equals(levelName + "_the_end")) {
worldKey = net.minecraft.world.level.Level.END;
} else {
@ -17,7 +17,7 @@ index 35c7ecad55f63701fcb86fb6051723662268b7c9..b6e02cb09427931b7556833d8c03ec45
}
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, dimensionmanager, this.getServer().progressListenerFactory.create(11),
@@ -1291,6 +1291,15 @@ public final class CraftServer implements Server {
@@ -1331,6 +1331,15 @@ public final class CraftServer implements Server {
return null;
}
@ -34,10 +34,10 @@ index 35c7ecad55f63701fcb86fb6051723662268b7c9..b6e02cb09427931b7556833d8c03ec45
// Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index af5fc36f78b4ba0663cf78e245ee1d3a81b8f87a..5ba70949dcdfbb87ed53c1bb750d216c8a16babf 100644
index 6835fc0fa6aba42edb5b78bcbe46fdc20af5f288..69f6675e3a1e979687d956576719c46003ea3b0e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1956,6 +1956,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1950,6 +1950,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
}, net.minecraft.server.MinecraftServer.getServer());
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Item Rarity API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 66dfc5216570be01fe3a60a8dc305c442b37d50a..d40f341af9649eececfd12c79e34719f03b45c53 100644
index 29d079927ac5f48f14e6f41a32b03174cc622dda..191d5bee5651e5b8e60547f819836370ce6124bc 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -476,6 +476,20 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -6,30 +6,30 @@ Subject: [PATCH] Only set despawnTimer for Wandering Traders spawned by
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 345ecbc7fc080e8581d285b638db1ee6e684010a..8c829066939a4069953097fd268f7c214a555779 100644
index 05ca012854100013714e3d6e8803a2959938cba4..d17bde781ff574799054d9696e4d4480fe04a52c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -335,6 +335,12 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
@@ -334,6 +334,12 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
@Nullable
public T spawnCreature(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
+ // Paper start - add consumer to modify entity before spawn
+ return this.spawnCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, spawnReason, null);
+ return this.spawn(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, spawnReason, null);
+ }
+ @Nullable
+ public T spawnCreature(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason, @Nullable java.util.function.Consumer<T> op) {
+ public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason, @Nullable java.util.function.Consumer<T> op) {
+ // Paper end
// Paper start - Call PreCreatureSpawnEvent
org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath());
if (type != null) {
@@ -350,6 +356,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
@@ -349,6 +355,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
}
// Paper end
T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
+ if (t0 != null && op != null) op.accept(t0); // Paper
if (t0 != null) {
worldserver.addAllEntities(t0, spawnReason);
worldserver.addFreshEntityWithPassengers(t0, spawnReason);
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
index 1101989e93758294c1adebbef0ab12a3c046e326..087a2c4dd89c63fc6c269cc38b7662051c051571 100644
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
@ -44,15 +44,15 @@ index 1101989e93758294c1adebbef0ab12a3c046e326..087a2c4dd89c63fc6c269cc38b766205
@Override
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
index 60f08ecd0034e8ef2965b54b3abccce582d0ca54..f8ede3588bfda9a7d4d5807311a3e9c2651fd0a3 100644
index 487dfa0dd39b99994a82ff3858903c28d7676c0d..323eea2bccacfcc85849b5d82c2b30d991e0c0d8 100644
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
@@ -121,7 +121,7 @@ public class WanderingTraderSpawner implements CustomSpawner {
return false;
}
- WanderingTrader entityvillagertrader = (WanderingTrader) EntityType.WANDERING_TRADER.spawnCreature(world, (CompoundTag) null, (Component) null, (Player) null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
+ WanderingTrader entityvillagertrader = EntityType.WANDERING_TRADER.spawnCreature(world, null, null, null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, trader -> trader.setDespawnDelay(48000)); // CraftBukkit // Paper - set despawnTimer before spawn events called
- WanderingTrader entityvillagertrader = (WanderingTrader) EntityType.WANDERING_TRADER.spawn(world, (CompoundTag) null, (Component) null, (Player) null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
+ WanderingTrader entityvillagertrader = (WanderingTrader) EntityType.WANDERING_TRADER.spawn(world, (CompoundTag) null, (Component) null, (Player) null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, trader -> trader.setDespawnDelay(48000)); // CraftBukkit // Paper - set despawnTimer before spawn events called
if (entityvillagertrader != null) {
for (int i = 0; i < 2; ++i) {

Datei anzeigen

@ -7,10 +7,10 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro
Closes #5036
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cad35d9c45513b7db7714b7dd294cf0445b4908c..30471bf7b19335dd85b11ca5e8303784f7905a8c 100644
index 8784748564021eecf0e2553925d234c789fc9c5a..4b8a6ed8b336cd2f03a0dc3a5a3214823504bb34 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -615,6 +615,14 @@ public abstract class PlayerList {
@@ -612,6 +612,14 @@ public abstract class PlayerList {
}
// Paper end

Datei anzeigen

@ -5,18 +5,18 @@ Subject: [PATCH] forced whitelist: use configurable kick message
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f3976a53514249e64d91075ec2e620e4c7cef37f..fca8d2100b48be9698afa7f3e8cf20212ca37974 100644
index 6694e0d6d7d8d60f54ea1a2d2dcb5a8894b5b4b9..478eb61a9e5aab8b004e75c264eca9ca79e51fbb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -74,7 +74,6 @@ import net.minecraft.nbt.NbtOps;
@@ -73,7 +73,6 @@ import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
-import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket;
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
@@ -2125,7 +2124,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
import net.minecraft.network.protocol.status.ServerStatus;
@@ -2042,7 +2041,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8424884bcd36e3daff47725ef343d9b99030bdc6..1252e77dc74880c8409dc5d6adf3d60e3e074e31 100644
index 91ed360b7e326ddac93abd61dfbaf6b8e83bb6e6..7d5b999178ef7faed6a901fdc7456a9a2a28d89a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1177,7 +1177,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1176,7 +1176,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
itemstack.addTagElement("pages", (Tag) nbttaglist);
itemstack.addTagElement("pages", nbttaglist);
- CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack); // CraftBukkit
+ this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent)
}

Datei anzeigen

@ -9,22 +9,21 @@ defaults are only included for certain entites, this allows setting
limits for any entity type.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 723bf8c37494a11b5e6cccc22a2c125c5cba3c01..0938b38aaca2bfaf3a70c392849222fc0128c60c 100644
index dd90952fe0c2a46d8dddc1e2a37ed68d07f7900a..3bdbb31e050444d4052c6cac4b0af8454196ab8c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -6,8 +6,11 @@ import java.util.List;
@@ -6,7 +6,10 @@ import java.util.stream.Collectors;
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
import net.minecraft.world.entity.MobCategory;
+import java.util.HashMap;
+import java.util.Map;
import java.util.stream.Collectors;
import net.minecraft.world.Difficulty;
+import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.monster.Vindicator;
import net.minecraft.world.entity.monster.Zombie;
import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode;
@@ -143,6 +146,38 @@ public class PaperWorldConfig {
import org.bukkit.Bukkit;
@@ -141,6 +144,38 @@ public class PaperWorldConfig {
);
}
@ -41,7 +40,7 @@ index 723bf8c37494a11b5e6cccc22a2c125c5cba3c01..0938b38aaca2bfaf3a70c392849222fc
+ addEntityPerChunkSaveLimitsFromSection(config.getConfigurationSection("world-settings." + worldName + ".entity-per-chunk-save-limit"), entityPerChunkSaveLimits);
+ }
+
+ private static void addEntityPerChunkSaveLimitsFromSection(final ConfigurationSection section, final Map<EntityType<?>, Integer> limitMap) {
+ private static void addEntityPerChunkSaveLimitsFromSection(final org.bukkit.configuration.ConfigurationSection section, final Map<EntityType<?>, Integer> limitMap) {
+ if (section == null) {
+ return;
+ }
@ -64,10 +63,10 @@ index 723bf8c37494a11b5e6cccc22a2c125c5cba3c01..0938b38aaca2bfaf3a70c392849222fc
private void keepLoadedRange() {
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 8c829066939a4069953097fd268f7c214a555779..1c446dba5de89698397041ee38a2e1a00bec8a56 100644
index d17bde781ff574799054d9696e4d4480fe04a52c..419a7e9614af2328ed401fc954196056243a984c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -563,9 +563,20 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
@@ -560,9 +560,20 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
final Spliterator<? extends net.minecraft.nbt.Tag> spliterator = entityNbtList.spliterator();
return StreamSupport.stream(new Spliterator<Entity>() {
@ -89,13 +88,13 @@ index 8c829066939a4069953097fd268f7c214a555779..1c446dba5de89698397041ee38a2e1a0
return entity;
});
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
index 04aecfbafa2840755b8b025d5605205cc7f821cf..bab6e0ac7b57a86ff36e8caf1014f1625ca976b6 100644
index ac1e1a56698bda3a02d76c843562d4f66ad9ffa3..bc46fdff45b174d9c266d1b6b546061a39b4997d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
@@ -107,7 +107,18 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
} else {
ListTag nbttaglist = new ListTag();
@@ -90,7 +90,18 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
} else {
ListTag listTag = new ListTag();
+ final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper
dataList.getEntities().forEach((entity) -> {
+ // Paper start
@ -108,6 +107,6 @@ index 04aecfbafa2840755b8b025d5605205cc7f821cf..bab6e0ac7b57a86ff36e8caf1014f162
+ savedEntityCounts.merge(entityType, 1, Integer::sum);
+ }
+ // Paper end
CompoundTag nbttagcompound = new CompoundTag();
if (entity.save(nbttagcompound)) {
CompoundTag compoundTag = new CompoundTag();
if (entity.save(compoundTag)) {
listTag.add(compoundTag);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] fix cancelling block falling causing client desync
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 15ec064cb9336924e16a7c9b3f76a9b6ef18d947..8336ea928faa92c6f58f8cdfb9faf1d8e26c9ccf 100644
index e74a87336b47611fa29df4cd3d272fb08b91630b..0c94b4cb6ee0c3dffe0b67a2291d0160ae0ef96f 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -119,8 +119,18 @@ public class FallingBlockEntity extends Entity {
@@ -128,8 +128,18 @@ public class FallingBlockEntity extends Entity {
if (this.time++ == 0) {
blockposition = this.blockPosition();

Datei anzeigen

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: CDFN <codefun@protonmail.com>
Date: Fri, 12 Mar 2021 18:31:31 +0100
Subject: [PATCH] fix Inventory#getContents null annotations
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 6386206188e820206bb1a9f516b5e194fdc9d952..7956aebcb390379677dccf7c9561866cf94c024c 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -158,9 +158,8 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return An array of ItemStacks from the inventory. Individual items may be null.
*/
- @NotNull
- public ItemStack[] getContents();
-
+ public @org.checkerframework.checker.nullness.qual.Nullable ItemStack @org.checkerframework.checker.nullness.qual.NonNull [] getContents(); // Paper - make array elements nullable instead array
+
/**
* Completely replaces the inventory's contents. Removes all existing
* contents and replaces it with the ItemStacks given in the array.