mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 04:17:44 +01:00
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6379)
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
This commit is contained in:
parent
6b4f50a1cb
commit
037884fc65
@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ testImplementation("junit:junit:4.13.1")
|
||||
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||
+ testImplementation("org.ow2.asm:asm-tree:9.1")
|
||||
+ testImplementation("org.ow2.asm:asm-tree:9.2")
|
||||
+}
|
||||
+
|
||||
+configure<PublishingExtension> {
|
||||
@ -212,7 +212,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <dependency>
|
||||
- <groupId>org.ow2.asm</groupId>
|
||||
- <artifactId>asm-tree</artifactId>
|
||||
- <version>9.1</version>
|
||||
- <version>9.2</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
|
@ -47,21 +47,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @return true if ultrawarm, false if not
|
||||
+ * @deprecated use {@link #isUltraWarm()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ boolean isUltrawarm();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the world is natural.
|
||||
+ * <p>
|
||||
+ * If {@code false}, compasses will spin randomly in the world.
|
||||
+ * If {@code true}, nether portals will spawn zombified piglins.
|
||||
+ * </p>
|
||||
+ *
|
||||
+ * @return true or false
|
||||
+ */
|
||||
+ boolean isNatural();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the coordinate scaling of this world.
|
||||
+ *
|
||||
+ * @return the coordinate scale
|
||||
@ -72,45 +63,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * Checks if the world has skylight access
|
||||
+ *
|
||||
+ * @return whether there is skylight
|
||||
+ * @deprecated use {@link #hasSkyLight()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ boolean hasSkylight();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the world has a bedrock ceiling
|
||||
+ *
|
||||
+ * @return whether the world has a bedrock ceiling
|
||||
+ * @deprecated use {@link #hasCeiling()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ boolean hasBedrockCeiling();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if piglins will turn into Zombified Piglins in this world
|
||||
+ *
|
||||
+ * @return whether Piglins will <i>not</i> transform
|
||||
+ */
|
||||
+ boolean isPiglinSafe();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if beds work
|
||||
+ *
|
||||
+ * @return whether beds work
|
||||
+ * @deprecated use {@link #isBedWorks()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ boolean doesBedWork();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if respawn anchors work
|
||||
+ *
|
||||
+ * @return whether respawn anchors work
|
||||
+ * @deprecated use {@link #isRespawnAnchorWorks()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ boolean doesRespawnAnchorWork();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this world supports raids
|
||||
+ *
|
||||
+ * @return whether this world supports raids
|
||||
+ */
|
||||
+ boolean hasRaids();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this world has a fixed time
|
||||
+ *
|
||||
+ * @return whether this world has fixed time
|
||||
|
@ -74,8 +74,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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 (!entity.fireImmune() && (Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
|
@ -1252,9 +1252,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
|
||||
Component defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||
|
||||
- String deathmessage = defaultMessage.getString();
|
||||
String deathmessage = defaultMessage.getString();
|
||||
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
|
||||
- org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory);
|
||||
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure
|
||||
|
||||
@ -2495,8 +2494,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage);
|
||||
+ PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage, stringDeathMessage); // Paper - Adventure
|
||||
event.setKeepInventory(keepInventory);
|
||||
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
|
||||
org.bukkit.World world = entity.getWorld();
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
* Server methods
|
||||
*/
|
||||
|
@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
}
|
||||
if (javaVersion > 60.0) {
|
||||
System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 16 is supported.");
|
||||
if (javaVersion > 61.0) {
|
||||
System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 17 is supported.");
|
||||
- return;
|
||||
+ if (!Boolean.getBoolean("Paper.IgnoreJavaVersion")) return; // Paper
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- }
|
||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
|
||||
+ implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
|
||||
implementation("org.ow2.asm:asm:9.1")
|
||||
+ implementation("org.ow2.asm:asm-commons:9.1") // Paper - ASM event executor generation
|
||||
implementation("org.ow2.asm:asm:9.2")
|
||||
+ implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation
|
||||
implementation("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
// This includes junit transitively for whatever reason
|
||||
isTransitive = false
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Malfrador <malfrador@gmail.com>
|
||||
Date: Wed, 7 Jul 2021 12:48:50 +0200
|
||||
Subject: [PATCH] Config option for named entity death logging
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
deobfuscateStacktraces = getBoolean("settings.loggers.deobfuscate-stacktraces", deobfuscateStacktraces);
|
||||
}
|
||||
|
||||
+ public static boolean logNamedEntityDeaths = true;
|
||||
+ private static void namedEntityDeaths() {
|
||||
+ logNamedEntityDeaths = getBoolean("settings.log-named-entity-deaths", logNamedEntityDeaths);
|
||||
+ }
|
||||
+
|
||||
public static int itemValidationDisplayNameLength = 8192;
|
||||
public static int itemValidationLocNameLength = 8192;
|
||||
public static int itemValidationLoreLineLength = 8192;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
this.stopSleeping();
|
||||
}
|
||||
|
||||
- if (!this.level.isClientSide && this.hasCustomName()) {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.logNamedEntityDeaths && !this.level.isClientSide && this.hasCustomName()) { // Paper - add setting for entity death logging
|
||||
LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString());
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// CraftBukkit start
|
||||
public String displayName;
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
Component defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||
|
||||
String deathmessage = defaultMessage.getString();
|
||||
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
|
||||
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure
|
||||
+ // Paper start - cancellable death event
|
||||
+ if (event.isCancelled()) {
|
||||
@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
|
||||
if (!this.level.isClientSide && this.hasCustomName()) {
|
||||
LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString());
|
||||
if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
|
||||
}
|
||||
+ */ // Paper - move down to make death event cancellable - this is the runKillTrigger below
|
||||
|
||||
@ -136,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ if (!this.level.isClientSide && this.hasCustomName()) {
|
||||
+ LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString());
|
||||
+ if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
|
||||
+ }
|
||||
+
|
||||
+ this.getCombatTracker().recheckStatus();
|
||||
@ -318,9 +318,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
CraftPlayer entity = victim.getBukkitEntity();
|
||||
PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage, stringDeathMessage); // Paper - Adventure
|
||||
event.setKeepInventory(keepInventory);
|
||||
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
|
||||
+ populateFields(victim, event); // Paper - make cancellable
|
||||
org.bukkit.World world = entity.getWorld();
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
@ -31,11 +31,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isNatural() {
|
||||
+ return getHandle().dimensionType().natural();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double getCoordinateScale() {
|
||||
+ return getHandle().dimensionType().coordinateScale();
|
||||
+ }
|
||||
@ -51,11 +46,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isPiglinSafe() {
|
||||
+ return getHandle().dimensionType().piglinSafe();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doesBedWork() {
|
||||
+ return getHandle().dimensionType().bedWorks();
|
||||
+ }
|
||||
@ -66,11 +56,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasRaids() {
|
||||
+ return getHandle().dimensionType().hasRaids();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isFixedTime() {
|
||||
+ return getHandle().dimensionType().hasFixedTime();
|
||||
+ }
|
||||
|
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") {
|
||||
+ exclude(group = "org.apache.logging.log4j", module = "log4j-api")
|
||||
+ }
|
||||
+ implementation("org.ow2.asm:asm:9.1")
|
||||
+ implementation("org.ow2.asm:asm:9.2")
|
||||
+ implementation("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
+ // This includes junit transitively for whatever reason
|
||||
+ isTransitive = false
|
||||
@ -244,7 +244,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- <dependency>
|
||||
- <groupId>org.ow2.asm</groupId>
|
||||
- <artifactId>asm</artifactId>
|
||||
- <version>9.1</version>
|
||||
- <version>9.2</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- deprecated API depend -->
|
||||
|
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
|
||||
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
|
||||
implementation("org.ow2.asm:asm:9.1")
|
||||
implementation("org.ow2.asm:asm:9.2")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 21 Jul 2021 11:46:28 -0700
|
||||
Subject: [PATCH] call EntityDamageByBlockEvent for campfires
|
||||
|
||||
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
|
||||
@@ -0,0 +0,0 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
|
||||
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 (!entity.fireImmune() && (Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); // Paper
|
||||
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // Paper
|
||||
}
|
||||
|
||||
super.entityInside(state, world, pos, entity);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
cause = DamageCause.HOT_FLOOR;
|
||||
} else if (source == DamageSource.MAGIC) {
|
||||
cause = DamageCause.MAGIC;
|
||||
+ // Paper start
|
||||
+ } else if (source == DamageSource.IN_FIRE) {
|
||||
+ cause = DamageCause.FIRE;
|
||||
+ // Paper end
|
||||
} else {
|
||||
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.msgId));
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit e0598aa29ef8f0622378d929c0ed0542e698db60
|
||||
Subproject commit 974452512a4638f2692cc7baff5baf77401349ba
|
@ -1 +1 @@
|
||||
Subproject commit 2cdc6b1e4cc28d67eeb6397b5650ecc1e13efdfa
|
||||
Subproject commit 61e4ca7b9e7dbc0ee899140a7b194248edc3f493
|
@ -1 +1 @@
|
||||
Subproject commit 18c71bf4fd43113ac9b24c21afe6d88c16170f30
|
||||
Subproject commit ff89b973e62ca3b6085aeeb474f2568e45ac02be
|
Loading…
Reference in New Issue
Block a user