3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Dieser Commit ist enthalten in:
Jake 2021-11-24 13:30:53 -08:00 committet von MiniDigger | Martin
Ursprung 35aeb0ddeb
Commit 5a2d3b2b29
38 geänderte Dateien mit 177 neuen und 170 gelöschten Zeilen

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#close
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 7956aebcb390379677dccf7c9561866cf94c024c..8f00cb2e3bc9963e9657c1b2493e8b015a6664d0 100644
index 3fa4fa4170633abf472a60d5bd07fb3ac7c58947..8864124c4a6ba48523ff217a78b9bac676da592f 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -353,6 +353,15 @@ public interface Inventory extends Iterable<ItemStack> {

Datei anzeigen

@ -70,10 +70,10 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7
+
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index df684277b9351f9785df051fbe52153c495d8d54..0593d5487f411d34edc3d3b15213db4d86af1407 100644
index 71423daecacf5cc8ec797ddfc8d74ca0af85b7b4..0521781a48d326c0a4a01b920188e9ce00b51ef0 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2089,6 +2089,14 @@ public final class Bukkit {
@@ -2087,6 +2087,14 @@ public final class Bukkit {
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return server.getMobGoals();
}
@ -89,10 +89,10 @@ index df684277b9351f9785df051fbe52153c495d8d54..0593d5487f411d34edc3d3b15213db4d
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9f13adfc7fe1c647ce59a102ade4b6469a1071dd..0691ecbf954ae73df396b356f29a896c59ab680a 100644
index 6aee6423d9c68e567f581899a2d83dc35e56bd55..395b0706bfbf03741df6ca1ff084618b91140acc 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1832,5 +1832,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1830,5 +1830,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 34e7991a0f07793c42abd41fd8c1787deb1b8f5d..6a9f3d7b1d0a6cfcd4f309fe9859b7570cbe08a8 100644
index a6031b6ad451facd8ca6318bd06aa9850feb834c..7de08c12aec311a8de631a8ec37147579c5e9963 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -240,6 +240,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityBlockStorage#clearEntities()
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
index 61125c1c1a6efbb3ba13a29d5e4e6bbe67df8a4e..8484e80a70129fb0358d56efab6fd54798b54e6e 100644
index cdf7778f4bfd576e87fe41096414ca8dcdbdf35b..9fcd835d219aafbe113ebb1b796052e07bf2b046 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -135,6 +135,11 @@ public class BeehiveBlockEntity extends BlockEntity {
@ -21,7 +21,7 @@ index 61125c1c1a6efbb3ba13a29d5e4e6bbe67df8a4e..8484e80a70129fb0358d56efab6fd547
return (Integer) state.getValue(BeehiveBlock.HONEY_LEVEL);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
index 5db69fd9e822d80abb82b4a2145fc479d22f4f17..489d259d105476092d401f788c88c17c3bed86ff 100644
index ee4d7f5558ed76e8d8b56133da729a5303d1d823..e00210950cbf005b0e65aed68dfbb7c281aefd87 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java
@@ -80,4 +80,10 @@ public class CraftBeehive extends CraftBlockEntityState<BeehiveBlockEntity> impl

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index e05e5710c81b7dbb648afbfe16f843e7ae310752..7d6dc0a8ee35274052b122bbc446bc54750de0a6 100644
index 3ff6995d34914720d353fdbe1aa981bfab9f6040..f7959fe8d5247504dd79a18010470d98781c7cfe 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -290,10 +290,18 @@ public class PlayerAdvancements {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index f4cff18afa816aa7efb2f80e0af51216129963a4..45e77d96f673ce68cf15ce3d45fd1eeffed4d8d8 100644
index 8dc1e8bba37986c75966e321614ebb6366729c29..45db764f4499ee71bef691d37b604f21da120fe7 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -351,12 +351,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -352,12 +352,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
// Paper end
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] call PortalCreateEvent players and end platform
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e1296bbc1f31f270053a47c21887efbad8718b72..0eb2df75889bcfcadd5e2b81617cb8b3abd4df50 100644
index f8805dad18a5b9fa37b4f2c214acb17d59167f9d..3650036d18d66194fad37610e8a4de7a2eac97d7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1169,15 +1169,21 @@ public class ServerPlayer extends Player {
@@ -1178,15 +1178,21 @@ public class ServerPlayer extends Player {
private void createEndPlatform(ServerLevel world, BlockPos centerPos) {
BlockPos.MutableBlockPos blockposition_mutableblockposition = centerPos.mutable();

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index 6b4163f5601a0961055c8451ec7ef2204938cf69..cd75f895b6818fbb7ed4b0ef3df873f264bb2d1b 100644
index ecf12ed5014202181e78af051e4a9ca88a275794..e23fe546291e670f89447398507d08a0a07efa85 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -97,9 +97,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@@ -96,9 +96,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
return MobType.UNDEAD;
}
@ -26,7 +26,7 @@ index 6b4163f5601a0961055c8451ec7ef2204938cf69..cd75f895b6818fbb7ed4b0ef3df873f2
if (flag) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
@@ -223,7 +229,20 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@@ -222,7 +228,20 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
this.reassessWeaponGoal();
@ -48,10 +48,10 @@ index 6b4163f5601a0961055c8451ec7ef2204938cf69..cd75f895b6818fbb7ed4b0ef3df873f2
@Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 53cb932d5af963c51b026440da49bdc402cae9fd..253fce256341d20ee58f9b7afa1ffaa8fb820028 100644
index 7344301e1cdeccd95375b77f6955edb508362a7b..4442db77e1a0b517aab3a7dc74a4aaac5afc32e0 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -145,7 +145,7 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -144,7 +144,7 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public void aiStep() {
@ -60,7 +60,7 @@ index 53cb932d5af963c51b026440da49bdc402cae9fd..253fce256341d20ee58f9b7afa1ffaa8
this.setSecondsOnFire(8);
}
@@ -176,6 +176,9 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -175,6 +175,9 @@ public class Phantom extends FlyingMob implements Enemy {
if (nbt.hasUUID("Paper.SpawningEntity")) {
this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
}
@ -70,7 +70,7 @@ index 53cb932d5af963c51b026440da49bdc402cae9fd..253fce256341d20ee58f9b7afa1ffaa8
// Paper end
}
@@ -190,6 +193,7 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -189,6 +192,7 @@ public class Phantom extends FlyingMob implements Enemy {
if (this.spawningEntity != null) {
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
}
@ -78,7 +78,7 @@ index 53cb932d5af963c51b026440da49bdc402cae9fd..253fce256341d20ee58f9b7afa1ffaa8
// Paper end
}
@@ -249,6 +253,10 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -248,6 +252,10 @@ public class Phantom extends FlyingMob implements Enemy {
return spawningEntity;
}
public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
@ -110,7 +110,7 @@ index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d0
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
index 78f736ed3abaab4cc8bf8b7b163e25c806f79f3c..61e2841fea6603e3e5fbd004de7ffdfb79fc9981 100644
index 90f34d75f99f31f5c98c499df209979a03e23191..0e8e1a85697bbe9ca92466ca0a39e4e9478f31bf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {

Datei anzeigen

@ -92,10 +92,10 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b6e02cb09427931b7556833d8c03ec45c8a0469f..ea902f8d525684e0e8f82bc5017bcf748f106e40 100644
index 9d77ecf330d93b3c2925d097b753c887838cb1ec..3d3913686727af7367377deaf35681de6900aa22 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -288,6 +288,7 @@ public final class CraftServer implements Server {
@@ -292,6 +292,7 @@ public final class CraftServer implements Server {
public boolean ignoreVanillaPermissions = false;
private final List<CraftPlayer> playerView;
public int reloadCount;
@ -103,7 +103,7 @@ index b6e02cb09427931b7556833d8c03ec45c8a0469f..ea902f8d525684e0e8f82bc5017bcf74
public static Exception excessiveVelEx; // Paper - Velocity warnings
static {
@@ -372,6 +373,7 @@ public final class CraftServer implements Server {
@@ -376,6 +377,7 @@ public final class CraftServer implements Server {
TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
this.minimumAPI = this.configuration.getString("settings.minimum-api");
this.loadIcon();
@ -111,7 +111,7 @@ index b6e02cb09427931b7556833d8c03ec45c8a0469f..ea902f8d525684e0e8f82bc5017bcf74
}
public boolean getCommandBlockOverride(String command) {
@@ -2674,5 +2676,11 @@ public final class CraftServer implements Server {
@@ -2689,5 +2691,11 @@ public final class CraftServer implements Server {
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return mobGoals;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index ea136b9ad3a2a07076e12b8656c68f63aa4718c8..cf0a74b8a1c31d4bc493eb09a69ee2bd94cb6485 100644
index bb85bfb074830d771be8527f6c25ebb578578f18..f685ab3cc6e4fd76e8dec3d2d3627a13715cda44 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -239,6 +239,7 @@ public class Main {
@@ -249,6 +249,7 @@ public class Main {
*/
boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");

Datei anzeigen

@ -45,28 +45,28 @@ index d75f78d2e3fb1376e8f6a8668c98a04a693c99e1..79f6089b934124c3309c6bee2e48b36b
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 379c931d9f63c2273654f6f6f63c94b17df36e57..4b2ef3ed89b9fae04ccaee41e4accefab645e2f3 100644
index 3650036d18d66194fad37610e8a4de7a2eac97d7..aec3fd5bd9103af17eb476d5411b84d76f72bfe4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1790,8 +1790,15 @@ public class ServerPlayer extends Player {
@@ -1787,8 +1787,15 @@ public class ServerPlayer extends Player {
}
public boolean setGameMode(GameType gameMode) {
- if (!this.gameMode.changeGameModeForPlayer(gameMode)) {
- return false;
+ // Paper start - Add cause and nullable message to event
+ PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null);
+ return event == null ? false : event.isCancelled();
+ }
+ public PlayerGameModeChangeEvent setGameMode(GameType gameMode, PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component message) {
+ PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message);
+ public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component message) {
+ org.bukkit.event.player.PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message);
+ if (event == null || event.isCancelled()) {
+ // Paper end
+ return null;
} else {
this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId()));
if (gameMode == GameType.SPECTATOR) {
@@ -1803,7 +1810,7 @@ public class ServerPlayer extends Player {
@@ -1800,7 +1807,7 @@ public class ServerPlayer extends Player {
this.onUpdateAbilities();
this.updateEffectVisibility();
@ -75,13 +75,13 @@ index 379c931d9f63c2273654f6f6f63c94b17df36e57..4b2ef3ed89b9fae04ccaee41e4accefa
}
}
@@ -2185,6 +2192,16 @@ public class ServerPlayer extends Player {
@@ -2182,6 +2189,16 @@ public class ServerPlayer extends Player {
}
public void loadGameTypes(@Nullable CompoundTag nbt) {
+ // Paper start
+ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != ServerPlayer.readPlayerMode(nbt, "playerGameType")) {
+ if (new PlayerGameModeChangeEvent(this.getBukkitEntity(), GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) {
+ if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), org.bukkit.GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) {
+ this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE);
+ } else {
+ this.gameMode.setGameModeForPlayer(ServerPlayer.readPlayerMode(nbt,"playerGameType"), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType"));
@ -93,10 +93,10 @@ index 379c931d9f63c2273654f6f6f63c94b17df36e57..4b2ef3ed89b9fae04ccaee41e4accefa
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index da2ae74b6f5875200e22c42ed07431016a90845e..35d05cc4bddea5b168a6498add1de9bcbdbfc1cb 100644
index 9fbd88027933242348d9f4fea8b45e96fd01c343..3ab74a721d9d9bec82a68a30bf523292a3038587 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -74,18 +74,24 @@ public class ServerPlayerGameMode {
@@ -72,18 +72,24 @@ public class ServerPlayerGameMode {
}
public boolean changeGameModeForPlayer(GameType gameMode) {
@ -126,10 +126,10 @@ index da2ae74b6f5875200e22c42ed07431016a90845e..35d05cc4bddea5b168a6498add1de9bc
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 39d709bf38121e3c2c6ac019cdbf898d4dc9c2d5..db8b9872a489aafb657e81674b399eb60f9c91fe 100644
index 9daad376b7c837ac5dcda5f54d520e2adfda0481..311df240858d4416306a795d893bdf7da403e90b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2470,7 +2470,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2479,7 +2479,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player = this.server.getPlayerList().respawn(this.player, false);
if (this.server.isHardcore()) {
@ -139,10 +139,10 @@ index 39d709bf38121e3c2c6ac019cdbf898d4dc9c2d5..db8b9872a489aafb657e81674b399eb6
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 660fea802abee79414815f73e079a05b5be1b72a..c6a0f72a430e81db34f1c49cedb3f69cb5f0402c 100644
index 87ed5271d623f239c94d18464458469c8e789bba..4c1430a6499dd44bb07c9d13de511d365a93db58 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1263,7 +1263,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1257,7 +1257,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new IllegalArgumentException("Mode cannot be null");
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 68fc9b338d5ad27cd2b56197f9f5ba4988f89ae6..d88515fcaab8672bc1ace12554372a0b6ab57947 100644
index e567e9ccd6017e3c95e868efb78388030ee0f676..5e6941963f12a7f11603884a1b0bf844ea3a3514 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -491,6 +491,14 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -64,7 +64,7 @@ index c536eceef3365a7b726cd970df345ba1d055207d..11c1eb0e0bc326b28dc0cab16f67c413
public net.minecraft.world.item.enchantment.Enchantment getHandle() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 7d4daacde249b622a10ceca54b4a6997cc00bd77..ee63e6a650f93c973ffb2034e04b974cc1350540 100644
index 6555db49ff57bba13a7eb3c0bf7ecb66d7828dce..8fe1f5deddfee329c020d93c990dc686fe2b458e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -867,5 +867,21 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

Datei anzeigen

@ -30,22 +30,26 @@ easy to add threading, so I did.
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
new file mode 100644
index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc2c83485f
index 0000000000000000000000000000000000000000..748e6923338d40d67e31251e9ab6001674963690
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
@@ -0,0 +1,202 @@
@@ -0,0 +1,211 @@
+package io.papermc.paper.world;
+
+import com.mojang.datafixers.DataFixer;
+import com.mojang.serialization.Codec;
+import net.minecraft.SharedConstants;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.util.worldupdate.WorldUpgrader;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.chunk.ChunkGenerator;
+import net.minecraft.world.level.chunk.storage.ChunkStorage;
+import net.minecraft.world.level.chunk.storage.RegionFileStorage;
+import net.minecraft.world.level.dimension.DimensionType;
+import net.minecraft.world.level.dimension.LevelStem;
+import net.minecraft.world.level.levelgen.WorldGenSettings;
+import net.minecraft.world.level.storage.DimensionDataStorage;
+import net.minecraft.world.level.storage.LevelStorageSource;
+import org.apache.logging.log4j.LogManager;
@ -53,6 +57,7 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+import java.io.File;
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.util.Optional;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
@ -70,10 +75,11 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+ private final File worldDir;
+ private final ExecutorService threadPool;
+ private final DataFixer dataFixer;
+ private final Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey;
+ private final boolean removeCaches;
+
+ public ThreadedWorldUpgrader(final ResourceKey<LevelStem> dimensionType, final ResourceKey<DimensionType> worldKey, final String worldName, final File worldDir, final int threads,
+ final DataFixer dataFixer, final boolean removeCaches) {
+ final DataFixer dataFixer, final Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey, final boolean removeCaches) {
+ this.dimensionType = dimensionType;
+ this.worldKey = worldKey;
+ this.worldName = worldName;
@ -94,11 +100,12 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+ }
+ });
+ this.dataFixer = dataFixer;
+ this.generatorKey = generatorKey;
+ this.removeCaches = removeCaches;
+ }
+
+ public void convert() {
+ final File worldFolder = LevelStorageSource.getFolder(this.worldDir, this.dimensionType);
+ final File worldFolder = LevelStorageSource.getStorageFolder(this.worldDir.toPath(), this.dimensionType).toFile();
+ final DimensionDataStorage worldPersistentData = new DimensionDataStorage(new File(worldFolder, "data"), this.dataFixer);
+
+ final File regionFolder = new File(worldFolder, "region");
@ -116,12 +123,12 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+ LOGGER.info("Starting conversion now for world " + this.worldName);
+
+ final WorldInfo info = new WorldInfo(() -> worldPersistentData,
+ new ChunkStorage(regionFolder, this.dataFixer, false), this.removeCaches, this.worldKey);
+ new ChunkStorage(regionFolder.toPath(), this.dataFixer, false), this.removeCaches, this.dimensionType, this.generatorKey);
+
+ long expectedChunks = (long)regionFiles.length * (32L * 32L);
+
+ for (final File regionFile : regionFiles) {
+ final ChunkPos regionPos = RegionFileStorage.getRegionFileCoordinates(regionFile);
+ final ChunkPos regionPos = RegionFileStorage.getRegionFileCoordinates(regionFile.toPath());
+ if (regionPos == null) {
+ expectedChunks -= (32L * 32L);
+ continue;
@ -161,16 +168,18 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+ public final Supplier<DimensionDataStorage> persistentDataSupplier;
+ public final ChunkStorage loader;
+ public final boolean removeCaches;
+ public final ResourceKey<DimensionType> worldKey;
+ public final ResourceKey<LevelStem> worldKey;
+ public final Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey;
+ public final AtomicLong convertedChunks = new AtomicLong();
+ public final AtomicLong modifiedChunks = new AtomicLong();
+
+ private WorldInfo(final Supplier<DimensionDataStorage> persistentDataSupplier, final ChunkStorage loader, final boolean removeCaches,
+ final ResourceKey<DimensionType> worldKey) {
+ final ResourceKey<LevelStem> worldKey, Optional<ResourceKey<Codec<? extends ChunkGenerator>>> generatorKey) {
+ this.persistentDataSupplier = persistentDataSupplier;
+ this.loader = loader;
+ this.removeCaches = removeCaches;
+ this.worldKey = worldKey;
+ this.generatorKey = generatorKey;
+ }
+ }
+
@ -194,7 +203,7 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+ final Supplier<DimensionDataStorage> persistentDataSupplier = this.worldInfo.persistentDataSupplier;
+ final ChunkStorage loader = this.worldInfo.loader;
+ final boolean removeCaches = this.worldInfo.removeCaches;
+ final ResourceKey<DimensionType> worldKey = this.worldInfo.worldKey;
+ final ResourceKey<LevelStem> worldKey = this.worldInfo.worldKey;
+
+ for (int cz = regionCZ; cz < (regionCZ + 32); ++cz) {
+ for (int cx = regionCX; cx < (regionCX + 32); ++cx) {
@ -210,7 +219,7 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+
+ final int versionBefore = ChunkStorage.getVersion(chunkNBT);
+
+ chunkNBT = loader.getChunkData(worldKey, persistentDataSupplier, chunkNBT, chunkPos, null);
+ chunkNBT = loader.upgradeChunkTag(worldKey, persistentDataSupplier, chunkNBT, this.worldInfo.generatorKey, chunkPos, null);
+
+ boolean modified = versionBefore < SharedConstants.getCurrentVersion().getWorldVersion();
+
@ -237,10 +246,10 @@ index 0000000000000000000000000000000000000000..389faf099ff64bb2845222600552c8fc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index cf0a74b8a1c31d4bc493eb09a69ee2bd94cb6485..cfd43069ee2b6f79afb12e10d223f6bf75100034 100644
index f685ab3cc6e4fd76e8dec3d2d3627a13715cda44..36a1d58dd238c835ce3cc9c2376a86a04915d098 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -15,6 +15,7 @@ import java.nio.file.Paths;
@@ -13,6 +13,7 @@ import java.nio.file.Paths;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.BooleanSupplier;
@ -248,49 +257,47 @@ index cf0a74b8a1c31d4bc493eb09a69ee2bd94cb6485..cfd43069ee2b6f79afb12e10d223f6bf
import joptsimple.NonOptionArgumentSpec;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
@@ -283,6 +284,15 @@ public class Main {
@@ -293,6 +294,15 @@ public class Main {
}
// Paper end
+ // Paper start - fix and optimise world upgrading
+ public static void convertWorldButItWorks(ResourceKey<LevelStem> dimensionType, ResourceKey<DimensionType> worldKey, net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess worldSession,
+ DataFixer dataFixer, boolean removeCaches) {
+ public static void convertWorldButItWorks(net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.LevelStem> dimensionType, net.minecraft.resources.ResourceKey<net.minecraft.world.level.dimension.DimensionType> worldKey, net.minecraft.world.level.storage.LevelStorageSource.LevelStorageAccess worldSession,
+ DataFixer dataFixer, Optional<net.minecraft.resources.ResourceKey<com.mojang.serialization.Codec<? extends net.minecraft.world.level.chunk.ChunkGenerator>>> generatorKey, boolean removeCaches) {
+ int threads = Runtime.getRuntime().availableProcessors() * 3 / 8;
+ final ThreadedWorldUpgrader worldUpgrader = new ThreadedWorldUpgrader(dimensionType, worldKey, worldSession.getLevelId(), worldSession.levelPath.toFile(), threads, dataFixer, removeCaches);
+ final ThreadedWorldUpgrader worldUpgrader = new ThreadedWorldUpgrader(dimensionType, worldKey, worldSession.getLevelId(), worldSession.levelPath.toFile(), threads, dataFixer, generatorKey, removeCaches);
+ worldUpgrader.convert();
+ }
+ // Paper end - fix and optimise world upgrading
+
public static void forceUpgrade(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, boolean eraseCache, BooleanSupplier booleansupplier, ImmutableSet<ResourceKey<DimensionType>> worlds) { // CraftBukkit
public static void forceUpgrade(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, boolean eraseCache, BooleanSupplier continueCheck, WorldGenSettings generatorOptions) {
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, worlds, eraseCache);
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, generatorOptions, eraseCache);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 84afe36963178aa0319e219244ddbe6f0b91260b..be6b19b587ae2bbc708d712fc4327e4c56b7197c 100644
index 478eb61a9e5aab8b004e75c264eca9ca79e51fbb..d93e6d987e013bce37d511ac6c5b2481d86b9235 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -563,13 +563,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -556,11 +556,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worlddata = new PrimaryLevelData(worldsettings, generatorsettings, Lifecycle.stable());
}
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
- if (this.options.has("forceUpgrade")) {
- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.options.has("eraseCache"), () -> {
- return true;
- }, worlddata.worldGenSettings().dimensions().entrySet().stream().map((entry1) -> {
- return ResourceKey.create(Registry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry1.getKey()).location());
- }).collect(ImmutableSet.toImmutableSet()));
- }, worlddata.worldGenSettings());
- }
+ // Paper - move down
ServerLevelData iworlddataserver = worlddata;
WorldGenSettings generatorsettings = worlddata.worldGenSettings();
@@ -601,6 +595,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -592,6 +588,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
+ // Paper start - fix and optimise world upgrading
+ if (options.has("forceUpgrade")) {
+ net.minecraft.server.Main.convertWorldButItWorks(
+ dimensionKey, Level.getDimensionKey(dimensionmanager), worldSession, DataFixers.getDataFixer(), options.has("eraseCache")
+ dimensionKey, Level.getDimensionKey(dimensionmanager), worldSession, DataFixers.getDataFixer(), chunkgenerator.getTypeNameForDataFixer(), options.has("eraseCache")
+ );
+ }
+ // Paper end - fix and optimise world upgrading
@ -299,7 +306,7 @@ index 84afe36963178aa0319e219244ddbe6f0b91260b..be6b19b587ae2bbc708d712fc4327e4c
if (dimensionKey == LevelStem.OVERWORLD) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index af3f8bfae033fb77a0428515fa9da80f1851fa1f..acc8625790f8852391725ebe49057d3924bf908e 100644
index c68cb2ee352325d3f0ef98827df04b0c7bf1b293..b4d750dcb1df5852fa4a6c7b7ca8037bc06607fb 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -176,6 +176,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -319,15 +326,15 @@ index af3f8bfae033fb77a0428515fa9da80f1851fa1f..acc8625790f8852391725ebe49057d39
return this.world;
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 43510774d489bfdd30f10d521e424fa1363b8919..6496108953effae82391b5c1ea6fdec8482731cd 100644
index 91cf5878dc13e1abca0c301d1346248bda251cbf..0c5f5b2960f1a0d4bbd41c3c3baf101b4c388c43 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -31,6 +31,28 @@ public class RegionFileStorage implements AutoCloseable {
@@ -32,6 +32,28 @@ public class RegionFileStorage implements AutoCloseable {
}
// Paper start
+ public static ChunkPos getRegionFileCoordinates(File file) {
+ String fileName = file.getName();
+ public static @Nullable ChunkPos getRegionFileCoordinates(Path file) {
+ String fileName = file.getFileName().toString();
+ if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) {
+ return null;
+ }
@ -352,33 +359,31 @@ index 43510774d489bfdd30f10d521e424fa1363b8919..6496108953effae82391b5c1ea6fdec8
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8ba95157e0273c412314a506d4f6e24b0784147b..1d4608ad87dd81cda40b21583f1c6aa7ac032134 100644
index 3d3913686727af7367377deaf35681de6900aa22..9f69e1874caa087778e1de637c93719b43ac5a23 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1192,14 +1192,7 @@ public final class CraftServer implements Server {
@@ -1200,12 +1200,7 @@ public final class CraftServer implements Server {
}
worlddata.checkName(name);
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().isPresent());
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
-
- if (console.options.has("forceUpgrade")) {
- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), console.options.has("eraseCache"), () -> {
- return true;
- }, worlddata.worldGenSettings().dimensions().entrySet().stream().map((entry) -> {
- return ResourceKey.create(Registry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry.getKey()).location());
- }).collect(ImmutableSet.toImmutableSet()));
- }, worlddata.worldGenSettings());
- }
+ // Paper - move down
long j = BiomeManager.obfuscateSeed(creator.seed());
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
@@ -1228,6 +1221,14 @@ public final class CraftServer implements Server {
@@ -1234,6 +1229,14 @@ public final class CraftServer implements Server {
}
}
+ // Paper start - fix and optimise world upgrading
+ if (console.options.has("forceUpgrade")) {
+ net.minecraft.server.Main.convertWorldButItWorks(
+ actualDimension, net.minecraft.world.level.Level.getDimensionKey(dimensionmanager), worldSession, DataFixers.getDataFixer(), console.options.has("eraseCache")
+ actualDimension, net.minecraft.world.level.Level.getDimensionKey(dimensionmanager), worldSession, DataFixers.getDataFixer(), chunkgenerator.getTypeNameForDataFixer(), console.options.has("eraseCache")
+ );
+ }
+ // Paper end - fix and optimise world upgrading

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add Mob#lookAt API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index e0022ea4bf228eef8384f20cfc717076c5ca5c99..2386edf499cb292241f6ba60c1cdb46f2fe704ff 100644
index d7bc601f2cb4e22565eeebb2d8ebe051748de92a..0613ab9979a32a005fa2cbf24125022713daca3a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -86,5 +86,53 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {

Datei anzeigen

@ -11,7 +11,7 @@ Tested-by: Mariell Hoversholm <proximyst@proximyst.com>
Reviewed-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index bdd4f4db9849d9107b5c62d5e83b1277621f49f1..9d09ec3b127e3440bef6b248578dec109407f9ff 100644
index a6eadf71957b37e2acc5d09f0ce4ee961810891f..16954170ffeeedf18d8f8079b5e75915e0c682ba 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -614,6 +614,11 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -27,10 +27,10 @@ index bdd4f4db9849d9107b5c62d5e83b1277621f49f1..9d09ec3b127e3440bef6b248578dec10
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 2d53dba26af9d372a507ca2d46dec0cb5b9e41b1..7ce1ce59eeba8b57cd76b1c9c561733b476e7ebf 100644
index 331c85d236922d7a4b5732cb09aa708830e1393c..82cee660a029547eda8abdf4188b9d1fb4ba0d53 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -233,6 +233,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -231,6 +231,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
// this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
@ -51,7 +51,7 @@ index 2d53dba26af9d372a507ca2d46dec0cb5b9e41b1..7ce1ce59eeba8b57cd76b1c9c561733b
InetAddress inetaddress = null;
if (!this.getLocalIp().isEmpty()) {
@@ -242,12 +256,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -240,12 +254,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (this.getPort() < 0) {
this.setPort(dedicatedserverproperties.serverPort);
}
@ -69,7 +69,7 @@ index 2d53dba26af9d372a507ca2d46dec0cb5b9e41b1..7ce1ce59eeba8b57cd76b1c9c561733b
DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString());
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 5baf51571398d6af626dfa6be3b2e42d6dd29059..961660f6f9e00b93252519e38b74c66c53388ed2 100644
index 940b52e0b22b009f819de0dc05436a1820390bde..f7aa0125e4724f1efddf28814f926289c1ae37d4 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -78,7 +78,12 @@ public class ServerConnectionListener {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityInsideBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index 177d1da44c83da5f99ae91891dec41dc210bd31d..d2fb4d5738919c1e7b9a7f08aad2e4b607414a53 100644
index ed216f0b6cf031883c4ca4123d82c9fc542b915e..4d1f94c576b65e067efce95d5ef8c0078453b494 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -123,6 +123,7 @@ public abstract class BaseFireBlock extends Block {
@@ -121,6 +121,7 @@ public abstract class BaseFireBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -17,7 +17,7 @@ index 177d1da44c83da5f99ae91891dec41dc210bd31d..d2fb4d5738919c1e7b9a7f08aad2e4b6
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
index 94c48393e467f61cb763e8c44baccdef446be474..14de86667e9c05da95e807177d8c44cdaa765f18 100644
index 7cc20edb0cc3994a6c23ae99801bb254869e424f..2036006b934ba1f27da606320b4c456af019a361 100644
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -67,6 +67,7 @@ public abstract class BasePressurePlateBlock extends Block {
@ -28,8 +28,20 @@ index 94c48393e467f61cb763e8c44baccdef446be474..14de86667e9c05da95e807177d8c44cd
if (!world.isClientSide) {
int i = this.getSignalForState(state);
diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
index bc472d86ae79437dab87454caa60d64399a14715..3f434ac77611a81889b15c118a0fca57cc10a6bb 100644
--- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -171,6 +171,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
if (!world.isClientSide) {
if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
// CraftBukkit start - tilt dripleaf
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
index 68135caecf506a5a2ad36def1a94a83eec3abe32..17cffb3bd362dc4a69535425f7289af7ccb640eb 100644
index d99399eca5e30423f007c0e0665e8c14374c503c..ee3045133965da67611f180835fa111998f918b4 100644
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -38,6 +38,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@ -41,7 +53,7 @@ index 68135caecf506a5a2ad36def1a94a83eec3abe32..17cffb3bd362dc4a69535425f7289af7
if (blockState.isAir()) {
entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
index 698a80029f4410045af486f926324b3fdb98bb64..af6730322a7cea0c4f9ca92c289698554bf86b3a 100644
index 70161d554163779ba53ad278c6af95b9da87edce..b7f37475192bf79252482314080c9ba08e9aefdb 100644
--- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
@@ -186,6 +186,7 @@ public abstract class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock
@ -53,7 +65,7 @@ index 698a80029f4410045af486f926324b3fdb98bb64..af6730322a7cea0c4f9ca92c28969855
this.checkPressed(state, world, pos);
}
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
index 722f1816cd4130fa4b1e2310badedc77ab96eee6..2a02fdf58640d26b82e0ca22d0d8ff3326921b61 100644
index 00ada22889dafb7ae8e8740cd3eb8370fbb417eb..fa36ad3bb63764778aa7201d90e331e64292c7b4 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -117,6 +117,7 @@ public class CactusBlock extends Block {
@ -65,7 +77,7 @@ index 722f1816cd4130fa4b1e2310badedc77ab96eee6..2a02fdf58640d26b82e0ca22d0d8ff33
entity.hurt(DamageSource.CACTUS, 1.0F);
CraftEventFactory.blockDamage = null; // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
index a1f3d145414979a1994d608d525471d95fd2f72e..7d0d6da335ff3bf810fa951553b58ff8a3267b0f 100644
index eeb729428356b116f650d54f44dacf5694969f7d..0b60b545271e62df86a0eb3c1f0f315a014b24cd 100644
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
@@ -94,6 +94,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
@ -77,7 +89,7 @@ index a1f3d145414979a1994d608d525471d95fd2f72e..7d0d6da335ff3bf810fa951553b58ff8
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, pos); // CraftBukkit
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index ea8047d4509632c9bc8247356f6eb3d1289db672..6dda5eeca4e310eceb2598322803bfafc184e9c7 100644
index 75dc5d9a750a49b6ad9fd2aba99b9f84c2663e10..b4fd9af8805f451c87a91f319c15fa132b91faf7 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -163,6 +163,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@ -89,7 +101,7 @@ index ea8047d4509632c9bc8247356f6eb3d1289db672..6dda5eeca4e310eceb2598322803bfaf
world.destroyBlock(pos, true, entity);
}
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 63c7f2cf530ac9562960ae5a3cbc6e511a009377..3705452f1b57d3bc1307411c7367529de0fa47e1 100644
index b68e3ced407a9e6b386cbd379e58c86f195eb17a..4dc92fafc3ea593afd19cfc7c5e6b1591408d095 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -44,6 +44,7 @@ public class DetectorRailBlock extends BaseRailBlock {
@ -101,7 +113,7 @@ index 63c7f2cf530ac9562960ae5a3cbc6e511a009377..3705452f1b57d3bc1307411c7367529d
if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) {
this.checkPressed(world, pos, state);
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 2cd9584aae80e5bf40d0a53417692758a17d05d6..739c9c3a49fd3893ac39962a02a5e3620dc4fe06 100644
index 40fe9e093f32c65947973daa21afec58ca7976f8..b8305112c759ecb62ef9ad972e57ff85ceff20dc 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -44,6 +44,7 @@ public class EndPortalBlock extends BaseEntityBlock {
@ -110,10 +122,10 @@ index 2cd9584aae80e5bf40d0a53417692758a17d05d6..739c9c3a49fd3893ac39962a02a5e362
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper
if (world instanceof ServerLevel && !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
ResourceKey<Level> resourcekey = world.getTypeKey() == DimensionType.END_LOCATION ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey);
diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
index 6f7bcf0ae17aec3e937ff52084f53681aacb9398..c6a988fdc92cd7329b4fd7c6b415fd2fe01aa8a3 100644
index 0549256cbd7028c82bf82ccc4ff64219df7e0906..683f24251baf8ef3bef8f32ba83dc7f0e8ed7d70 100644
--- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
@@ -55,6 +55,7 @@ public class HoneyBlock extends HalfTransparentBlock {
@ -149,10 +161,10 @@ index f0a3ef0529951e7732602d358ddea1782001db7e..6588b207d93d96934e72176874ba60c8
entity.lavaHurt();
}
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 7f42886ce6dfff6807d3b38e26a1b122941d9f8c..3de9fc8873327ed14f231dde08ddfb24621a05da 100644
index f0a4c52b9cba6ebf7712950852aba4b2e0083f3d..e6ea389350cf391a87c4c388ed9a6325bdceb90d 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -60,6 +60,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@@ -59,6 +59,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -161,7 +173,7 @@ index 7f42886ce6dfff6807d3b38e26a1b122941d9f8c..3de9fc8873327ed14f231dde08ddfb24
// CraftBukkit start
if (entity.mayInteract(world, pos)) {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index cfea29f5bf1c5e74a0292c1344baaaa49c2f4403..bc2f2c69d437e99cb965cede7dfd42228151b26c 100644
index d2b82872f6f8c3febb6c4b6468fd39f3549b1ed8..82c132bc90381aab6a29d50319ff40e7383eb7f2 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -85,6 +85,7 @@ public class NetherPortalBlock extends Block {
@ -173,10 +185,10 @@ index cfea29f5bf1c5e74a0292c1344baaaa49c2f4403..bc2f2c69d437e99cb965cede7dfd4222
// CraftBukkit start - Entity in portal
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
index ceda744e9f7e48051e046eb3171e80bded739ba8..1187a7382b8849524f99bbd8d12b43677f1053cd 100644
index dcdcbb1a2acffab2c5b389e6ecb853364f689021..5e22a1cd1a0902d63f091bbfb8ae518b12c66f09 100644
--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -54,6 +54,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@@ -55,6 +55,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -197,7 +209,7 @@ index 1a5590ff8e5122b5c7587347fcc38d73671c2747..71abf800e623336124bd9a955e07db49
entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D));
if (!world.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) {
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
index baa14c23016df6687984447d1a1f071b29aa7b49..9cafee5bd1e432ed5f114c73cf616798cd71a379 100644
index 0c24c025e537b501f583aa3de920e18abc6ca259..6b40bf94fbaa18605b59b92ad1582e8dc3a6a9cd 100644
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -121,6 +121,7 @@ public class TripWireBlock extends Block {
@ -233,7 +245,7 @@ index 6964308822ebf8a7027ce426062ba43a70c20c15..763fa221c562e96c2abd09c7055e91a8
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
index adf1e71323ea84856ec2871b8e3227f29ff59c40..5b6fe6fa607c38e42a30d6c7c6f6fc93af93dd20 100644
index 02779f3695c6609f07db326334b3c270cd7bf8e6..bb322ffd3dddb14d97884c0cc78d098577daad05 100644
--- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
@@ -46,6 +46,7 @@ public class WitherRoseBlock extends FlowerBlock {

Datei anzeigen

@ -20,7 +20,7 @@ index 7e3826b271b2db3b48e6e21ac2e66911bf8993aa..393a19335c52b6e63d37aacdfbeff93e
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d88515fcaab8672bc1ace12554372a0b6ab57947..ff1f178b69efc4f167cb34095b7fd3acd4d00680 100644
index 5e6941963f12a7f11603884a1b0bf844ea3a3514..5996e8b3eea10aabdd2374356016207a44a77f72 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -499,6 +499,19 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 044aa3df0c26b7a64eefcacf0b6b5c2d9224938c..f28aefd9192b26f39e71826fa87cca60a799be39 100644
index d09a9886a6fa8a7e180ab0c1c4a5b437b621f236..ddfd7eaf71f870037989024ae37322d25a221499 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -476,8 +476,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -468,8 +468,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setClearWeatherTime(clearDuration);
this.serverLevelData.setRainTime(rainDuration);
this.serverLevelData.setThunderTime(rainDuration);
@ -19,7 +19,7 @@ index 044aa3df0c26b7a64eefcacf0b6b5c2d9224938c..f28aefd9192b26f39e71826fa87cca60
}
@Override
@@ -540,8 +540,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -859,8 +859,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.serverLevelData.setThunderTime(j);
this.serverLevelData.setRainTime(k);
this.serverLevelData.setClearWeatherTime(i);
@ -30,9 +30,9 @@ index 044aa3df0c26b7a64eefcacf0b6b5c2d9224938c..f28aefd9192b26f39e71826fa87cca60
}
this.oThunderLevel = this.thunderLevel;
@@ -921,14 +921,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -926,14 +926,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
private void stopWeather() {
private void resetWeatherCycle() {
// CraftBukkit start
- this.serverLevelData.setRaining(false);
+ this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night
@ -48,40 +48,31 @@ index 044aa3df0c26b7a64eefcacf0b6b5c2d9224938c..f28aefd9192b26f39e71826fa87cca60
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
index cd840dc4a8ca432868fb3e9c912ea928e5303e0d..4d0af984490b556a9911c3b8fdca1e168e6fe932 100644
index d88003a29d382d8952964257601f93c5fe95fa8b..30cd6dc004ef1d1518c9a10304ea2a20c0616831 100644
--- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
@@ -330,21 +330,26 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -331,6 +331,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setThundering(boolean thundering) {
+ // Paper start
+ this.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.UNKNOWN);
+ }
+ public void setThundering(boolean flag, org.bukkit.event.weather.ThunderChangeEvent.Cause cause) {
+ public void setThundering(boolean thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause cause) {
+ // Paper end
// CraftBukkit start
- if (this.thundering == thundering) {
+ if (this.thundering == flag) {
if (this.thundering == thundering) {
return;
}
@@ -338,7 +343,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
- ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering);
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, flag, cause); // Paper
+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering, cause); // Paper
Bukkit.getServer().getPluginManager().callEvent(thunder);
if (thunder.isCancelled()) {
return;
}
}
// CraftBukkit end
- this.thundering = thundering;
+ this.thundering = flag;
}
@Override
@@ -364,6 +369,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -365,6 +370,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@Override
public void setRaining(boolean raining) {
@ -94,7 +85,7 @@ index cd840dc4a8ca432868fb3e9c912ea928e5303e0d..4d0af984490b556a9911c3b8fdca1e16
// CraftBukkit start
if (this.raining == raining) {
return;
@@ -371,7 +382,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
@@ -372,7 +383,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
if (world != null) {
@ -104,7 +95,7 @@ index cd840dc4a8ca432868fb3e9c912ea928e5303e0d..4d0af984490b556a9911c3b8fdca1e16
if (weather.isCancelled()) {
return;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8d8b1b881878200b0bf9c320c72b71b8c3b839d2..483ca752016c0d5e669b462396e50e83b66d3ef1 100644
index 35b3e76cde3449b805435e6af8e8a296fee905d7..ddaf83de1392c631e7c7a8aa13a8a2e02d2ec04d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1170,7 +1170,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

Datei anzeigen

@ -21,7 +21,7 @@ index 9d0c272b1d89a96b0b63603fa8e4649f11fb6c51..d5fdf4504a0ca76fb0483f4ae5861c93
+ // Paper end - More Lidded Block API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
index 6a1f47c58f1186f12fd112feedaf11da85b0bdcc..850a325cc98965c6f9f7ae8b48fdc3c8c8833fb9 100644
index 9796e2d3cd9601416124ad5c36f962ed3f8682e8..03edde8c3b429d541b30d5ee9d15aa03bfb88d38 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
@@ -75,4 +75,11 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Limit item frame cursors on maps
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e381642d22826defd38a1d0c20c99a6db0b1ce66..88e6919e7c850727100a5739ed3ac332bc004b40 100644
index 3bdbb31e050444d4052c6cac4b0af8454196ab8c..cc04fe5b0275ef5466fad2ca84f2273d274baadd 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -858,5 +858,10 @@ public class PaperWorldConfig {
@@ -767,4 +767,9 @@ public class PaperWorldConfig {
private void allowUsingSignsInsideSpawnProtection() {
allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
}
@ -18,12 +18,11 @@ index e381642d22826defd38a1d0c20c99a6db0b1ce66..88e6919e7c850727100a5739ed3ac332
+ mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit);
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index ad6c3459712d08de248b8ef299ddbedfda6c7ac2..6f64d1ce0f5b20e1579f8af64c08ef8fc4e4444b 100644
index 77fde68dae2e64ef54b1cee7ab8b33f4609b3675..77209dfe179f97a5be89bdf812622773b90e6214 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -296,8 +296,12 @@ public class MapItemSavedData extends SavedData {
@@ -295,8 +295,12 @@ public class MapItemSavedData extends SavedData {
MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 87a50ca1d2482a384944e13aac32c3a81659970f..98eb8318413014f0650dc5c80125aa84b51cfc93 100644
index d93e6d987e013bce37d511ac6c5b2481d86b9235..688d6a2ce9bc21ed24251b59ba0f09508f04e640 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2126,7 +2126,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2045,7 +2045,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)
@ -57,10 +57,10 @@ index 708ac03d5a849bf09c49547306e4a8c5a5ef8d91..5a8df368a4a25839cd4ac9be6972da2e
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079c6f78444 100644
index 311df240858d4416306a795d893bdf7da403e90b..85e24920e774e84f9fa63a4fb088c07caf2833da 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -319,7 +319,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientIsFloating && !this.player.isSleeping()) {
if (++this.aboveGroundTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
@ -69,7 +69,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
} else {
@@ -339,7 +339,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -338,7 +338,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
if (++this.aboveGroundVehicleTickCount > 80) {
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
@ -78,7 +78,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
} else {
@@ -361,7 +361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -360,7 +360,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@ -87,7 +87,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
} else {
if (elapsedTime >= 15000L) { // 15 seconds
@@ -391,7 +391,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -390,7 +390,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
@ -96,7 +96,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
}
@@ -416,14 +416,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -415,14 +415,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void disconnect(String s) {
// Paper start
@ -122,7 +122,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
// Paper end
// CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) {
@@ -431,7 +439,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -430,7 +438,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, this.player.getBukkitEntity().displayName()); // Paper - Adventure
@ -131,7 +131,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
@@ -503,7 +511,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -502,7 +510,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
@ -140,7 +140,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
} else {
Entity entity = this.player.getRootVehicle();
@@ -744,13 +752,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -743,13 +751,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
@ -156,7 +156,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
// Paper end
@@ -902,7 +910,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -901,7 +909,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start - validate pick item position
if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -165,7 +165,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
@@ -1061,7 +1069,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1060,7 +1068,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
if (byteLength > 256 * 4) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
@ -174,7 +174,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
byteTotal += byteLength;
@@ -1084,14 +1092,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1083,14 +1091,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
@ -191,7 +191,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
this.lastBookTick = MinecraftServer.currentTick;
@@ -1215,7 +1223,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1214,7 +1222,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
@ -200,7 +200,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
} else {
ServerLevel worldserver = this.player.getLevel();
@@ -1632,7 +1640,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1637,7 +1645,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.dropCount++;
if (this.dropCount >= 20) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
@ -209,7 +209,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
}
@@ -1839,7 +1847,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1844,7 +1852,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
@ -218,7 +218,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
// Paper start
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()];
@@ -1944,7 +1952,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1949,7 +1957,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime();
} else {
ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -227,7 +227,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
}
@@ -1960,7 +1968,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1965,7 +1973,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -236,7 +236,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
}
@@ -2033,7 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2038,7 +2046,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Waitable waitable = new Waitable() {
@Override
protected Object evaluate() {
@ -245,7 +245,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return null;
}
};
@@ -2048,7 +2056,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2053,7 +2061,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
throw new RuntimeException(e);
}
} else {
@ -254,7 +254,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
// CraftBukkit end
}
@@ -2321,7 +2329,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2326,7 +2334,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Spigot Start
if ( entity == this.player && !this.player.isSpectator() )
{
@ -263,7 +263,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
// Spigot End
@@ -2412,7 +2420,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2421,7 +2429,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// CraftBukkit end
} else {
@ -272,7 +272,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
@@ -2812,7 +2820,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2821,7 +2829,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
@ -281,7 +281,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
return;
}
}
@@ -3002,7 +3010,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3006,7 +3014,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -290,7 +290,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
});
// Paper end
}
@@ -3048,7 +3056,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3052,7 +3060,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -299,7 +299,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3058,7 +3066,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3062,7 +3070,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -308,7 +308,7 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
} else {
try {
@@ -3076,7 +3084,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3080,7 +3088,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -318,10 +318,10 @@ index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 34dd85bbaa2e693d9b6a4db880b42501b3b9225c..8528cb537ea2329e866dee20fe1e50349495ad17 100644
index bc2f8dd01039d855a174358825d2fdc8d0f0f526..de8a14e86b337954fd0f730c1096758e1db409aa 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -717,7 +717,7 @@ public abstract class PlayerList {
@@ -713,7 +713,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next();
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
@ -330,7 +330,7 @@ index 34dd85bbaa2e693d9b6a4db880b42501b3b9225c..8528cb537ea2329e866dee20fe1e5034
}
// Instead of kicking then returning, we need to store the kick reason
@@ -1369,8 +1369,8 @@ public abstract class PlayerList {
@@ -1332,8 +1332,8 @@ public abstract class PlayerList {
// Paper end
// CraftBukkit start - disconnect safely
for (ServerPlayer player : this.players) {
@ -342,10 +342,10 @@ index 34dd85bbaa2e693d9b6a4db880b42501b3b9225c..8528cb537ea2329e866dee20fe1e5034
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d9445e8f95013e687274aa3228faf11745ca4898..73ca3b00cbc8b61ca07ae342fec27c9942034495 100644
index 4c1430a6499dd44bb07c9d13de511d365a93db58..b5df4beaefe68b13e402b6f71d67ca5ddd47c6f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -499,16 +499,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -502,16 +502,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
if (this.getHandle().connection == null) return;