mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
Merge branch 'PaperMC:master' into paper-info
This commit is contained in:
commit
92b405dc50
@ -1,6 +1,4 @@
|
||||
name: Feature Request
|
||||
description: Suggest an idea for Paper
|
||||
labels: [ "status: needs triage", "type: feature" ]
|
||||
labels: ["status: needs triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
3
.github/ISSUE_TEMPLATE/config.yml
vendored
3
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,5 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Feature Request
|
||||
url: https://github.com/PaperMC/Paper/discussions/new?category=ideas
|
||||
about: Suggest an idea for Paper
|
||||
- name: PaperMC Discord
|
||||
url: https://discord.gg/papermc
|
||||
about: If you are having issues with timings or have other minor issues, come ask us on our Discord server!
|
||||
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -71,7 +71,7 @@ jobs:
|
||||
- name: Apply Patches
|
||||
run: |
|
||||
git config --global user.email "no-reply@github.com"
|
||||
git config --global user.name "Github Actions"
|
||||
git config --global user.name "GitHub Actions"
|
||||
./gradlew applyPatches --stacktrace
|
||||
|
||||
- name: Build
|
||||
|
44
.github/workflows/projects.yml
vendored
44
.github/workflows/projects.yml
vendored
@ -33,25 +33,23 @@ jobs:
|
||||
column-field: Status
|
||||
label-to-column-map: |
|
||||
{
|
||||
"status: needs triage": "🕑 Needs Triage",
|
||||
"resolution: awaiting response": "⌛ Awaiting Response",
|
||||
"resolution: cannot reproduce": "Invalid",
|
||||
"resolution: duplicate": "Invalid",
|
||||
"resolution: incomplete": "Invalid",
|
||||
"resolution: invalid": "Invalid",
|
||||
"resolution: superseded": "Invalid",
|
||||
"resolution: unsupported": "Invalid",
|
||||
"resolution: won't fix": "Invalid",
|
||||
"resolution: works as intended": "Invalid",
|
||||
"status: accepted": "✅ Accepted",
|
||||
"status: unlikely": "✅ Accepted",
|
||||
"status: in progress": "Needs Work",
|
||||
"status: rebase required": "Needs Work",
|
||||
"status: blocked": "Needs Work",
|
||||
"status: defer upstream": "Needs Work",
|
||||
"status: in progress": "Needs Work",
|
||||
"status: input wanted": "Needs Work",
|
||||
"we must go deeper": "Needs Work",
|
||||
"has rough edges": "Needs Work",
|
||||
"status: waiting on reporter": "⌛ Waiting for Reporter",
|
||||
"resolution: works-as-intended": "Invalid",
|
||||
"resolution: invalid": "Invalid",
|
||||
"resolution: wontfix": "Invalid",
|
||||
"resolution: duplicate": "Invalid",
|
||||
"resolution: cannot reproduce": "Invalid",
|
||||
"resolution: unsupported": "Invalid",
|
||||
"resolution: incomplete": "Invalid",
|
||||
"resolution: superseded": "Invalid"
|
||||
"status: needs triage": "🕑 Needs Triage",
|
||||
"status: rebase required": "Needs Work",
|
||||
"status: unlikely": "✅ Accepted"
|
||||
}
|
||||
|
||||
- uses: PaperMC/update-projects-action@v0.2.0
|
||||
@ -65,14 +63,14 @@ jobs:
|
||||
# include "status: needs triage" below to catch any closed issues without setting a resolution
|
||||
label-to-column-map: |
|
||||
{
|
||||
"status: accepted": "Done",
|
||||
"status: needs triage": "Invalid",
|
||||
"resolution: works-as-intended": "Invalid",
|
||||
"resolution: invalid": "Invalid",
|
||||
"resolution: wontfix": "Invalid",
|
||||
"resolution: duplicate": "Invalid",
|
||||
"resolution: cannot reproduce": "Invalid",
|
||||
"resolution: unsupported": "Invalid",
|
||||
"resolution: duplicate": "Invalid",
|
||||
"resolution: incomplete": "Invalid",
|
||||
"resolution: superseded": "Invalid"
|
||||
"resolution: invalid": "Invalid",
|
||||
"resolution: superseded": "Invalid",
|
||||
"resolution: unsupported": "Invalid",
|
||||
"resolution: won't fix": "Invalid",
|
||||
"resolution: works as intended": "Invalid",
|
||||
"status: accepted": "Done",
|
||||
"status: needs triage": "Invalid"
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ which can be obtained in (most) package managers such as `apt` (Debian / Ubuntu;
|
||||
you will most likely use this for WSL), `homebrew` (macOS / Linux), and more:
|
||||
|
||||
- `git` (package `git` everywhere);
|
||||
- A Java 17 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
|
||||
- A Java 21 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
|
||||
- [Adoptium](https://adoptium.net/) has builds for most operating systems.
|
||||
- Paper requires JDK 17 to build, however, makes use of Gradle's
|
||||
- Paper requires JDK 21 to build, however, makes use of Gradle's
|
||||
[Toolchains](https://docs.gradle.org/current/userguide/toolchains.html)
|
||||
feature to allow building with only JRE 11 or later installed. (Gradle will
|
||||
automatically provision JDK 17 for compilation if it cannot find an existing
|
||||
automatically provision JDK 21 for compilation if it cannot find an existing
|
||||
install).
|
||||
|
||||
If you're on Windows, check
|
||||
@ -42,11 +42,11 @@ If you're compiling with Docker, you can use Adoptium's
|
||||
[`eclipse-temurin`](https://hub.docker.com/_/eclipse-temurin/) images like so:
|
||||
|
||||
```console
|
||||
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:17.0.1_12-jdk bash
|
||||
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:21.0.3_9-jdk bash
|
||||
Pulling image...
|
||||
|
||||
root@abcdefg1234:/# javac -version
|
||||
javac 17.0.1
|
||||
javac 21.0.3
|
||||
```
|
||||
|
||||
## Understanding Patches
|
||||
@ -237,6 +237,10 @@ into most IDEs and formatters by default. There are a few notes, however:
|
||||
There are exceptions, especially in Spigot-related files
|
||||
- When in doubt or the code around your change is in a clearly different style,
|
||||
use the same style as the surrounding code.
|
||||
- `var` usage is heavily discouraged, as it makes reading patch files a lot harder
|
||||
and can lead to confusion during updates due to changed return types. The only
|
||||
exception to this is if a line would otherwise be way too long/filled with hard
|
||||
to parse generics in a case where the base type itself is already obvious
|
||||
|
||||
### Imports
|
||||
When adding new imports to a class in a file not created by the current patch, use the fully qualified class name
|
||||
|
@ -40,7 +40,7 @@ How To (Plugin Developers)
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.5-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
@ -53,7 +53,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.5-R0.1-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
java {
|
||||
|
@ -11,7 +11,7 @@ import kotlin.io.path.*
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("io.papermc.paperweight.core") version "1.6.2"
|
||||
id("io.papermc.paperweight.core") version "1.6.3"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@ -68,7 +68,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
paramMappings("net.fabricmc:yarn:1.20.5+build.1:mergedv2")
|
||||
paramMappings("net.fabricmc:yarn:1.20.6+build.1:mergedv2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
|
||||
decompiler("org.vineflower:vineflower:1.10.1")
|
||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")
|
||||
|
@ -1,6 +1,6 @@
|
||||
group=io.papermc.paper
|
||||
version=1.20.5-R0.1-SNAPSHOT
|
||||
mcVersion=1.20.5
|
||||
version=1.20.6-R0.1-SNAPSHOT
|
||||
mcVersion=1.20.6
|
||||
|
||||
# Set to true while updating Minecraft version
|
||||
updatingMinecraft=false
|
||||
|
@ -70,7 +70,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class BiomeKeys {
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class GameEventKeys {
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureKeys {
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureTypeKeys {
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimMaterialKeys {
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.20.5")
|
||||
@GeneratedFrom("1.20.6")
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimPatternKeys {
|
||||
/**
|
||||
|
@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..6271e2bad0ed937c2c46a8c8fdf186c4
|
||||
+}
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
deleted file mode 100644
|
||||
index 278ecb12ecdb5e1fdf394a1c990a4d849e53e05e..0000000000000000000000000000000000000000
|
||||
index bea9ac450de7ec05f9752d253743e95d79c1cd14..0000000000000000000000000000000000000000
|
||||
--- a/pom.xml
|
||||
+++ /dev/null
|
||||
@@ -1,267 +0,0 @@
|
||||
@ -135,7 +135,7 @@ index 278ecb12ecdb5e1fdf394a1c990a4d849e53e05e..00000000000000000000000000000000
|
||||
-
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-api</artifactId>
|
||||
- <version>1.20.5-R0.1-SNAPSHOT</version>
|
||||
- <version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
- <packaging>jar</packaging>
|
||||
-
|
||||
- <name>Spigot-API</name>
|
||||
|
@ -4596,7 +4596,7 @@ index 9bab73c3c2ca759b8e1c7d07d98cc593c961666a..f0c6943da3f783101ca647b75b3230fa
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876b94058b9 100644
|
||||
index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..18c2864c99d4dfae16cdb35143486aeebb9a6fd6 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
@@ -34,6 +34,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@ -4644,7 +4644,60 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876
|
||||
void setDisplayName(@Nullable String name);
|
||||
|
||||
/**
|
||||
@@ -124,6 +146,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -62,6 +84,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
*/
|
||||
boolean hasItemName();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the item name component that is set.
|
||||
+ * <br>
|
||||
+ * Item name differs from display name in that it is cannot be edited by an
|
||||
+ * anvil, is not styled with italics, and does not show labels.
|
||||
+ * <p>
|
||||
+ * Plugins should check that {@link #hasItemName()} returns <code>true</code> before
|
||||
+ * calling this method.
|
||||
+ *
|
||||
+ * @return the item name that is set
|
||||
+ * @see #hasItemName()
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.NotNull
|
||||
+ Component itemName();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the item name.
|
||||
+ * <br>
|
||||
+ * Item name differs from display name in that it is cannot be edited by an
|
||||
+ * anvil, is not styled with italics, and does not show labels.
|
||||
+ *
|
||||
+ * @param name the name to set, null to remove it
|
||||
+ */
|
||||
+ void itemName(@Nullable final Component name);
|
||||
+ // Paper end
|
||||
/**
|
||||
* Gets the item name that is set.
|
||||
* <br>
|
||||
@@ -72,7 +120,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* calling this method.
|
||||
*
|
||||
* @return the item name that is set
|
||||
+ * @deprecated in favour of {@link #itemName()}
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
@NotNull
|
||||
String getItemName();
|
||||
|
||||
@@ -83,7 +133,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* anvil, is not styled with italics, and does not show labels.
|
||||
*
|
||||
* @param name the name to set
|
||||
+ * @deprecated in favour of {@link #itemName(Component)}
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
void setItemName(@Nullable String name);
|
||||
|
||||
/**
|
||||
@@ -124,6 +176,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
*/
|
||||
boolean hasLore();
|
||||
|
||||
@ -4669,7 +4722,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876
|
||||
/**
|
||||
* Gets the lore that is set.
|
||||
* <p>
|
||||
@@ -131,7 +171,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -131,7 +201,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* calling this method.
|
||||
*
|
||||
* @return a list of lore that is set
|
||||
@ -4679,7 +4732,7 @@ index 255f79d5bca15620cb17d7b54ffebb6ff00bff6b..d7c178b3584db5866a5a21c6ddaab876
|
||||
@Nullable
|
||||
List<String> getLore();
|
||||
|
||||
@@ -140,7 +182,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -140,7 +212,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* Removes lore when given null.
|
||||
*
|
||||
* @param lore the lore that will be set
|
||||
|
@ -600,16 +600,15 @@ index a0f6f1af304190b4c5db4b284d460f625eeb7801..7e21548cac8515c281ec86853e9272ab
|
||||
* The Block is already broken as this event is called, so #getBlock() will be
|
||||
* AIR in most cases. Use #getBlockState() for more Information about the broken
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
|
||||
index 44f7f6939a27b9a0a796d91eac4b7c97ec90a643..641c71ab66bd2499b35cf3c1d533fd105d096e10 100644
|
||||
index e534954457a9961a26dbec7ac035bec07e1d6694..8309b030c2120f1496d244f3ebc1094def41c869 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
|
||||
@@ -7,7 +7,9 @@ import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
- * Called when a block explodes
|
||||
+ * Called when a block explodes interacting with blocks. The
|
||||
+ * event isn't called if the {@link org.bukkit.GameRule#MOB_GRIEFING}
|
||||
@@ -13,6 +13,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Note that due to the nature of explosions, {@link #getBlock()} will always be
|
||||
* an air block. {@link #getExplodedBlockState()} should be used to get
|
||||
* information about the block state that exploded.
|
||||
+ * <p>
|
||||
+ * The event isn't called if the {@link org.bukkit.GameRule#MOB_GRIEFING}
|
||||
+ * is disabled as no block interaction will occur.
|
||||
*/
|
||||
public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
@ -1438,10 +1437,10 @@ index 07c3dff4d6190ef388d9c1e1c36f67f00a3e8e66..597a18a767b68b47e81454b7d44613c7
|
||||
* @param input The input choice.
|
||||
* @return The changed recipe, so you can chain calls.
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index d7c178b3584db5866a5a21c6ddaab876b94058b9..dff32cedf47e95fe14a865898d76b62748dee5f3 100644
|
||||
index 18c2864c99d4dfae16cdb35143486aeebb9a6fd6..d66857825528ee772219440dffa28ad8e820493b 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
@@ -483,7 +483,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -513,7 +513,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
/**
|
||||
* Return an immutable copy of all {@link Attribute}s and their
|
||||
* {@link AttributeModifier}s for a given {@link EquipmentSlot}.<br>
|
||||
@ -1450,6 +1449,21 @@ index d7c178b3584db5866a5a21c6ddaab876b94058b9..dff32cedf47e95fe14a865898d76b627
|
||||
* {@link EquipmentSlot} will be returned. This is because
|
||||
* AttributeModifiers without a slot are active in any slot.<br>
|
||||
* If there are no attributes set for the given slot, an empty map
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
index c1676991c3cc5f8d6e3f97d8cb356d6e2aa52809..4eadbcf766e69459c036a28f6e43523170558308 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
@@ -8,8 +8,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents leather armor ({@link Material#LEATHER_BOOTS}, {@link
|
||||
- * Material#LEATHER_CHESTPLATE}, {@link Material#LEATHER_HELMET}, or {@link
|
||||
- * Material#LEATHER_LEGGINGS}) that can be colored.
|
||||
+ * Material#LEATHER_LEGGINGS}, {@link Material#LEATHER_CHESTPLATE}, {@link
|
||||
+ * Material#LEATHER_HELMET}, or {@link Material#LEATHER_HORSE_ARMOR}) that can be colored.
|
||||
*/
|
||||
public interface LeatherArmorMeta extends ItemMeta {
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
|
||||
index 22b1dc5fd4d453161a5ee520072f8e8f955b3a80..a625bcab8e77b05b3341a52c708fae1542b7e3d5 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
|
||||
|
@ -13,10 +13,10 @@ You can use EntityPathfindEvent to cancel new pathfinds from overriding your cur
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..43f062257472a06e9e64c2feef6c3b1012aee00e
|
||||
index 0000000000000000000000000000000000000000..3c1e2c93d923a683cc0455af77c43784ef12270e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
|
||||
@@ -0,0 +1,212 @@
|
||||
@@ -0,0 +1,220 @@
|
||||
+package com.destroystokyo.paper.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
@ -227,6 +227,14 @@ index 0000000000000000000000000000000000000000..43f062257472a06e9e64c2feef6c3b10
|
||||
+ * @return The closest point the path can get to the target location
|
||||
+ */
|
||||
+ @Nullable Location getFinalPoint();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks whether the final point can be reached
|
||||
+ *
|
||||
+ * @return whether the final point can be reached
|
||||
+ * @see #getFinalPoint()
|
||||
+ */
|
||||
+ boolean canReachFinalPoint();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java
|
||||
|
@ -1587,10 +1587,10 @@ index 597a18a767b68b47e81454b7d44613c7178c1366..bc3440eb72127824b3961fbdae583bb6
|
||||
public ItemStack getInput() {
|
||||
return this.ingredient.getItemStack();
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index dff32cedf47e95fe14a865898d76b62748dee5f3..05a57b42e874c6e50149aa253861abaf5e17cef0 100644
|
||||
index d66857825528ee772219440dffa28ad8e820493b..3ddd52b135f339ff006b5d53f46487bfbe1ff7fd 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
@@ -111,6 +111,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -141,6 +141,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
/**
|
||||
* Checks for existence of a localized name.
|
||||
*
|
||||
@ -1598,7 +1598,7 @@ index dff32cedf47e95fe14a865898d76b62748dee5f3..05a57b42e874c6e50149aa253861abaf
|
||||
* @return true if this has a localized name
|
||||
* @deprecated meta no longer exists
|
||||
*/
|
||||
@@ -123,6 +124,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -153,6 +154,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* Plugins should check that hasLocalizedName() returns <code>true</code>
|
||||
* before calling this method.
|
||||
*
|
||||
@ -1606,7 +1606,7 @@ index dff32cedf47e95fe14a865898d76b62748dee5f3..05a57b42e874c6e50149aa253861abaf
|
||||
* @return the localized name that is set
|
||||
* @deprecated meta no longer exists
|
||||
*/
|
||||
@@ -133,6 +135,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -163,6 +165,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
/**
|
||||
* Sets the localized name.
|
||||
*
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Support components in ItemMeta
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index 05a57b42e874c6e50149aa253861abaf5e17cef0..ab69711ebd81fb512c7abebc5b439e89a4754bd2 100644
|
||||
index 3ddd52b135f339ff006b5d53f46487bfbe1ff7fd..ed12e27a0ed75caa8aa46c3e965ed566a97865cf 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
@@ -5,6 +5,7 @@ import java.util.Collection;
|
||||
@ -54,7 +54,7 @@ index 05a57b42e874c6e50149aa253861abaf5e17cef0..ab69711ebd81fb512c7abebc5b439e89
|
||||
/**
|
||||
* Checks for existence of an item name.
|
||||
* <br>
|
||||
@@ -180,6 +205,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -210,6 +235,19 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@Nullable
|
||||
List<String> getLore();
|
||||
|
||||
@ -74,7 +74,7 @@ index 05a57b42e874c6e50149aa253861abaf5e17cef0..ab69711ebd81fb512c7abebc5b439e89
|
||||
/**
|
||||
* Sets the lore for this item.
|
||||
* Removes lore when given null.
|
||||
@@ -190,6 +228,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@@ -220,6 +258,16 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
@Deprecated // Paper
|
||||
void setLore(@Nullable List<String> lore);
|
||||
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add EquipmentSlot convenience methods
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/EquipmentSlot.java b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
||||
index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..adf0a94f98eb66b3957d4009d83ad5f741e0aa79 100644
|
||||
index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..a10d56b797e58b56bd4cef6de40691f7eac9b5b1 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java
|
||||
@@ -33,4 +33,27 @@ public enum EquipmentSlot {
|
||||
@@ -33,4 +33,42 @@ public enum EquipmentSlot {
|
||||
public EquipmentSlotGroup getGroup() {
|
||||
return group.get();
|
||||
}
|
||||
@ -24,6 +24,21 @@ index 5642d8af60b6649497aba9b0f6ab7bba7702b9ee..adf0a94f98eb66b3957d4009d83ad5f7
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the opposite hand
|
||||
+ *
|
||||
+ * @return the opposite hand
|
||||
+ * @throws IllegalArgumentException if this equipment slot is not a hand
|
||||
+ * @see #isHand()
|
||||
+ */
|
||||
+ public @NotNull EquipmentSlot getOppositeHand() {
|
||||
+ return switch (this) {
|
||||
+ case HAND -> OFF_HAND;
|
||||
+ case OFF_HAND -> HAND;
|
||||
+ default -> throw new IllegalArgumentException("Unable to determine an opposite hand for equipment slot: " + name());
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Checks whether this equipment slot
|
||||
+ * is one of the armor slots:
|
||||
+ * {@link #HEAD}, {@link #CHEST},
|
||||
|
@ -1,69 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 22 Oct 2021 16:24:17 -0700
|
||||
Subject: [PATCH] Add exploded block state to BlockExplodeEvent and
|
||||
EntityDamageByBlockEvent
|
||||
Subject: [PATCH] Add exploded block state to EntityDamageByBlockEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
|
||||
index 641c71ab66bd2499b35cf3c1d533fd105d096e10..7dcbb75170296c1dd1d784a032bf369602328b29 100644
|
||||
index 8309b030c2120f1496d244f3ebc1094def41c869..a7c297364805c58ae16895055d8eae0484384b7d 100644
|
||||
--- a/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/block/BlockExplodeEvent.java
|
||||
@@ -10,18 +10,31 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Called when a block explodes interacting with blocks. The
|
||||
* event isn't called if the {@link org.bukkit.GameRule#MOB_GRIEFING}
|
||||
* is disabled as no block interaction will occur.
|
||||
+ * <p>
|
||||
+ * The {@link Block} returned by this event is not necessarily
|
||||
+ * the block that caused the explosion, just the block at the location where
|
||||
+ * the explosion originated. See {@link #getExplodedBlockState()}
|
||||
*/
|
||||
public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
private final List<Block> blocks;
|
||||
private float yield;
|
||||
+ private final org.bukkit.block.BlockState explodedBlockState; // Paper
|
||||
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
public BlockExplodeEvent(@NotNull final Block what, @NotNull final List<Block> blocks, final float yield) {
|
||||
+ // Paper start
|
||||
+ this(what, blocks, yield, null);
|
||||
+ }
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal
|
||||
+ public BlockExplodeEvent(@NotNull final Block what, @NotNull final List<Block> blocks, final float yield, @org.jetbrains.annotations.Nullable org.bukkit.block.BlockState explodedBlockState) {
|
||||
+ // Paper end
|
||||
super(what);
|
||||
this.blocks = blocks;
|
||||
this.yield = yield;
|
||||
@@ -32,6 +32,7 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = false;
|
||||
+ this.explodedBlockState = explodedBlockState; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,6 +47,22 @@ public class BlockExplodeEvent extends BlockEvent implements Cancellable {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get a capture of the block that directly caused
|
||||
+ * the explosion, like a bed or respawn anchor. This
|
||||
+ * block state is not placed so {@link org.bukkit.block.BlockState#isPlaced}
|
||||
+ * will be false.
|
||||
+ * <p>
|
||||
+ * Can be null if no block directly caused the explosion.
|
||||
+ *
|
||||
+ * @return the exploded block state or null if not applicable
|
||||
+ */
|
||||
+ public @org.jetbrains.annotations.Nullable org.bukkit.block.BlockState getExplodedBlockState() {
|
||||
+ return this.explodedBlockState;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Returns the list of blocks that would have been removed or were removed
|
||||
* from the explosion event.
|
||||
+ @io.papermc.paper.annotation.DoNotUse // Paper
|
||||
@Deprecated(forRemoval = true)
|
||||
public BlockExplodeEvent(@NotNull final Block what, @NotNull final List<Block> blocks, final float yield) {
|
||||
this(what, what.getState(), blocks, yield);
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
||||
index 467a0d6cabc5e860628be3b1e62de773efde5d2e..1fb15e2ade8ff3c4d662eca87b078b4577f786e1 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java
|
@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Sun, 28 Apr 2024 11:11:26 -0700
|
||||
Subject: [PATCH] Allow modifying library loader jars bytecode
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
index f4d655a158410039305ac68cebe0d79000f73df8..5b0203e908f84c531886b8ea8faeb591eb045636 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
@@ -46,6 +46,7 @@ public class LibraryLoader
|
||||
private final RepositorySystem repository;
|
||||
private final DefaultRepositorySystemSession session;
|
||||
private final List<RemoteRepository> repositories;
|
||||
+ public static java.util.function.BiFunction<URL[], ClassLoader, URLClassLoader> LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries
|
||||
|
||||
public LibraryLoader(@NotNull Logger logger)
|
||||
{
|
||||
@@ -130,7 +131,14 @@ public class LibraryLoader
|
||||
} );
|
||||
}
|
||||
|
||||
- URLClassLoader loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() );
|
||||
+ // Paper start - rewrite reflection in libraries
|
||||
+ URLClassLoader loader;
|
||||
+ if (LIBRARY_LOADER_FACTORY == null) {
|
||||
+ loader = new URLClassLoader( jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader() );
|
||||
+ } else {
|
||||
+ loader = LIBRARY_LOADER_FACTORY.apply(jarFiles.toArray( new URL[ jarFiles.size() ] ), getClass().getClassLoader());
|
||||
+ }
|
||||
+ // Paper end - rewrite reflection in libraries
|
||||
|
||||
return loader;
|
||||
}
|
38
patches/api/0474-Add-hook-to-remap-library-jars.patch
Normal file
38
patches/api/0474-Add-hook-to-remap-library-jars.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Sun, 28 Apr 2024 13:51:08 -0700
|
||||
Subject: [PATCH] Add hook to remap library jars
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
index 5b0203e908f84c531886b8ea8faeb591eb045636..8e1b6be2462aaa692efa1f72986921a6dc357196 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
@@ -47,6 +47,7 @@ public class LibraryLoader
|
||||
private final DefaultRepositorySystemSession session;
|
||||
private final List<RemoteRepository> repositories;
|
||||
public static java.util.function.BiFunction<URL[], ClassLoader, URLClassLoader> LIBRARY_LOADER_FACTORY; // Paper - rewrite reflection in libraries
|
||||
+ public static java.util.function.Function<List<java.nio.file.Path>, List<java.nio.file.Path>> REMAPPER; // Paper - remap libraries
|
||||
|
||||
public LibraryLoader(@NotNull Logger logger)
|
||||
{
|
||||
@@ -111,9 +112,18 @@ public class LibraryLoader
|
||||
}
|
||||
|
||||
List<URL> jarFiles = new ArrayList<>();
|
||||
+ List<java.nio.file.Path> jarPaths = new ArrayList<>(); // Paper - remap libraries
|
||||
for ( ArtifactResult artifact : result.getArtifactResults() )
|
||||
{
|
||||
- File file = artifact.getArtifact().getFile();
|
||||
+ // Paper start - remap libraries
|
||||
+ jarPaths.add(artifact.getArtifact().getFile().toPath());
|
||||
+ }
|
||||
+ if (REMAPPER != null) {
|
||||
+ jarPaths = REMAPPER.apply(jarPaths);
|
||||
+ }
|
||||
+ for (java.nio.file.Path path : jarPaths) {
|
||||
+ File file = path.toFile();
|
||||
+ // Paper end - remap libraries
|
||||
|
||||
URL url;
|
||||
try
|
27
patches/api/0475-Add-GameMode-isInvulnerable.patch
Normal file
27
patches/api/0475-Add-GameMode-isInvulnerable.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Wed, 1 May 2024 06:56:21 +0300
|
||||
Subject: [PATCH] Add GameMode#isInvulnerable
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/GameMode.java b/src/main/java/org/bukkit/GameMode.java
|
||||
index fdc42a79c5af30fdade41ee99245e6641f353571..ddc56524b3bd2bdebba81c61a5600e6f46a4aaa4 100644
|
||||
--- a/src/main/java/org/bukkit/GameMode.java
|
||||
+++ b/src/main/java/org/bukkit/GameMode.java
|
||||
@@ -79,4 +79,16 @@ public enum GameMode implements net.kyori.adventure.translation.Translatable { /
|
||||
BY_ID.put(mode.getValue(), mode);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Paper start - Add GameMode#isInvulnerable
|
||||
+ /**
|
||||
+ * Checks whether this game mode is invulnerable
|
||||
+ * (i.e. is either {@link #CREATIVE} or {@link #SPECTATOR})
|
||||
+ *
|
||||
+ * @return whether this game mode is invulnerable
|
||||
+ */
|
||||
+ public boolean isInvulnerable() {
|
||||
+ return this == CREATIVE || this == SPECTATOR;
|
||||
+ }
|
||||
+ // Paper end - Add GameMode#isInvulnerable
|
||||
}
|
25
patches/api/0475-Expose-hasColor-to-leather-armor.patch
Normal file
25
patches/api/0475-Expose-hasColor-to-leather-armor.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Wed, 1 May 2024 10:58:50 +0300
|
||||
Subject: [PATCH] Expose #hasColor to leather armor
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
index 4eadbcf766e69459c036a28f6e43523170558308..c933fae0fb87f3a58e8f549e8870fba436288fa8 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/LeatherArmorMeta.java
|
||||
@@ -33,4 +33,14 @@ public interface LeatherArmorMeta extends ItemMeta {
|
||||
@Override
|
||||
@NotNull
|
||||
LeatherArmorMeta clone();
|
||||
+
|
||||
+ // Paper start - Expose #hasColor to leather armor
|
||||
+ /**
|
||||
+ * Checks whether this leather armor is dyed
|
||||
+ * (i.e. has a color different from {@link ItemFactory#getDefaultLeatherColor()})
|
||||
+ *
|
||||
+ * @return whether this leather armor is dyed
|
||||
+ */
|
||||
+ boolean isDyed();
|
||||
+ // Paper end - Expose #hasColor to leather armor
|
||||
}
|
@ -160,7 +160,7 @@ index 0000000000000000000000000000000000000000..a457cf30d37037ce09fbe5d26e051b95
|
||||
+}
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
deleted file mode 100644
|
||||
index 37928a37028bb7ee4843d42f256675e000823774..0000000000000000000000000000000000000000
|
||||
index 4fabd6c37587aa6a9af11566d64c6b49f5bfadaa..0000000000000000000000000000000000000000
|
||||
--- a/pom.xml
|
||||
+++ /dev/null
|
||||
@@ -1,604 +0,0 @@
|
||||
@ -170,7 +170,7 @@ index 37928a37028bb7ee4843d42f256675e000823774..00000000000000000000000000000000
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot</artifactId>
|
||||
- <packaging>jar</packaging>
|
||||
- <version>1.20.5-R0.1-SNAPSHOT</version>
|
||||
- <version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
- <name>Spigot</name>
|
||||
- <url>https://www.spigotmc.org/</url>
|
||||
-
|
||||
|
@ -121,7 +121,7 @@ index 0000000000000000000000000000000000000000..042478cf7ce150f1f1bc5cddd7fa40f8
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..522156e1b7578663c426fcaf7e47acb93d030486
|
||||
index 0000000000000000000000000000000000000000..7684e71f802f3d19e5340713b45cc84860ce9495
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
@@ -0,0 +1,360 @@
|
||||
@ -300,7 +300,7 @@ index 0000000000000000000000000000000000000000..522156e1b7578663c426fcaf7e47acb9
|
||||
+ } else {
|
||||
+ this.verifyWorldConfigVersion(contextMap, node);
|
||||
+ }
|
||||
+ this.applyWorldConfigTransformations(contextMap, node);
|
||||
+ this.applyWorldConfigTransformations(contextMap, node, null);
|
||||
+ final W instance = node.require(this.worldConfigClass);
|
||||
+ node.set(this.worldConfigClass, instance);
|
||||
+ this.trySaveFileNode(loader, node, configFile.toString());
|
||||
@ -362,7 +362,7 @@ index 0000000000000000000000000000000000000000..522156e1b7578663c426fcaf7e47acb9
|
||||
+ } else {
|
||||
+ this.verifyWorldConfigVersion(contextMap, worldNode);
|
||||
+ }
|
||||
+ this.applyWorldConfigTransformations(contextMap, worldNode);
|
||||
+ this.applyWorldConfigTransformations(contextMap, worldNode, defaultsNode);
|
||||
+ this.applyDefaultsAwareWorldConfigTransformations(contextMap, worldNode, defaultsNode);
|
||||
+ this.trySaveFileNode(worldLoader, worldNode, worldConfigFile.toString()); // save before loading node NOTE: don't save the backing node after loading it, or you'll fill up the world-specific config
|
||||
+ worldNode.mergeFrom(defaultsNode);
|
||||
@ -390,7 +390,7 @@ index 0000000000000000000000000000000000000000..522156e1b7578663c426fcaf7e47acb9
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node) throws ConfigurateException {
|
||||
+ protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||
+ }
|
||||
+
|
||||
+ protected void applyDefaultsAwareWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode worldNode, final ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||
@ -842,10 +842,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d99489e0216b24d27a19c92a1ce0c10ae10d071f
|
||||
index 0000000000000000000000000000000000000000..83a726bcf8b7dce73a361b0d79dbd63a0afc7a12
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -0,0 +1,464 @@
|
||||
@@ -0,0 +1,465 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.base.Suppliers;
|
||||
@ -869,9 +869,9 @@ index 0000000000000000000000000000000000000000..d99489e0216b24d27a19c92a1ce0c10a
|
||||
+import io.papermc.paper.configuration.transformation.global.versioned.V29_LogIPs;
|
||||
+import io.papermc.paper.configuration.transformation.world.FeatureSeedsGeneration;
|
||||
+import io.papermc.paper.configuration.transformation.world.LegacyPaperWorldConfig;
|
||||
+import io.papermc.paper.configuration.transformation.world.SpawnLoadedRangeToGameRule;
|
||||
+import io.papermc.paper.configuration.transformation.world.versioned.V29_ZeroWorldHeight;
|
||||
+import io.papermc.paper.configuration.transformation.world.versioned.V30_RenameFilterNbtFromSpawnEgg;
|
||||
+import io.papermc.paper.configuration.transformation.world.versioned.V31_SpawnLoadedRangeToGameRule;
|
||||
+import io.papermc.paper.configuration.type.BooleanOrDefault;
|
||||
+import io.papermc.paper.configuration.type.Duration;
|
||||
+import io.papermc.paper.configuration.type.DurationOrDisabled;
|
||||
@ -905,6 +905,7 @@ index 0000000000000000000000000000000000000000..d99489e0216b24d27a19c92a1ce0c10a
|
||||
+import org.apache.commons.lang3.RandomStringUtils;
|
||||
+import org.bukkit.configuration.ConfigurationSection;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.VisibleForTesting;
|
||||
+import org.slf4j.Logger;
|
||||
+import org.spigotmc.SpigotConfig;
|
||||
@ -1100,9 +1101,9 @@ index 0000000000000000000000000000000000000000..d99489e0216b24d27a19c92a1ce0c10a
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node) throws ConfigurateException {
|
||||
+ ConfigurationTransformation.Builder builder = ConfigurationTransformation.builder();
|
||||
+ for (NodePath path : RemovedConfigurations.REMOVED_WORLD_PATHS) {
|
||||
+ protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||
+ final ConfigurationTransformation.Builder builder = ConfigurationTransformation.builder();
|
||||
+ for (final NodePath path : RemovedConfigurations.REMOVED_WORLD_PATHS) {
|
||||
+ builder.addAction(path, TransformAction.remove());
|
||||
+ }
|
||||
+ builder.build().apply(node);
|
||||
@ -1110,6 +1111,7 @@ index 0000000000000000000000000000000000000000..d99489e0216b24d27a19c92a1ce0c10a
|
||||
+ final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
||||
+ V29_ZeroWorldHeight.apply(versionedBuilder);
|
||||
+ V30_RenameFilterNbtFromSpawnEgg.apply(versionedBuilder);
|
||||
+ V31_SpawnLoadedRangeToGameRule.apply(versionedBuilder, contextMap, defaultsNode);
|
||||
+ // ADD FUTURE VERSIONED TRANSFORMS TO versionedBuilder HERE
|
||||
+ versionedBuilder.build().apply(node);
|
||||
+ }
|
||||
@ -1129,8 +1131,7 @@ index 0000000000000000000000000000000000000000..d99489e0216b24d27a19c92a1ce0c10a
|
||||
+ }
|
||||
+
|
||||
+ private static final List<Transformations.DefaultsAware> DEFAULT_AWARE_TRANSFORMATIONS = List.of(
|
||||
+ FeatureSeedsGeneration::apply,
|
||||
+ SpawnLoadedRangeToGameRule::apply
|
||||
+ FeatureSeedsGeneration::apply
|
||||
+ );
|
||||
+
|
||||
+ @Override
|
||||
@ -1400,7 +1401,7 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b3a39a0b1f54d38207fa55485318e6ca257a57ab
|
||||
index 0000000000000000000000000000000000000000..efc91ff91827872c62b8bd060282549ccdcf67dd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,550 @@
|
||||
@ -1466,7 +1467,7 @@ index 0000000000000000000000000000000000000000..b3a39a0b1f54d38207fa55485318e6ca
|
||||
+@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
|
||||
+public class WorldConfiguration extends ConfigurationPart {
|
||||
+ private static final Logger LOGGER = LogUtils.getClassLogger();
|
||||
+ static final int CURRENT_VERSION = 30; // (when you change the version, change the comment, so it conflicts on rebases): rename filter bad nbt from spawn eggs
|
||||
+ static final int CURRENT_VERSION = 31; // (when you change the version, change the comment, so it conflicts on rebases): migrate spawn loaded configs to gamerule
|
||||
+
|
||||
+ private final transient SpigotWorldConfig spigotConfig;
|
||||
+ private final transient ResourceLocation worldKey;
|
||||
@ -3513,12 +3514,13 @@ index 0000000000000000000000000000000000000000..ef0e834c164b0ccc1a61b349348e6799
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/global/versioned/V29_LogIPs.java b/src/main/java/io/papermc/paper/configuration/transformation/global/versioned/V29_LogIPs.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..90071acf589fb2fa1c3480883165b429db54df69
|
||||
index 0000000000000000000000000000000000000000..66073f7a6a96405348cc4044ad1e6922158b13ba
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/global/versioned/V29_LogIPs.java
|
||||
@@ -0,0 +1,45 @@
|
||||
@@ -0,0 +1,44 @@
|
||||
+package io.papermc.paper.configuration.transformation.global.versioned;
|
||||
+
|
||||
+import java.util.Properties;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@ -3528,8 +3530,6 @@ index 0000000000000000000000000000000000000000..90071acf589fb2fa1c3480883165b429
|
||||
+import org.spongepowered.configurate.transformation.ConfigurationTransformation;
|
||||
+import org.spongepowered.configurate.transformation.TransformAction;
|
||||
+
|
||||
+import java.util.Properties;
|
||||
+
|
||||
+import static org.spongepowered.configurate.NodePath.path;
|
||||
+
|
||||
+public class V29_LogIPs implements TransformAction {
|
||||
@ -3541,17 +3541,17 @@ index 0000000000000000000000000000000000000000..90071acf589fb2fa1c3480883165b429
|
||||
+ private V29_LogIPs() {
|
||||
+ }
|
||||
+
|
||||
+ public static void apply(ConfigurationTransformation.VersionedBuilder builder) {
|
||||
+ public static void apply(final ConfigurationTransformation.VersionedBuilder builder) {
|
||||
+ builder.addVersion(VERSION, ConfigurationTransformation.builder().addAction(PATH, INSTANCE).build());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Object @Nullable [] visitPath(final NodePath path, final ConfigurationNode value) throws ConfigurateException {
|
||||
+ DedicatedServer server = ((DedicatedServer) MinecraftServer.getServer());
|
||||
+ final DedicatedServer server = ((DedicatedServer) MinecraftServer.getServer());
|
||||
+
|
||||
+ boolean val = value.getBoolean(server.settings.getProperties().logIPs);
|
||||
+ final boolean val = value.getBoolean(server.settings.getProperties().logIPs);
|
||||
+ server.settings.update((config) -> {
|
||||
+ Properties newProps = new Properties(config.properties);
|
||||
+ final Properties newProps = new Properties(config.properties);
|
||||
+ newProps.setProperty("log-ips", String.valueOf(val));
|
||||
+ return config.reload(server.registryAccess(), newProps, server.options);
|
||||
+ });
|
||||
@ -3967,63 +3967,6 @@ index 0000000000000000000000000000000000000000..edaa6ef28c1f9a223943969870889700
|
||||
+ moveFromRootAndRename(builder, path("game-mechanics", oldKey), newKey, parents);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/SpawnLoadedRangeToGameRule.java b/src/main/java/io/papermc/paper/configuration/transformation/world/SpawnLoadedRangeToGameRule.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3f31c0626b6f01da6bb13942126565f844ca5faa
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/SpawnLoadedRangeToGameRule.java
|
||||
@@ -0,0 +1,51 @@
|
||||
+package io.papermc.paper.configuration.transformation.world;
|
||||
+
|
||||
+import io.papermc.paper.configuration.Configurations;
|
||||
+import net.minecraft.world.level.GameRules;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.spongepowered.configurate.ConfigurateException;
|
||||
+import org.spongepowered.configurate.ConfigurationNode;
|
||||
+import org.spongepowered.configurate.NodePath;
|
||||
+import org.spongepowered.configurate.transformation.ConfigurationTransformation;
|
||||
+import org.spongepowered.configurate.transformation.TransformAction;
|
||||
+
|
||||
+import static org.spongepowered.configurate.NodePath.path;
|
||||
+
|
||||
+public final class SpawnLoadedRangeToGameRule implements TransformAction {
|
||||
+
|
||||
+ private static final String SPAWN = "spawn";
|
||||
+ private static final String KEEP_SPAWN_LOADED_RANGE = "keep-spawn-loaded-range";
|
||||
+ private static final String KEEP_SPAWN_LOADED = "keep-spawn-loaded";
|
||||
+
|
||||
+ private final GameRules gameRules;
|
||||
+ private final ConfigurationNode defaultsNode;
|
||||
+
|
||||
+ private SpawnLoadedRangeToGameRule(final GameRules gameRules, final ConfigurationNode defaultsNode) {
|
||||
+ this.gameRules = gameRules;
|
||||
+ this.defaultsNode = defaultsNode;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Object @Nullable [] visitPath(final NodePath path, final ConfigurationNode value) {
|
||||
+ final ConfigurationNode worldSpawnNode = value.node(SPAWN);
|
||||
+ final ConfigurationNode worldLoadedNode = worldSpawnNode.node(KEEP_SPAWN_LOADED);
|
||||
+ final boolean keepLoaded = worldLoadedNode.getBoolean(this.defaultsNode.node(SPAWN, KEEP_SPAWN_LOADED).getBoolean());
|
||||
+ worldLoadedNode.raw(null);
|
||||
+ final ConfigurationNode worldRangeNode = worldSpawnNode.node(KEEP_SPAWN_LOADED_RANGE);
|
||||
+ final int range = worldRangeNode.getInt(this.defaultsNode.node(SPAWN, KEEP_SPAWN_LOADED_RANGE).getInt());
|
||||
+ worldRangeNode.raw(null);
|
||||
+ if (worldSpawnNode.empty()) {
|
||||
+ worldSpawnNode.raw(null);
|
||||
+ }
|
||||
+ if (!keepLoaded) {
|
||||
+ this.gameRules.getRule(GameRules.RULE_SPAWN_CHUNK_RADIUS).set(0, null);
|
||||
+ } else {
|
||||
+ this.gameRules.getRule(GameRules.RULE_SPAWN_CHUNK_RADIUS).set(range, null);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ public static void apply(final ConfigurationTransformation.Builder builder, final Configurations.ContextMap contextMap, final ConfigurationNode defaultsNode) {
|
||||
+ builder.addAction(path(), new SpawnLoadedRangeToGameRule(contextMap.require(Configurations.GAME_RULES), defaultsNode));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/versioned/V29_ZeroWorldHeight.java b/src/main/java/io/papermc/paper/configuration/transformation/world/versioned/V29_ZeroWorldHeight.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6e481d509d091e65a4909d79014ac94ea63c8455
|
||||
@ -4110,6 +4053,67 @@ index 0000000000000000000000000000000000000000..d08b65234192d5b639cead675114f64b
|
||||
+ builder.addVersion(VERSION, ConfigurationTransformation.builder().addAction(OLD_PATH, rename(NEW_PATH)).build());
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/transformation/world/versioned/V31_SpawnLoadedRangeToGameRule.java b/src/main/java/io/papermc/paper/configuration/transformation/world/versioned/V31_SpawnLoadedRangeToGameRule.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d872b1948df52759fed9c3d892aed6abfdfc8068
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/transformation/world/versioned/V31_SpawnLoadedRangeToGameRule.java
|
||||
@@ -0,0 +1,55 @@
|
||||
+package io.papermc.paper.configuration.transformation.world.versioned;
|
||||
+
|
||||
+import io.papermc.paper.configuration.Configurations;
|
||||
+import net.minecraft.world.level.GameRules;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.spongepowered.configurate.ConfigurationNode;
|
||||
+import org.spongepowered.configurate.NodePath;
|
||||
+import org.spongepowered.configurate.transformation.ConfigurationTransformation;
|
||||
+import org.spongepowered.configurate.transformation.TransformAction;
|
||||
+
|
||||
+import static org.spongepowered.configurate.NodePath.path;
|
||||
+
|
||||
+public final class V31_SpawnLoadedRangeToGameRule implements TransformAction {
|
||||
+
|
||||
+ private static final int VERSION = 31;
|
||||
+ private static final String SPAWN = "spawn";
|
||||
+ private static final String KEEP_SPAWN_LOADED_RANGE = "keep-spawn-loaded-range";
|
||||
+ private static final String KEEP_SPAWN_LOADED = "keep-spawn-loaded";
|
||||
+
|
||||
+ private final GameRules gameRules;
|
||||
+ private final ConfigurationNode defaultsNode;
|
||||
+
|
||||
+ private V31_SpawnLoadedRangeToGameRule(final GameRules gameRules, final ConfigurationNode defaultsNode) {
|
||||
+ this.gameRules = gameRules;
|
||||
+ this.defaultsNode = defaultsNode;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Object @Nullable [] visitPath(final NodePath path, final ConfigurationNode value) {
|
||||
+ final ConfigurationNode worldSpawnNode = value.node(SPAWN);
|
||||
+ final ConfigurationNode worldLoadedNode = worldSpawnNode.node(KEEP_SPAWN_LOADED);
|
||||
+ final boolean keepLoaded = worldLoadedNode.getBoolean(this.defaultsNode.node(SPAWN, KEEP_SPAWN_LOADED).getBoolean());
|
||||
+ worldLoadedNode.raw(null);
|
||||
+ final ConfigurationNode worldRangeNode = worldSpawnNode.node(KEEP_SPAWN_LOADED_RANGE);
|
||||
+ final int range = worldRangeNode.getInt(this.defaultsNode.node(SPAWN, KEEP_SPAWN_LOADED_RANGE).getInt());
|
||||
+ worldRangeNode.raw(null);
|
||||
+ if (worldSpawnNode.empty()) {
|
||||
+ worldSpawnNode.raw(null);
|
||||
+ }
|
||||
+ if (!keepLoaded) {
|
||||
+ this.gameRules.getRule(GameRules.RULE_SPAWN_CHUNK_RADIUS).set(0, null);
|
||||
+ } else {
|
||||
+ this.gameRules.getRule(GameRules.RULE_SPAWN_CHUNK_RADIUS).set(range, null);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ public static void apply(final ConfigurationTransformation.VersionedBuilder builder, final Configurations.ContextMap contextMap, final @Nullable ConfigurationNode defaultsNode) {
|
||||
+ if (defaultsNode != null) {
|
||||
+ builder.addVersion(VERSION, ConfigurationTransformation.builder().addAction(path(), new V31_SpawnLoadedRangeToGameRule(contextMap.require(Configurations.GAME_RULES), defaultsNode)).build());
|
||||
+ } else {
|
||||
+ builder.addVersion(VERSION, ConfigurationTransformation.empty()); // increment version of default world config
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/type/BooleanOrDefault.java b/src/main/java/io/papermc/paper/configuration/type/BooleanOrDefault.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5f03dcdff99bcd33bf789b0dd5521e39afbe09bf
|
||||
|
@ -110,6 +110,19 @@ index 6b34a8d33faa49ffa9082995e67af10d3cb38c03..f0c817e27a602740bc979b2ebaec3917
|
||||
return this.mapId;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
index 658f3962543a36bc8c16f306ccb3e254b5b3d0a8..9e1896199d10be606a6c6304d849c7c9eb3c9fa1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
@@ -82,7 +82,7 @@ public class FieldRename {
|
||||
.change("DAMAGE_UNDEAD", "SMITE")
|
||||
.change("DAMAGE_ARTHROPODS", "BANE_OF_ARTHROPODS")
|
||||
.change("LOOT_BONUS_MOBS", "LOOTING")
|
||||
- .change("SWEEPING_EDGE", "SWEEPING")
|
||||
+ // .change("SWEEPING_EDGE", "SWEEPING") // Paper - this change is incorrect, sweeping edge is the correct name
|
||||
.change("DIG_SPEED", "EFFICIENCY")
|
||||
.change("DURABILITY", "UNBREAKING")
|
||||
.change("LOOT_BONUS_BLOCKS", "FORTUNE")
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..c017ce2ca1bc535795c958a2e509af2adf88efa9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
|
@ -7111,7 +7111,7 @@ index f73604d762efbac400d40f536ec1782fca584efa..4701bf9ee203f2f15b0b68e84bbfa2c4
|
||||
super(type, world);
|
||||
this.xpReward = 5;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index a5d1cd1966ad85ad0a241bee9caa8fd7b7424017..2b8b220bf1e132b230abe14770da53de84db9818 100644
|
||||
index 7442e2b880f6410d3ca57a563f3ad77158a4c8ba..bf19e8e8aa96d646f057b8727f2f01ad2e2497cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -952,6 +952,25 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@ -8131,7 +8131,7 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 2ee0f83f18477fe2c759dc1ccc5ee18dbe791527..38d72d95b1f3ab23710f3335177c59ea6a25270e 100644
|
||||
index cbbb404a6966fc72d17d0ec735d08c1be52b2d4f..3f91fce6df9b87a6e84df21ed04f25be3729814b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -105,8 +105,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
@ -3255,7 +3255,7 @@ index ed54c81a3269360acce674aa4e1d54ccb2461841..c9c849534c3998cfcab7ddcb12a71ccb
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 2b8b220bf1e132b230abe14770da53de84db9818..96da768f55ad835a1a55bf359f0d7278bc232304 100644
|
||||
index bf19e8e8aa96d646f057b8727f2f01ad2e2497cd..d6b02a946bd18ea71278a5026468ec49fabd3a3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -186,7 +186,15 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@ -5141,10 +5141,10 @@ index 9c57b883783145ad4483481a2c2e7f0f188cd174..b653c2c80e8e8524ea6d7625c6a86f82
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 7a5110efc5af1be6644b7afecd6ac025c20e6794..3cb5685a97f67d759537fc92bb4cb376bb2905a7 100644
|
||||
index 64c039bd3b248bd508a2c298032fa9f984b37694..9a22459f15cff45a234c1d497aca27a5433570f7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -843,6 +843,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -850,6 +850,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
|
||||
}
|
||||
|
||||
@ -5163,7 +5163,26 @@ index 7a5110efc5af1be6644b7afecd6ac025c20e6794..3cb5685a97f67d759537fc92bb4cb376
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return CraftChatMessage.fromComponent(this.displayName);
|
||||
@@ -892,6 +904,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -880,6 +892,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return this.itemName != null;
|
||||
}
|
||||
|
||||
+ // Paper start - Adventure
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.Component itemName() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.itemName);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void itemName(final net.kyori.adventure.text.Component name) {
|
||||
+ this.itemName = io.papermc.paper.adventure.PaperAdventure.asVanilla(name);
|
||||
+ }
|
||||
+ // Paper end - Adventure
|
||||
+
|
||||
@Override
|
||||
public String getLocalizedName() {
|
||||
return this.getDisplayName();
|
||||
@@ -899,6 +923,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return this.lore != null && !this.lore.isEmpty();
|
||||
}
|
||||
|
||||
@ -5546,7 +5565,7 @@ index b963d471b33cacaeec385dba6b2bf369e3d4426f..51094fe6e37d3c0fad2682353f8de3d1
|
||||
|
||||
boolean hadFormat = false;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 38d72d95b1f3ab23710f3335177c59ea6a25270e..da97b4e91b7952f1459e59c74447a659842990bc 100644
|
||||
index 3f91fce6df9b87a6e84df21ed04f25be3729814b..e57ba8af99f0ac0151ec1d4c4279393ace6826e4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -76,6 +76,43 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
@ -216,7 +216,7 @@ index 0000000000000000000000000000000000000000..8f07539a82f449ad217e316a7513a170
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
index cb9f8567ba6aae41a6cde519ac0cff0169a7cea7..333d6d82584fb3bf4e0fce7b03bc2d9c4094deb9 100644
|
||||
index fc6e13e4f2408ccbfa645eae2d7ebf4dcfc21908..badd85a92f38caae257181f67a322fc79599d1ce 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -31,6 +31,7 @@ import net.kyori.adventure.text.flattener.ComponentFlattener;
|
||||
|
@ -7326,7 +7326,7 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7
|
||||
@Override
|
||||
public FileConfiguration getConfig() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index da97b4e91b7952f1459e59c74447a659842990bc..fb8d14a2bdaaa25a2237fa4161388439ea8cfc0f 100644
|
||||
index e57ba8af99f0ac0151ec1d4c4279393ace6826e4..c8c66f78335868100adbb4d044037168872d5f94 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -421,6 +421,16 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
@ -66,22 +66,24 @@ index 65fb16941fa7e3a9b300696fb6bd2b562bca48cd..5ffd1d7c130e01a4a7516b361e48bfaf
|
||||
+ mainClass.set(null as String?)
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
||||
index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..bb1cfa8ea8b11fc36ea72c8e382b8554bccd0ce5 100644
|
||||
index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..6f14cb9a73faa1d0ae2939d08809d9f6c2a99e1d 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/PluginInitializerManager.java
|
||||
@@ -6,10 +6,10 @@ import io.papermc.paper.plugin.entrypoint.Entrypoint;
|
||||
@@ -6,10 +6,12 @@ import io.papermc.paper.plugin.entrypoint.Entrypoint;
|
||||
import io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler;
|
||||
import io.papermc.paper.plugin.provider.PluginProvider;
|
||||
import io.papermc.paper.plugin.provider.type.paper.PaperPluginParent;
|
||||
+import io.papermc.paper.pluginremap.PluginRemapper;
|
||||
+import java.util.function.Function;
|
||||
import joptsimple.OptionSet;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
-import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.plugin.java.LibraryLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
@@ -25,10 +25,14 @@ public class PluginInitializerManager {
|
||||
@@ -25,10 +27,15 @@ public class PluginInitializerManager {
|
||||
private static PluginInitializerManager impl;
|
||||
private final Path pluginDirectory;
|
||||
private final Path updateDirectory;
|
||||
@ -93,10 +95,11 @@ index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..bb1cfa8ea8b11fc36ea72c8e382b8554
|
||||
+ this.pluginRemapper = Boolean.getBoolean("paper.disable-plugin-rewriting")
|
||||
+ ? null
|
||||
+ : PluginRemapper.create(pluginDirectory);
|
||||
+ LibraryLoader.REMAPPER = this.pluginRemapper == null ? Function.identity() : this.pluginRemapper::remapLibraries;
|
||||
}
|
||||
|
||||
private static PluginInitializerManager parse(@NotNull final OptionSet minecraftOptionSet) throws Exception {
|
||||
@@ -96,6 +100,7 @@ public class PluginInitializerManager {
|
||||
@@ -96,6 +103,7 @@ public class PluginInitializerManager {
|
||||
public static void load(OptionSet optionSet) throws Exception {
|
||||
// We have to load the bukkit configuration inorder to get the update folder location.
|
||||
io.papermc.paper.plugin.PluginInitializerManager pluginSystem = io.papermc.paper.plugin.PluginInitializerManager.init(optionSet);
|
||||
@ -104,6 +107,31 @@ index 708e5bb9bbf0476fcc2c4b92c6830b094703b43e..bb1cfa8ea8b11fc36ea72c8e382b8554
|
||||
|
||||
// Register the default plugin directory
|
||||
io.papermc.paper.plugin.util.EntrypointUtil.registerProvidersFromSource(io.papermc.paper.plugin.provider.source.DirectoryProviderSource.INSTANCE, pluginSystem.pluginDirectoryPath());
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
|
||||
index f38ecd7f65dc24e4a3f0bc675e3730287ac353f1..f576060c8fe872772bbafe2016fc9b83a3c095f1 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.papermc.paper.plugin.loader;
|
||||
|
||||
+import io.papermc.paper.plugin.PluginInitializerManager;
|
||||
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
|
||||
import io.papermc.paper.plugin.loader.library.ClassPathLibrary;
|
||||
import io.papermc.paper.plugin.loader.library.PaperLibraryStore;
|
||||
@@ -45,9 +46,12 @@ public class PaperClasspathBuilder implements PluginClasspathBuilder {
|
||||
}
|
||||
|
||||
List<Path> paths = paperLibraryStore.getPaths();
|
||||
+ if (PluginInitializerManager.instance().pluginRemapper != null) {
|
||||
+ paths = PluginInitializerManager.instance().pluginRemapper.remapLibraries(paths);
|
||||
+ }
|
||||
URL[] urls = new URL[paths.size()];
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
- Path path = paperLibraryStore.getPaths().get(i);
|
||||
+ Path path = paths.get(i);
|
||||
try {
|
||||
urls[i] = path.toUri().toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java
|
||||
index 226f457db6c1461c943c157b2b91e7450abc9dc6..0846d3a904e470ae1920c5c8be3df9c5dfc3de27 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/source/DirectoryProviderSource.java
|
||||
@ -274,10 +302,10 @@ index 0000000000000000000000000000000000000000..99e658e3a0f08dbd90b3cf48609613e8
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/pluginremap/InsertManifestAttribute.java b/src/main/java/io/papermc/paper/pluginremap/InsertManifestAttribute.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3a5bb5d2a45654385ca0bc15c81ef95315b922b4
|
||||
index 0000000000000000000000000000000000000000..d738b31f0005aca352a511c1a57e76b627fca2dd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/pluginremap/InsertManifestAttribute.java
|
||||
@@ -0,0 +1,67 @@
|
||||
@@ -0,0 +1,69 @@
|
||||
+package io.papermc.paper.pluginremap;
|
||||
+
|
||||
+import java.io.ByteArrayInputStream;
|
||||
@ -285,6 +313,7 @@ index 0000000000000000000000000000000000000000..3a5bb5d2a45654385ca0bc15c81ef953
|
||||
+import java.io.IOException;
|
||||
+import java.util.Collection;
|
||||
+import java.util.List;
|
||||
+import java.util.Set;
|
||||
+import java.util.jar.Attributes;
|
||||
+import java.util.jar.Manifest;
|
||||
+import net.neoforged.art.api.Transformer;
|
||||
@ -294,6 +323,7 @@ index 0000000000000000000000000000000000000000..3a5bb5d2a45654385ca0bc15c81ef953
|
||||
+ static final String MOJANG_NAMESPACE = "mojang";
|
||||
+ static final String MOJANG_PLUS_YARN_NAMESPACE = "mojang+yarn";
|
||||
+ static final String SPIGOT_NAMESPACE = "spigot";
|
||||
+ static final Set<String> KNOWN_NAMESPACES = Set.of(MOJANG_NAMESPACE, MOJANG_PLUS_YARN_NAMESPACE, SPIGOT_NAMESPACE);
|
||||
+
|
||||
+ private final String mainAttributesKey;
|
||||
+ private final String namespace;
|
||||
@ -347,10 +377,10 @@ index 0000000000000000000000000000000000000000..3a5bb5d2a45654385ca0bc15c81ef953
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097237505c0
|
||||
index 0000000000000000000000000000000000000000..265c636abfd63f9ba0b0f0198867a10401c14da1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/pluginremap/PluginRemapper.java
|
||||
@@ -0,0 +1,370 @@
|
||||
@@ -0,0 +1,438 @@
|
||||
+package io.papermc.paper.pluginremap;
|
||||
+
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
@ -397,6 +427,7 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ public static final boolean DEBUG_LOGGING = Boolean.getBoolean("Paper.PluginRemapperDebug");
|
||||
+ private static final String PAPER_REMAPPED = ".paper-remapped";
|
||||
+ private static final String UNKNOWN_ORIGIN = "unknown-origin";
|
||||
+ private static final String LIBRARIES = "libraries";
|
||||
+ private static final String EXTRA_PLUGINS = "extra-plugins";
|
||||
+ private static final String REMAP_CLASSPATH = "remap-classpath";
|
||||
+ private static final String REVERSED_MAPPINGS = "mappings/reversed";
|
||||
@ -407,6 +438,7 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ private final RemappedPluginIndex remappedPlugins;
|
||||
+ private final RemappedPluginIndex extraPlugins;
|
||||
+ private final UnknownOriginRemappedPluginIndex unknownOrigin;
|
||||
+ private final UnknownOriginRemappedPluginIndex libraries;
|
||||
+ private @Nullable CompletableFuture<IMappingFile> reversedMappings;
|
||||
+
|
||||
+ public PluginRemapper(final Path pluginsDir) {
|
||||
@ -418,6 +450,7 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ this.remappedPlugins = new RemappedPluginIndex(remappedPlugins, false);
|
||||
+ this.extraPlugins = new RemappedPluginIndex(this.remappedPlugins.dir().resolve(EXTRA_PLUGINS), true);
|
||||
+ this.unknownOrigin = new UnknownOriginRemappedPluginIndex(this.remappedPlugins.dir().resolve(UNKNOWN_ORIGIN));
|
||||
+ this.libraries = new UnknownOriginRemappedPluginIndex(this.remappedPlugins.dir().resolve(LIBRARIES));
|
||||
+ }
|
||||
+
|
||||
+ public static @Nullable PluginRemapper create(final Path pluginsDir) {
|
||||
@ -446,6 +479,7 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ this.remappedPlugins.write();
|
||||
+ this.extraPlugins.write();
|
||||
+ this.unknownOrigin.write(clean);
|
||||
+ this.libraries.write(clean);
|
||||
+ }
|
||||
+
|
||||
+ // Called on startup and reload
|
||||
@ -465,6 +499,29 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ this.save(false);
|
||||
+ }
|
||||
+
|
||||
+ public List<Path> remapLibraries(final List<Path> libraries) {
|
||||
+ final List<CompletableFuture<Path>> tasks = new ArrayList<>();
|
||||
+ for (final Path lib : libraries) {
|
||||
+ if (!lib.getFileName().toString().endsWith(".jar")) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Library '{}' is not a jar.", lib);
|
||||
+ }
|
||||
+ tasks.add(CompletableFuture.completedFuture(lib));
|
||||
+ continue;
|
||||
+ }
|
||||
+ final @Nullable Path cached = this.libraries.getIfPresent(lib);
|
||||
+ if (cached != null) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Library '{}' has not changed since last remap.", lib);
|
||||
+ }
|
||||
+ tasks.add(CompletableFuture.completedFuture(cached));
|
||||
+ continue;
|
||||
+ }
|
||||
+ tasks.add(this.remapLibrary(this.libraries, lib));
|
||||
+ }
|
||||
+ return waitForAll(tasks);
|
||||
+ }
|
||||
+
|
||||
+ public Path rewritePlugin(final Path plugin) {
|
||||
+ // Already remapped
|
||||
+ if (plugin.getParent().equals(this.remappedPlugins.dir())
|
||||
@ -585,6 +642,20 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ }, executor).thenCompose(f -> f);
|
||||
+ }
|
||||
+
|
||||
+ private CompletableFuture<Path> remapPlugin(
|
||||
+ final RemappedPluginIndex index,
|
||||
+ final Path inputFile
|
||||
+ ) {
|
||||
+ return this.remap(index, inputFile, false);
|
||||
+ }
|
||||
+
|
||||
+ private CompletableFuture<Path> remapLibrary(
|
||||
+ final RemappedPluginIndex index,
|
||||
+ final Path inputFile
|
||||
+ ) {
|
||||
+ return this.remap(index, inputFile, true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the remapped file if remapping was necessary, otherwise null.
|
||||
+ *
|
||||
@ -592,7 +663,11 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ * @param inputFile input file
|
||||
+ * @return remapped file, or inputFile if no remapping was necessary
|
||||
+ */
|
||||
+ private CompletableFuture<Path> remapPlugin(final RemappedPluginIndex index, final Path inputFile) {
|
||||
+ private CompletableFuture<Path> remap(
|
||||
+ final RemappedPluginIndex index,
|
||||
+ final Path inputFile,
|
||||
+ final boolean library
|
||||
+ ) {
|
||||
+ final Path destination = index.input(inputFile);
|
||||
+
|
||||
+ try (final FileSystem fs = FileSystems.newFileSystem(inputFile, new HashMap<>())) {
|
||||
@ -608,25 +683,47 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ } else {
|
||||
+ ns = null;
|
||||
+ }
|
||||
+ if (ns != null && (ns.equals(InsertManifestAttribute.MOJANG_NAMESPACE) || ns.equals(InsertManifestAttribute.MOJANG_PLUS_YARN_NAMESPACE))) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is already Mojang mapped.", inputFile);
|
||||
+
|
||||
+ if (ns != null && !InsertManifestAttribute.KNOWN_NAMESPACES.contains(ns)) {
|
||||
+ throw new RuntimeException("Failed to remap plugin " + inputFile + " with unknown mapping namespace '" + ns + "'");
|
||||
+ }
|
||||
+
|
||||
+ final boolean mojangMappedManifest = ns != null && (ns.equals(InsertManifestAttribute.MOJANG_NAMESPACE) || ns.equals(InsertManifestAttribute.MOJANG_PLUS_YARN_NAMESPACE));
|
||||
+ if (library) {
|
||||
+ if (mojangMappedManifest) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Library '{}' is already Mojang mapped.", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ } else if (ns == null) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Library '{}' does not specify a mappings namespace (not remapping).", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ } else if (ns == null && Files.exists(fs.getPath(PluginFileType.PAPER_PLUGIN_YML))) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is a Paper plugin with no namespace specified.", inputFile);
|
||||
+ } else {
|
||||
+ if (mojangMappedManifest) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is already Mojang mapped.", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ } else if (ns == null && Files.exists(fs.getPath(PluginFileType.PAPER_PLUGIN_YML))) {
|
||||
+ if (DEBUG_LOGGING) {
|
||||
+ LOGGER.info("Plugin '{}' is a Paper plugin with no namespace specified.", inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ }
|
||||
+ index.skip(inputFile);
|
||||
+ return CompletableFuture.completedFuture(inputFile);
|
||||
+ }
|
||||
+ } catch (final IOException ex) {
|
||||
+ throw new RuntimeException("Failed to open plugin jar " + inputFile, ex);
|
||||
+ }
|
||||
+
|
||||
+ return this.reobf.remapped().thenApplyAsync(reobfServer -> {
|
||||
+ LOGGER.info("Remapping plugin '{}'...", inputFile);
|
||||
+ LOGGER.info("Remapping {} '{}'...", library ? "library" : "plugin", inputFile);
|
||||
+ final long start = System.currentTimeMillis();
|
||||
+ try (final DebugLogger logger = DebugLogger.forOutputFile(destination)) {
|
||||
+ try (final Renamer renamer = Renamer.builder()
|
||||
@ -643,7 +740,7 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ } catch (final Exception ex) {
|
||||
+ throw new RuntimeException("Failed to remap plugin jar '" + inputFile + "'", ex);
|
||||
+ }
|
||||
+ LOGGER.info("Done remapping plugin '{}' in {}ms.", inputFile, System.currentTimeMillis() - start);
|
||||
+ LOGGER.info("Done remapping {} '{}' in {}ms.", library ? "library" : "plugin", inputFile, System.currentTimeMillis() - start);
|
||||
+ return destination;
|
||||
+ }, this.threadPool);
|
||||
+ }
|
||||
@ -701,7 +798,8 @@ index 0000000000000000000000000000000000000000..06dbaf0c77333f4d0d8ac462edd52097
|
||||
+ try {
|
||||
+ collector.throwIfPresent();
|
||||
+ } catch (final Exception ex) {
|
||||
+ throw new RuntimeException("Encountered exception remapping plugins", ex);
|
||||
+ // Don't hard fail during bootstrap/plugin loading. The plugin(s) in question will be skipped
|
||||
+ LOGGER.error("Encountered exception remapping plugins", ex);
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
@ -1817,32 +1915,3 @@ index 45160b93a24dc74f6368441e2a4fe659ceaf5bf5..6573e72d041714ccc2bf0e3c8734bc21
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index fb8d14a2bdaaa25a2237fa4161388439ea8cfc0f..fdeec67b7f71700f88714b8ad734a5525fb119fd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -72,6 +72,7 @@ import org.bukkit.potion.PotionType;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class CraftMagicNumbers implements UnsafeValues {
|
||||
+ public static final boolean DISABLE_PLUGIN_REWRITING = Boolean.getBoolean("paper.disable-plugin-rewriting");
|
||||
public static final UnsafeValues INSTANCE = new CraftMagicNumbers();
|
||||
|
||||
private CraftMagicNumbers() {}
|
||||
@@ -356,7 +357,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
|
||||
}
|
||||
|
||||
- if (toCheck.isOlderThan(ApiVersion.FLATTENING)) {
|
||||
+ if (!DISABLE_PLUGIN_REWRITING && toCheck.isOlderThan(ApiVersion.FLATTENING)) { // Paper
|
||||
CraftLegacy.init();
|
||||
}
|
||||
|
||||
@@ -371,6 +372,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@Override
|
||||
public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) {
|
||||
+ if (DISABLE_PLUGIN_REWRITING) return clazz; // Paper
|
||||
try {
|
||||
clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()));
|
||||
} catch (Exception ex) {
|
||||
|
@ -43,6 +43,199 @@ index 893ad5e7c2d32ccd64962d95d146bbd317c28ab8..3d73ea0e63c97b2b08e719b7be7af389
|
||||
if (mojName == null && MOJANG_TO_OBF.containsKey(name)) {
|
||||
mojName = name;
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/BytecodeModifyingURLClassLoader.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/BytecodeModifyingURLClassLoader.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1240c061c121e8d5eb9add4e5e21955ee6df9368
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/BytecodeModifyingURLClassLoader.java
|
||||
@@ -0,0 +1,187 @@
|
||||
+package io.papermc.paper.plugin.entrypoint.classloader;
|
||||
+
|
||||
+import io.papermc.paper.pluginremap.reflect.ReflectionRemapper;
|
||||
+import java.io.IOException;
|
||||
+import java.io.InputStream;
|
||||
+import java.io.UncheckedIOException;
|
||||
+import java.net.JarURLConnection;
|
||||
+import java.net.URI;
|
||||
+import java.net.URL;
|
||||
+import java.net.URLClassLoader;
|
||||
+import java.security.CodeSigner;
|
||||
+import java.security.CodeSource;
|
||||
+import java.util.Map;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
+import java.util.function.Function;
|
||||
+import java.util.jar.Attributes;
|
||||
+import java.util.jar.Manifest;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.objectweb.asm.ClassReader;
|
||||
+import org.objectweb.asm.ClassVisitor;
|
||||
+import org.objectweb.asm.ClassWriter;
|
||||
+
|
||||
+import static java.util.Objects.requireNonNullElse;
|
||||
+
|
||||
+public final class BytecodeModifyingURLClassLoader extends URLClassLoader {
|
||||
+ static {
|
||||
+ ClassLoader.registerAsParallelCapable();
|
||||
+ }
|
||||
+
|
||||
+ private static final Object MISSING_MANIFEST = new Object();
|
||||
+
|
||||
+ private final Function<byte[], byte[]> modifier;
|
||||
+ private final Map<String, Object> manifests = new ConcurrentHashMap<>();
|
||||
+
|
||||
+ public BytecodeModifyingURLClassLoader(
|
||||
+ final URL[] urls,
|
||||
+ final ClassLoader parent,
|
||||
+ final Function<byte[], byte[]> modifier
|
||||
+ ) {
|
||||
+ super(urls, parent);
|
||||
+ this.modifier = modifier;
|
||||
+ }
|
||||
+
|
||||
+ public BytecodeModifyingURLClassLoader(
|
||||
+ final URL[] urls,
|
||||
+ final ClassLoader parent
|
||||
+ ) {
|
||||
+ this(urls, parent, bytes -> {
|
||||
+ final ClassReader classReader = new ClassReader(bytes);
|
||||
+ final ClassWriter classWriter = new ClassWriter(classReader, 0);
|
||||
+ final ClassVisitor visitor = ReflectionRemapper.visitor(classWriter);
|
||||
+ if (visitor == classWriter) {
|
||||
+ return bytes;
|
||||
+ }
|
||||
+ classReader.accept(visitor, 0);
|
||||
+ return classWriter.toByteArray();
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected Class<?> findClass(final String name) throws ClassNotFoundException {
|
||||
+ final Class<?> result;
|
||||
+ final String path = name.replace('.', '/').concat(".class");
|
||||
+ final URL url = this.findResource(path);
|
||||
+ if (url != null) {
|
||||
+ try {
|
||||
+ result = this.defineClass(name, url);
|
||||
+ } catch (final IOException e) {
|
||||
+ throw new ClassNotFoundException(name, e);
|
||||
+ }
|
||||
+ } else {
|
||||
+ result = null;
|
||||
+ }
|
||||
+ if (result == null) {
|
||||
+ throw new ClassNotFoundException(name);
|
||||
+ }
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ private Class<?> defineClass(String name, URL url) throws IOException {
|
||||
+ int i = name.lastIndexOf('.');
|
||||
+ if (i != -1) {
|
||||
+ String pkgname = name.substring(0, i);
|
||||
+ // Check if package already loaded.
|
||||
+ final @Nullable Manifest man = this.manifestFor(url);
|
||||
+ final URL jarUrl = URI.create(jarName(url)).toURL();
|
||||
+ if (this.getAndVerifyPackage(pkgname, man, jarUrl) == null) {
|
||||
+ try {
|
||||
+ if (man != null) {
|
||||
+ this.definePackage(pkgname, man, jarUrl);
|
||||
+ } else {
|
||||
+ this.definePackage(pkgname, null, null, null, null, null, null, null);
|
||||
+ }
|
||||
+ } catch (IllegalArgumentException iae) {
|
||||
+ // parallel-capable class loaders: re-verify in case of a
|
||||
+ // race condition
|
||||
+ if (this.getAndVerifyPackage(pkgname, man, jarUrl) == null) {
|
||||
+ // Should never happen
|
||||
+ throw new AssertionError("Cannot find package " +
|
||||
+ pkgname);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ final byte[] bytes;
|
||||
+ try (final InputStream is = url.openStream()) {
|
||||
+ bytes = is.readAllBytes();
|
||||
+ }
|
||||
+
|
||||
+ final byte[] modified = this.modifier.apply(bytes);
|
||||
+
|
||||
+ final CodeSource cs = new CodeSource(url, (CodeSigner[]) null);
|
||||
+ return this.defineClass(name, modified, 0, modified.length, cs);
|
||||
+ }
|
||||
+
|
||||
+ private Package getAndVerifyPackage(
|
||||
+ String pkgname,
|
||||
+ Manifest man, URL url
|
||||
+ ) {
|
||||
+ Package pkg = getDefinedPackage(pkgname);
|
||||
+ if (pkg != null) {
|
||||
+ // Package found, so check package sealing.
|
||||
+ if (pkg.isSealed()) {
|
||||
+ // Verify that code source URL is the same.
|
||||
+ if (!pkg.isSealed(url)) {
|
||||
+ throw new SecurityException(
|
||||
+ "sealing violation: package " + pkgname + " is sealed");
|
||||
+ }
|
||||
+ } else {
|
||||
+ // Make sure we are not attempting to seal the package
|
||||
+ // at this code source URL.
|
||||
+ if ((man != null) && this.isSealed(pkgname, man)) {
|
||||
+ throw new SecurityException(
|
||||
+ "sealing violation: can't seal package " + pkgname +
|
||||
+ ": already loaded");
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return pkg;
|
||||
+ }
|
||||
+
|
||||
+ private boolean isSealed(String name, Manifest man) {
|
||||
+ Attributes attr = man.getAttributes(name.replace('.', '/').concat("/"));
|
||||
+ String sealed = null;
|
||||
+ if (attr != null) {
|
||||
+ sealed = attr.getValue(Attributes.Name.SEALED);
|
||||
+ }
|
||||
+ if (sealed == null) {
|
||||
+ if ((attr = man.getMainAttributes()) != null) {
|
||||
+ sealed = attr.getValue(Attributes.Name.SEALED);
|
||||
+ }
|
||||
+ }
|
||||
+ return "true".equalsIgnoreCase(sealed);
|
||||
+ }
|
||||
+
|
||||
+ private @Nullable Manifest manifestFor(final URL url) throws IOException {
|
||||
+ Manifest man = null;
|
||||
+ if (url.getProtocol().equals("jar")) {
|
||||
+ try {
|
||||
+ final Object computedManifest = this.manifests.computeIfAbsent(jarName(url), $ -> {
|
||||
+ try {
|
||||
+ final Manifest m = ((JarURLConnection) url.openConnection()).getManifest();
|
||||
+ return requireNonNullElse(m, MISSING_MANIFEST);
|
||||
+ } catch (final IOException e) {
|
||||
+ throw new UncheckedIOException(e);
|
||||
+ }
|
||||
+ });
|
||||
+ if (computedManifest instanceof Manifest found) {
|
||||
+ man = found;
|
||||
+ }
|
||||
+ } catch (final UncheckedIOException e) {
|
||||
+ throw e.getCause();
|
||||
+ } catch (final IllegalArgumentException e) {
|
||||
+ throw new IOException(e);
|
||||
+ }
|
||||
+ }
|
||||
+ return man;
|
||||
+ }
|
||||
+
|
||||
+ private static String jarName(final URL sourceUrl) {
|
||||
+ final int exclamationIdx = sourceUrl.getPath().lastIndexOf('!');
|
||||
+ if (exclamationIdx != -1) {
|
||||
+ return sourceUrl.getPath().substring(0, exclamationIdx);
|
||||
+ }
|
||||
+ throw new IllegalArgumentException("Could not find jar for URL " + sourceUrl);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java b/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java
|
||||
index f9a2c55a354c877749db3f92956de802ae575788..39182cdd17473da0123dc7172dce507eab29fedc 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/entrypoint/classloader/PaperClassloaderBytecodeModifier.java
|
||||
@ -66,6 +259,76 @@ index f9a2c55a354c877749db3f92956de802ae575788..39182cdd17473da0123dc7172dce507e
|
||||
+ return classWriter.toByteArray();
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
|
||||
index f576060c8fe872772bbafe2016fc9b83a3c095f1..f9d4b33050a6fe8c2dabe8e5eec075d95dc513e0 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/loader/PaperClasspathBuilder.java
|
||||
@@ -2,12 +2,12 @@ package io.papermc.paper.plugin.loader;
|
||||
|
||||
import io.papermc.paper.plugin.PluginInitializerManager;
|
||||
import io.papermc.paper.plugin.bootstrap.PluginProviderContext;
|
||||
+import io.papermc.paper.plugin.entrypoint.classloader.BytecodeModifyingURLClassLoader;
|
||||
+import io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader;
|
||||
import io.papermc.paper.plugin.loader.library.ClassPathLibrary;
|
||||
import io.papermc.paper.plugin.loader.library.PaperLibraryStore;
|
||||
-import io.papermc.paper.plugin.entrypoint.classloader.PaperPluginClassLoader;
|
||||
import io.papermc.paper.plugin.provider.configuration.PaperPluginMeta;
|
||||
-import org.jetbrains.annotations.NotNull;
|
||||
-
|
||||
+import io.papermc.paper.util.MappingEnvironment;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Logger;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PaperClasspathBuilder implements PluginClasspathBuilder {
|
||||
|
||||
@@ -60,7 +61,10 @@ public class PaperClasspathBuilder implements PluginClasspathBuilder {
|
||||
}
|
||||
|
||||
try {
|
||||
- return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), new URLClassLoader(urls, getClass().getClassLoader()));
|
||||
+ final URLClassLoader libraryLoader = MappingEnvironment.DISABLE_PLUGIN_REWRITING
|
||||
+ ? new URLClassLoader(urls, this.getClass().getClassLoader())
|
||||
+ : new BytecodeModifyingURLClassLoader(urls, this.getClass().getClassLoader());
|
||||
+ return new PaperPluginClassLoader(logger, source, jarFile, configuration, this.getClass().getClassLoader(), libraryLoader);
|
||||
} catch (IOException exception) {
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
||||
index bdd9bc8a414719b9f1d6f01f90539ddb8603a878..fdb52ad85cfaa1d53aadcad72cec3d3c8c12c058 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
||||
@@ -1,9 +1,12 @@
|
||||
package io.papermc.paper.plugin.provider.type.spigot;
|
||||
|
||||
+import io.papermc.paper.plugin.entrypoint.classloader.BytecodeModifyingURLClassLoader;
|
||||
import io.papermc.paper.plugin.provider.configuration.serializer.constraints.PluginConfigConstraints;
|
||||
import io.papermc.paper.plugin.provider.type.PluginTypeFactory;
|
||||
+import io.papermc.paper.util.MappingEnvironment;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
+import org.bukkit.plugin.java.LibraryLoader;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -15,6 +18,12 @@ import java.util.jar.JarFile;
|
||||
|
||||
class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvider, PluginDescriptionFile> {
|
||||
|
||||
+ static {
|
||||
+ if (!MappingEnvironment.DISABLE_PLUGIN_REWRITING) {
|
||||
+ LibraryLoader.LIBRARY_LOADER_FACTORY = BytecodeModifyingURLClassLoader::new;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {
|
||||
// Copied from SimplePluginManager#loadPlugins
|
||||
diff --git a/src/main/java/io/papermc/paper/pluginremap/reflect/PaperReflection.java b/src/main/java/io/papermc/paper/pluginremap/reflect/PaperReflection.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c653d1f5af8b407cfba715e6027dbb695046892a
|
||||
@ -345,13 +608,14 @@ index 0000000000000000000000000000000000000000..5fa5868e82d1f00498d0c5771369e171
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MappingEnvironment.java b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
|
||||
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..38745299ea49f253a410e77557100903ecb472b0 100644
|
||||
index 8e4229634d41a42b3d93948eebb77def7c0c72b1..4d57213c9917ea965bfe06a5d242e61422457ee2 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MappingEnvironment.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MappingEnvironment.java
|
||||
@@ -10,6 +10,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@@ -10,6 +10,8 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class MappingEnvironment {
|
||||
+ public static final boolean DISABLE_PLUGIN_REWRITING = Boolean.getBoolean("paper.disable-plugin-rewriting");
|
||||
+ public static final String LEGACY_CB_VERSION = "v1_20_R4";
|
||||
private static final @Nullable String MAPPINGS_HASH = readMappingsHash();
|
||||
private static final boolean REOBF = checkReobf();
|
||||
@ -441,3 +705,24 @@ index 8420a53672cfb0f060d9c85c445d200b6701f521..fc04bfcb8b5dfa6d093c8d75b2f20c50
|
||||
final Set<RerouteMethodData> rerouteMethodData = new HashSet<>();
|
||||
String className;
|
||||
boolean isInterface;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index c8c66f78335868100adbb4d044037168872d5f94..beffeedee0afdb885558c832f8801cd713d741a3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -356,7 +356,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it.");
|
||||
}
|
||||
|
||||
- if (toCheck.isOlderThan(ApiVersion.FLATTENING)) {
|
||||
+ if (!io.papermc.paper.util.MappingEnvironment.DISABLE_PLUGIN_REWRITING && toCheck.isOlderThan(ApiVersion.FLATTENING)) { // Paper
|
||||
CraftLegacy.init();
|
||||
}
|
||||
|
||||
@@ -371,6 +371,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@Override
|
||||
public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) {
|
||||
+ if (io.papermc.paper.util.MappingEnvironment.DISABLE_PLUGIN_REWRITING) return clazz; // Paper
|
||||
try {
|
||||
clazz = Commodore.convert(clazz, pdf.getName(), ApiVersion.getOrCreateVersion(pdf.getAPIVersion()));
|
||||
} catch (Exception ex) {
|
||||
|
@ -1527,10 +1527,10 @@ index 991ebf07bc0608df0a12f1f26e581cc93255ae01..946001c57c326f2d2f0677bca954e855
|
||||
private String descriptionId;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index 09ae9c3398e77ee575636a4ebe9e31b447c9fb8e..6eef8da8ead8a044aac757693d719ceea431515e 100644
|
||||
index 099f85ec8b427392947e815e0b85d7ec49369bc3..fb495fcbf42be3825bfb785a9887148c54f5b00b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -33,10 +33,12 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
@@ -34,10 +34,12 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
// CraftBukkit end
|
||||
|
||||
import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
@ -2005,10 +2005,10 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222
|
||||
+ } // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index fdeec67b7f71700f88714b8ad734a5525fb119fd..9ae089c6dbb1cc919b005fd9672a690f89ca2b42 100644
|
||||
index beffeedee0afdb885558c832f8801cd713d741a3..beae45fb45eb0629ba36f8daabaf7d9cb9716b71 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -212,6 +212,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
// Paper end
|
||||
// ========================================================================
|
||||
@ -2021,7 +2021,7 @@ index fdeec67b7f71700f88714b8ad734a5525fb119fd..9ae089c6dbb1cc919b005fd9672a690f
|
||||
|
||||
public static byte toLegacyData(BlockState data) {
|
||||
return CraftLegacy.toLegacyData(data);
|
||||
@@ -463,6 +469,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -462,6 +468,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) {
|
||||
return new CraftDamageSourceBuilder(damageType);
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Support components in ItemMeta
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3ea16b831 100644
|
||||
index 9a22459f15cff45a234c1d497aca27a5433570f7..9c139f25eaef3c1b93fbf254cb08c6a449288ec8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -860,11 +860,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -867,11 +867,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return CraftChatMessage.fromComponent(this.displayName);
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3
|
||||
@Override
|
||||
public boolean hasDisplayName() {
|
||||
return this.displayName != null;
|
||||
@@ -1026,6 +1038,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1045,6 +1057,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return this.lore == null ? null : new ArrayList<String>(Lists.transform(this.lore, CraftChatMessage::fromComponent));
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3
|
||||
@Override
|
||||
public void setLore(List<String> lore) {
|
||||
if (lore == null || lore.isEmpty()) {
|
||||
@@ -1040,6 +1060,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1059,6 +1079,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ index 3cb5685a97f67d759537fc92bb4cb376bb2905a7..e967d6b32d9538d8456d73a67a73e3d3
|
||||
@Override
|
||||
public boolean hasCustomModelData() {
|
||||
return this.customModelData != null;
|
||||
@@ -1663,6 +1698,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1682,6 +1717,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
}
|
||||
|
||||
for (Object object : addFrom) {
|
||||
|
@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..22a55be34fde453fedd987173d95b8b3
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 9ae089c6dbb1cc919b005fd9672a690f89ca2b42..2f21520106aa848a9108937474570a8c4e723cfb 100644
|
||||
index beae45fb45eb0629ba36f8daabaf7d9cb9716b71..d568c3c85c44efc0fd0a43e7758fcd6899a60000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -474,6 +474,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -473,6 +473,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public String getTimingsServerName() {
|
||||
return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ index 8256af275e468a5aa506f0af22428f4082204956..c71d4f91df7ec1cf26888b00fac444bc
|
||||
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null);
|
||||
worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index da52fdde1a17c230b4da2c58708fa69ebcf13431..81db0e4e4bced556d35978a10c9d9789ec527830 100644
|
||||
index 7a95aff16a973b7b7d00e8409a252d4a2f6c41bf..a1c5e5913430404838205bc4a04b2afcff9d9046 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -193,6 +193,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -26,10 +26,10 @@ index 5f881af95bd5ee94daadfd9e5d64ee6d411255c4..472df81e4aef21e0cf2684a9e04d6ce1
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index 6eef8da8ead8a044aac757693d719ceea431515e..0883e1755eae316faaeae8bf95763a0f80313c5a 100644
|
||||
index fb495fcbf42be3825bfb785a9887148c54f5b00b..8d281ce2a0e44b97957cea2992e273abc86bd157 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -262,7 +262,12 @@ public abstract class BlockEntity {
|
||||
@@ -263,7 +263,12 @@ public abstract class BlockEntity {
|
||||
return s + " // " + this.getClass().getCanonicalName();
|
||||
});
|
||||
if (this.level != null) {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix lag from explosions processing dead entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 73cc11cf4732ede545e924d07480cae14c3ef226..8307c3e77ddc80a02f420503d67ae06fb973dc09 100644
|
||||
index 296de8e9ae1284d4805932e746291d1148f7f8eb..b8b142f573b297ba72d45be3ae4c2729f3cffe1e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -226,7 +226,7 @@ public class Explosion {
|
||||
|
@ -22,7 +22,7 @@ index fcb2d06f088a938b5bb76e6b42581d8f292d2eaf..231fba80a25601cdfba4f6f44ac7c288
|
||||
|
||||
this.profiler.popPush("connection");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 8307c3e77ddc80a02f420503d67ae06fb973dc09..c769da15f1d0bdbd2bce412aa9fae6d10d1177f7 100644
|
||||
index b8b142f573b297ba72d45be3ae4c2729f3cffe1e..157eac2a0a92f13ec191ee07774bdb3680e7e5b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -278,7 +278,7 @@ public class Explosion {
|
||||
@ -34,7 +34,7 @@ index 8307c3e77ddc80a02f420503d67ae06fb973dc09..c769da15f1d0bdbd2bce412aa9fae6d1
|
||||
double d13;
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
@@ -532,4 +532,84 @@ public class Explosion {
|
||||
@@ -534,4 +534,84 @@ public class Explosion {
|
||||
|
||||
private BlockInteraction() {}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Disable explosion knockback
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index c769da15f1d0bdbd2bce412aa9fae6d10d1177f7..94f72ff58ac5206878a81e89d32e81c17b1bd1fb 100644
|
||||
index 157eac2a0a92f13ec191ee07774bdb3680e7e5b5..754ca46d11dfe0495aa3109b68b1032e6d7d76e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -284,7 +284,7 @@ public class Explosion {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index c731730abe50c521e5ce22b5fd8844ea1caed7ac..d3ef3d9a67bc54a4c82a39718f01201201dfc44c 100644
|
||||
index 2508e06ef33a4c219b330aec7d5311c5702b8e1b..cf48d4531821c2b1b031a63c8f007aa7d3fbef1d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -150,7 +150,7 @@ index b6521462d193bff83ace1dc694c6d957a7173969..d302767e8f01fdfcba9c22e2e35677af
|
||||
|
||||
static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba320632df9 100644
|
||||
index 9c139f25eaef3c1b93fbf254cb08c6a449288ec8..0c385b713234a74ceba802f67f74e4ecab93e269 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;
|
||||
@ -195,7 +195,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3
|
||||
}
|
||||
|
||||
if (meta.hasAttributeModifiers()) {
|
||||
@@ -385,8 +388,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -391,8 +394,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3
|
||||
|
||||
tag.entrySet().forEach((entry) -> {
|
||||
Holder<net.minecraft.world.item.enchantment.Enchantment> id = entry.getKey();
|
||||
@@ -640,13 +643,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -646,13 +649,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3
|
||||
for (Map.Entry<?, ?> entry : ench.entrySet()) {
|
||||
// Doctor older enchants
|
||||
String enchantKey = entry.getKey().toString();
|
||||
@@ -951,14 +954,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -970,14 +973,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
@Override
|
||||
public Map<Enchantment, Integer> getEnchants() {
|
||||
@ -239,7 +239,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3
|
||||
}
|
||||
|
||||
if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) {
|
||||
@@ -1494,7 +1497,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1513,7 +1516,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
clone.customModelData = this.customModelData;
|
||||
clone.blockData = this.blockData;
|
||||
if (this.enchantments != null) {
|
||||
@ -248,7 +248,7 @@ index e967d6b32d9538d8456d73a67a73e3d3ea16b831..e88364dfe067c605856390d2cce07ba3
|
||||
}
|
||||
if (this.hasAttributeModifiers()) {
|
||||
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
|
||||
@@ -1814,4 +1817,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1833,4 +1836,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
return (result != null) ? result : Optional.empty();
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ index 31ccca2a4e94cb1b3f43de38907634f7e6e18aa5..385dd65af8b526d128ac4c99cecdb69a
|
||||
case RELEASE_SHIFT_KEY:
|
||||
this.player.setShiftKeyDown(false);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 81db0e4e4bced556d35978a10c9d9789ec527830..4ac2d47df8e805b4f895951e839a0af8df7127cc 100644
|
||||
index a1c5e5913430404838205bc4a04b2afcff9d9046..0654cca68acefccec82cc138acba30515a336cfb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -588,6 +588,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Shoulder Entities Release API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 4ac2d47df8e805b4f895951e839a0af8df7127cc..e292c1ab45d2618c4e852875107ec1819dba85c4 100644
|
||||
index 0654cca68acefccec82cc138acba30515a336cfb..e81acc5c982cd14bc8a3aa5bf06e9636179b8555 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1982,20 +1982,45 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index e292c1ab45d2618c4e852875107ec1819dba85c4..259ec0dea938758f43560b1ed7f46c1042984774 100644
|
||||
index e81acc5c982cd14bc8a3aa5bf06e9636179b8555..c1c0df2f4cf032a004568ab0e8f21db91e9dc705 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1243,7 +1243,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE
|
||||
If Tile Entity was null, correct Sign to return empty lines instead of null
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index 0883e1755eae316faaeae8bf95763a0f80313c5a..90b218ebc947a1d8a8c7dfc677fe145b6386654a 100644
|
||||
index 8d281ce2a0e44b97957cea2992e273abc86bd157..d22cc83725cee3df20bb6f99de23aceb62923eef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -57,6 +57,7 @@ public abstract class BlockEntity {
|
||||
@@ -58,6 +58,7 @@ public abstract class BlockEntity {
|
||||
this.type = type;
|
||||
this.worldPosition = pos.immutable();
|
||||
this.blockState = state;
|
||||
@ -24,7 +24,7 @@ index 0883e1755eae316faaeae8bf95763a0f80313c5a..90b218ebc947a1d8a8c7dfc677fe145b
|
||||
}
|
||||
|
||||
public static BlockPos getPosFromTag(CompoundTag nbt) {
|
||||
@@ -78,7 +79,7 @@ public abstract class BlockEntity {
|
||||
@@ -79,7 +80,7 @@ public abstract class BlockEntity {
|
||||
|
||||
// CraftBukkit start - read container
|
||||
protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
|
||||
@ -33,7 +33,7 @@ index 0883e1755eae316faaeae8bf95763a0f80313c5a..90b218ebc947a1d8a8c7dfc677fe145b
|
||||
|
||||
net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues");
|
||||
if (persistentDataTag instanceof CompoundTag) {
|
||||
@@ -342,8 +343,15 @@ public abstract class BlockEntity {
|
||||
@@ -353,8 +354,15 @@ public abstract class BlockEntity {
|
||||
|
||||
// CraftBukkit start - add method
|
||||
public InventoryHolder getOwner() {
|
||||
|
@ -14,7 +14,7 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I
|
||||
public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 7e1f6e23980f12786abaa4218d8d77dd1a8feb3c..791b655890ce5b144f8649f687945c17a390ce76 100644
|
||||
index 7e1f6e23980f12786abaa4218d8d77dd1a8feb3c..96277af4b3c1ebe081bf4aa42c7b78f1f084cbd6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1624,7 +1624,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@ -27,7 +27,7 @@ index 7e1f6e23980f12786abaa4218d8d77dd1a8feb3c..791b655890ce5b144f8649f687945c17
|
||||
+ ServerPlayer handle = this.getHandle();
|
||||
+ // Logic copied from EntityExperienceOrb and remapped to unobfuscated methods/properties
|
||||
+ final var stackEntry = net.minecraft.world.item.enchantment.EnchantmentHelper
|
||||
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle);
|
||||
+ .getRandomItemWith(net.minecraft.world.item.enchantment.Enchantments.MENDING, handle, net.minecraft.world.item.ItemStack::isDamaged);
|
||||
+ final net.minecraft.world.item.ItemStack itemstack = stackEntry != null ? stackEntry.getValue() : net.minecraft.world.item.ItemStack.EMPTY;
|
||||
+ if (!itemstack.isEmpty() && itemstack.getItem().components().has(net.minecraft.core.component.DataComponents.MAX_DAMAGE)) {
|
||||
+ net.minecraft.world.entity.ExperienceOrb orb = net.minecraft.world.entity.EntityType.EXPERIENCE_ORB.create(handle.level());
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Toggleable player crits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 259ec0dea938758f43560b1ed7f46c1042984774..fecb622cb33fd75b87b055fb40f127cda6a22a7d 100644
|
||||
index c1c0df2f4cf032a004568ab0e8f21db91e9dc705..715a66018afa8d67f6e078e1157886390a2ad5dd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1251,6 +1251,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Configurable sprint interruption on attack
|
||||
If the sprint interruption is disabled players continue sprinting when they attack entities.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index fecb622cb33fd75b87b055fb40f127cda6a22a7d..0fa9cb53706482f5ea385ce4355273b67911b23a 100644
|
||||
index 715a66018afa8d67f6e078e1157886390a2ad5dd..c7865bb6fa7fbeee365a70a4858b0addb36d4165 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1299,8 +1299,12 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -7,7 +7,7 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
|
||||
Plugins can skip selection of certain arrows and control which is used.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 0fa9cb53706482f5ea385ce4355273b67911b23a..705a756522473681516d60946ddd917647650bd4 100644
|
||||
index c7865bb6fa7fbeee365a70a4858b0addb36d4165..338903091e43b71baa46157a95629c2e6b27b992 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2219,18 +2219,29 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -179,7 +179,7 @@ index 38c27b4aa37e8b046e3eccdde3f527eb555da6f8..05dee42941a842bf4bba9480a2c04a14
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 705a756522473681516d60946ddd917647650bd4..4e1c032c7cdca81021c280a15db89e63a90ffe42 100644
|
||||
index 338903091e43b71baa46157a95629c2e6b27b992..0efd7b3d748d90b3359560aa717a017092ae0e47 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1295,7 +1295,7 @@ public abstract class Player extends LivingEntity {
|
||||
@ -218,7 +218,7 @@ index 9f9b7373c9a714597858ddcd8932e31b902cf5a1..f7f26d595072372004143c4e26506ed5
|
||||
public abstract void explode();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 94f72ff58ac5206878a81e89d32e81c17b1bd1fb..b5b29210d9a6125d98e7dd737ca25f40545e512b 100644
|
||||
index 754ca46d11dfe0495aa3109b68b1032e6d7d76e9..4c7795e1ba7bb3135fcf5bab1c8aa857b8e7417b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -303,6 +303,16 @@ public class Explosion {
|
||||
|
@ -109,7 +109,7 @@ index d25c762e449e2bce20487454ad52363b35b9af96..3273c3f06c142d4e3c947ca846459f4a
|
||||
|
||||
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 4e1c032c7cdca81021c280a15db89e63a90ffe42..9cc9c6f7e211d9cf42a050f3a265d0bceaf7fd40 100644
|
||||
index 0efd7b3d748d90b3359560aa717a017092ae0e47..b27a6719edd47f7ecb3f8c5560a36fc201efea36 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -277,7 +277,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Remove unnecessary itemmeta handling
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 96da768f55ad835a1a55bf359f0d7278bc232304..fb345894fec5e81d3c35af9812927220a7d56cd1 100644
|
||||
index d6b02a946bd18ea71278a5026468ec49fabd3a3b..6dd441484dbae1818a927773a6e6c663c70ccd0e 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -168,7 +168,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Allow chests to be placed with NBT data
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index fb345894fec5e81d3c35af9812927220a7d56cd1..bf3785e3b347ebc1ce1e044c9db1a9d23c80f880 100644
|
||||
index 6dd441484dbae1818a927773a6e6c663c70ccd0e..91f342912372326a6ced16c23550da7727d6d3ad 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -469,6 +469,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
@ -12,10 +12,10 @@ public net.minecraft.world.level.pathfinder.Path nodes
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..064712e7b27a200b29c72076a82f4f5611fa507f
|
||||
index 0000000000000000000000000000000000000000..3dbe4cf29a7984a1976a60bdeeb3ede02316a3cb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java
|
||||
@@ -0,0 +1,143 @@
|
||||
@@ -0,0 +1,148 @@
|
||||
+package com.destroystokyo.paper.entity;
|
||||
+
|
||||
+import org.apache.commons.lang.Validate;
|
||||
@ -132,6 +132,11 @@ index 0000000000000000000000000000000000000000..064712e7b27a200b29c72076a82f4f56
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canReachFinalPoint() {
|
||||
+ return path.canReach();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<Location> getPoints() {
|
||||
+ List<Location> points = new ArrayList<>();
|
||||
+ for (Node point : path.nodes) {
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Noah van der Aa <ndvdaa@gmail.com>
|
||||
Date: Mon, 29 Apr 2024 23:12:33 +0200
|
||||
Subject: [PATCH] Catch JsonParseException in block entity names
|
||||
|
||||
As a result, data that no longer parses correctly will not crash the server
|
||||
instead just logging the exception and continuing (and in most cases should
|
||||
fix the data)
|
||||
|
||||
Player data is fixed pretty much immediately but some block data (like
|
||||
Shulkers) may need to be changed in order for it to re-save properly
|
||||
|
||||
No more crashing though.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
index 81d9a4e6bc1bc4f992ecb77b176daf89d645bbf2..e79b1ccbdf12006d72401b5be1ac25187033ec59 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -151,7 +151,7 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
if (nbt.contains("custom_name", 8)) {
|
||||
- this.customName = Component.Serializer.fromJson(nbt.getString("custom_name"), registryLookup);
|
||||
+ this.customName = BlockEntity.parseCustomNameSafe(nbt.getString("custom_name"), registryLookup); // Paper
|
||||
} else {
|
||||
this.customName = null;
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sat, 22 Sep 2018 15:56:59 -0400
|
||||
Subject: [PATCH] Catch JsonParseException in entity and block entity names
|
||||
|
||||
As a result, data that no longer parses correctly will not crash the server
|
||||
instead just logging the exception and continuing (and in most cases should
|
||||
fix the data)
|
||||
|
||||
Player data is fixed pretty much immediately but some block data (like
|
||||
Shulkers) may need to be changed in order for it to re-save properly
|
||||
|
||||
No more crashing though.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index c95a0af32178fe24448a5ae7a229c86ec883e8de..5c401c7e30ed5f6f32b1ad6523537aa46173cff5 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -558,4 +558,19 @@ public final class MCUtil {
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
+
|
||||
+ @Nullable
|
||||
+ public static net.minecraft.network.chat.Component getBaseComponentFromNbt(final String key, final net.minecraft.nbt.CompoundTag compound, final net.minecraft.core.HolderLookup.Provider lookupProvider) {
|
||||
+ if (!compound.contains(key)) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ final String string = compound.getString(key);
|
||||
+ try {
|
||||
+ return net.minecraft.network.chat.Component.Serializer.fromJson(string, lookupProvider);
|
||||
+ } catch (com.google.gson.JsonParseException e) {
|
||||
+ org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage());
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
index 626e4fe03dea008907823b49f0dd936bbf7e4e04..2d0eac7a8aa94ed6c4ec024bc6024440cbeac702 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
@@ -75,7 +75,7 @@ public abstract class BaseCommandBlock implements CommandSource {
|
||||
this.command = nbt.getString("Command");
|
||||
this.successCount = nbt.getInt("SuccessCount");
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.setCustomName(Component.Serializer.fromJson(nbt.getString("CustomName"), registries));
|
||||
+ this.setCustomName(io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registries)); // Paper - Catch ParseException
|
||||
} else {
|
||||
this.setCustomName((Component) null);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
|
||||
index df4cd333ecd5c90e910df0c7c5ab5aa44c182903..2656e06ab2269141a13011eaa906f601887ca3e2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
|
||||
@@ -77,7 +77,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
|
||||
protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
|
||||
super.loadAdditional(nbt, registryLookup);
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
|
||||
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
|
||||
}
|
||||
|
||||
if (nbt.contains("patterns")) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||
index ee3b370b6b36914146db33a3211b6bbd2f8f16b7..ff3f26c31bd11b48f48e354ea6b33aa55dcbff5d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||
@@ -39,7 +39,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
|
||||
super.loadAdditional(nbt, registryLookup);
|
||||
this.lockKey = LockCode.fromTag(nbt);
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
|
||||
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index d3ef3d9a67bc54a4c82a39718f01201201dfc44c..18450017bc3df2f0b1a5715e6021e8e5defa24a1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -391,7 +391,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
this.secondaryPower = BeaconBlockEntity.loadEffect(nbt, "secondary_effect");
|
||||
this.levels = nbt.getInt("Levels"); // CraftBukkit - SPIGOT-5053, use where available
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
|
||||
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
|
||||
}
|
||||
|
||||
this.lockKey = LockCode.fromTag(nbt);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
|
||||
index 767994f493fb0a0e4bf097cd7cc178c10e79e937..c3503eaec5c5ece6e27a52fb703d06ec7c767383 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantingTableBlockEntity.java
|
||||
@@ -45,7 +45,7 @@ public class EnchantingTableBlockEntity extends BlockEntity implements Nameable
|
||||
protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) {
|
||||
super.loadAdditional(nbt, registryLookup);
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"), registryLookup);
|
||||
+ this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt, registryLookup); // Paper - Catch ParseException
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
index 81d9a4e6bc1bc4f992ecb77b176daf89d645bbf2..40714cb145822b52cbc991a844486f87e46106d8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -151,7 +151,7 @@ public class SkullBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
if (nbt.contains("custom_name", 8)) {
|
||||
- this.customName = Component.Serializer.fromJson(nbt.getString("custom_name"), registryLookup);
|
||||
+ this.customName = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("custom_name", nbt, registryLookup); // Paper - Catch ParseException
|
||||
} else {
|
||||
this.customName = null;
|
||||
}
|
@ -93,7 +93,7 @@ index bac78415e34d41e3a5de482b86185f2202ecf068..a4eee658ecfc0f25e854c17a7715cb16
|
||||
this.dismountVehicle(entity);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 9cc9c6f7e211d9cf42a050f3a265d0bceaf7fd40..42911a87a9028a7ba8c3f63f498e4f15bcd07f24 100644
|
||||
index b27a6719edd47f7ecb3f8c5560a36fc201efea36..bbafbeff99a7c1bd2d9e27982671a017071f829c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1150,7 +1150,13 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index b5b29210d9a6125d98e7dd737ca25f40545e512b..30109db978563fab1a33b450f0ca82e176539703 100644
|
||||
index 4c7795e1ba7bb3135fcf5bab1c8aa857b8e7417b..0f02361110143c839fde6ada38e9e0b512aef978 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -192,7 +192,7 @@ public class Explosion {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Improve java version check
|
||||
Co-Authored-By: MiniDigger <admin@benndorf.dev>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index caa7fefab037a24713e9f7f15a541d47bc7655ee..cc4f7f5bdb6b930af4130dc775e4ed754be87783 100644
|
||||
index caa7fefab037a24713e9f7f15a541d47bc7655ee..11b1e23ea2a0d4faf7e74d3c9580b7a776ac795b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -202,23 +202,27 @@ public class Main {
|
||||
@ -24,7 +24,7 @@ index caa7fefab037a24713e9f7f15a541d47bc7655ee..cc4f7f5bdb6b930af4130dc775e4ed75
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 22 is supported.");
|
||||
+ boolean isOldVersion = javaVersion < 61.0;
|
||||
+ if (!skip && isOldVersion) {
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 17. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 21. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
return;
|
||||
}
|
||||
String javaVersionName = System.getProperty("java.version");
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
|
||||
Serializes using NBT which is safer for server data migrations than bukkits format.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 2f21520106aa848a9108937474570a8c4e723cfb..13568d93bf9c0243a9505d1c0aa36fb912bf2bb7 100644
|
||||
index d568c3c85c44efc0fd0a43e7758fcd6899a60000..54e5d76e5ec40912a5c09123d879cd5bef8da4b1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -479,6 +479,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -478,6 +478,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
return new com.destroystokyo.paper.PaperVersionFetcher();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ This fixes a lot of game state issues where packets were delayed for processing
|
||||
due to 1.15's new queue but processed while dead.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 42911a87a9028a7ba8c3f63f498e4f15bcd07f24..8fe41d4291736fd8c45d73429062a597d54ac30b 100644
|
||||
index bbafbeff99a7c1bd2d9e27982671a017071f829c..f07c2bd727a8e3e65bb2e6b1367a4bb392febe23 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1162,7 +1162,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -40,10 +40,10 @@ index a6cd53e08a0770b93876f98efa7ebfe5b77a2f15..8011266f5fe082c0a81a7a828fe2cf74
|
||||
} else {
|
||||
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
index 2d0eac7a8aa94ed6c4ec024bc6024440cbeac702..e40069d937de5fd00741ae6873abeecc46b93732 100644
|
||||
index efd6fcb0528d3c903e720edeb2f704347b34c18d..8c2dcc4134d96351cee75773214f3f47e71533e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
@@ -203,7 +203,7 @@ public abstract class BaseCommandBlock implements CommandSource {
|
||||
@@ -204,7 +204,7 @@ public abstract class BaseCommandBlock implements CommandSource {
|
||||
}
|
||||
|
||||
public InteractionResult usedBy(Player player) {
|
||||
|
@ -19,29 +19,37 @@ index 69d093d3450931038ac3d27d7874060d13dc2225..27775df10a490ff75ca377e837393173
|
||||
.flatMap(entry -> entry.getKey().stream().map(s -> Map.entry(s, entry.getValue())))
|
||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/DumpItemCommand.java b/src/main/java/io/papermc/paper/command/subcommands/DumpItemCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..efc4ec58ab4b3ceefd66b714d286a6187babc724
|
||||
index 0000000000000000000000000000000000000000..522609d685159c71aeadbb16ee11caa826a20ff7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/DumpItemCommand.java
|
||||
@@ -0,0 +1,94 @@
|
||||
@@ -0,0 +1,133 @@
|
||||
+package io.papermc.paper.command.subcommands;
|
||||
+
|
||||
+import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import io.papermc.paper.command.CommandUtil;
|
||||
+import io.papermc.paper.command.PaperSubcommand;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Collections;
|
||||
+import java.util.IdentityHashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Optional;
|
||||
+import java.util.Set;
|
||||
+import java.util.function.Consumer;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.ComponentLike;
|
||||
+import net.kyori.adventure.text.JoinConfiguration;
|
||||
+import net.kyori.adventure.text.TextComponent;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.RegistryAccess;
|
||||
+import net.minecraft.core.component.DataComponentMap;
|
||||
+import net.minecraft.core.component.DataComponentPatch;
|
||||
+import net.minecraft.core.component.DataComponentType;
|
||||
+import net.minecraft.core.component.TypedDataComponent;
|
||||
+import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.nbt.NbtOps;
|
||||
+import net.minecraft.nbt.NbtUtils;
|
||||
+import net.minecraft.nbt.SnbtPrinterTagVisitor;
|
||||
+import net.minecraft.nbt.Tag;
|
||||
+import net.minecraft.resources.RegistryOps;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
@ -50,6 +58,7 @@ index 0000000000000000000000000000000000000000..efc4ec58ab4b3ceefd66b714d286a618
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
+
|
||||
+import static net.kyori.adventure.text.Component.join;
|
||||
@ -61,17 +70,19 @@ index 0000000000000000000000000000000000000000..efc4ec58ab4b3ceefd66b714d286a618
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.RED;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.WHITE;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
|
||||
+import static net.kyori.adventure.text.format.TextColor.color;
|
||||
+import static net.kyori.adventure.text.format.TextDecoration.ITALIC;
|
||||
+
|
||||
+@DefaultQualifier(NonNull.class)
|
||||
+public final class DumpItemCommand implements PaperSubcommand {
|
||||
+ @Override
|
||||
+ public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
||||
+ this.doDumpItem(sender);
|
||||
+ this.doDumpItem(sender, args.length > 0 && "all".equals(args[0]));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ private void doDumpItem(final CommandSender sender) {
|
||||
+ @SuppressWarnings({"unchecked", "OptionalAssignedToNull", "rawtypes"})
|
||||
+ private void doDumpItem(final CommandSender sender, final boolean includeAllComponents) {
|
||||
+ if (!(sender instanceof final Player player)) {
|
||||
+ sender.sendMessage("Only players can use this command");
|
||||
+ return;
|
||||
@ -82,38 +93,66 @@ index 0000000000000000000000000000000000000000..efc4ec58ab4b3ceefd66b714d286a618
|
||||
+ final String itemName = itemStack.getItemHolder().unwrapKey().orElseThrow().location().toString();
|
||||
+ itemCommandBuilder.append(itemName);
|
||||
+ visualOutput.append(text(itemName, YELLOW)); // item type
|
||||
+ final Set<DataComponentType<?>> referencedComponentTypes = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
+ final DataComponentPatch patch = itemStack.getComponentsPatch();
|
||||
+ referencedComponentTypes.addAll(patch.entrySet().stream().map(Map.Entry::getKey).toList());
|
||||
+ final DataComponentMap prototype = itemStack.getItem().components();
|
||||
+ if (includeAllComponents) {
|
||||
+ referencedComponentTypes.addAll(prototype.keySet());
|
||||
+ }
|
||||
+
|
||||
+ final RegistryAccess.Frozen access = ((CraftServer) sender.getServer()).getServer().registryAccess();
|
||||
+ final RegistryOps<Tag> ops = access.createSerializationContext(NbtOps.INSTANCE);
|
||||
+ final Registry<DataComponentType<?>> registry = access.registryOrThrow(Registries.DATA_COMPONENT_TYPE);
|
||||
+ if (!patch.isEmpty()) {
|
||||
+ visualOutput.append(text("[", WHITE));
|
||||
+ itemCommandBuilder.append("[");
|
||||
+ final List<ComponentLike> componentComponents = new ArrayList<>();
|
||||
+ final List<String> commandComponents = new ArrayList<>();
|
||||
+ for (final Map.Entry<DataComponentType<?>, Optional<?>> entry : patch.entrySet()) {
|
||||
+ final String path = registry.getResourceKey(entry.getKey()).orElseThrow().location().getPath();
|
||||
+ if (entry.getValue().isEmpty()) {
|
||||
+ final List<ComponentLike> componentComponents = new ArrayList<>();
|
||||
+ final List<String> commandComponents = new ArrayList<>();
|
||||
+ for (final DataComponentType<?> type : referencedComponentTypes) {
|
||||
+ final String path = registry.getResourceKey(type).orElseThrow().location().getPath();
|
||||
+ final @Nullable Optional<?> patchedValue = patch.get(type);
|
||||
+ final @Nullable TypedDataComponent<?> prototypeValue = prototype.getTyped(type);
|
||||
+ if (patchedValue != null) {
|
||||
+ if (patchedValue.isEmpty()) {
|
||||
+ componentComponents.add(text().append(text('!', RED), text(path, AQUA)));
|
||||
+ commandComponents.add("!" + path);
|
||||
+ } else {
|
||||
+ final Tag serialized = (Tag) ((DataComponentType) entry.getKey()).codecOrThrow().encodeStart(ops, entry.getValue().get()).getOrThrow();
|
||||
+ componentComponents.add(textOfChildren(
|
||||
+ text(path, AQUA),
|
||||
+ text("=", WHITE),
|
||||
+ PaperAdventure.asAdventure(NbtUtils.toPrettyComponent(serialized))
|
||||
+ ));
|
||||
+ commandComponents.add(path + "=" + serialized.getAsString());
|
||||
+ final Tag serialized = (Tag) ((DataComponentType) type).codecOrThrow().encodeStart(ops, patchedValue.get()).getOrThrow();
|
||||
+ writeComponentValue(componentComponents::add, commandComponents::add, path, serialized);
|
||||
+ }
|
||||
+
|
||||
+ } else if (includeAllComponents && prototypeValue != null) {
|
||||
+ final Tag serialized = prototypeValue.encodeValue(ops).getOrThrow();
|
||||
+ writeComponentValue(componentComponents::add, commandComponents::add, path, serialized);
|
||||
+ }
|
||||
+ visualOutput
|
||||
+ .append(join(JoinConfiguration.separator(text(",", WHITE)), componentComponents))
|
||||
+ .append(text("]", WHITE));
|
||||
+ itemCommandBuilder.append(String.join(",", commandComponents)).append("]");
|
||||
+ }
|
||||
+ final Component hoverMsg = text("Click to copy item definition to clipboard for use with /pgive", GRAY, ITALIC);
|
||||
+ player.sendMessage(visualOutput.build().compact().hoverEvent(hoverMsg).clickEvent(copyToClipboard(itemCommandBuilder.toString())));
|
||||
+ if (!componentComponents.isEmpty()) {
|
||||
+ visualOutput.append(
|
||||
+ text("[", color(0x8910CE)),
|
||||
+ join(JoinConfiguration.separator(text(",", GRAY)), componentComponents),
|
||||
+ text("]", color(0x8910CE))
|
||||
+ );
|
||||
+ itemCommandBuilder
|
||||
+ .append("[")
|
||||
+ .append(String.join(",", commandComponents))
|
||||
+ .append("]");
|
||||
+ }
|
||||
+ player.sendMessage(visualOutput.build().compact());
|
||||
+ final Component copyMsg = text("Click to copy item definition to clipboard for use with /pgive", GRAY, ITALIC);
|
||||
+ sender.sendMessage(copyMsg.clickEvent(copyToClipboard(itemCommandBuilder.toString())));
|
||||
+ }
|
||||
+
|
||||
+ private static void writeComponentValue(final Consumer<Component> visualOutput, final Consumer<String> commandOutput, final String path, final Tag serialized) {
|
||||
+ visualOutput.accept(textOfChildren(
|
||||
+ text(path, color(0xFF7FD7)),
|
||||
+ text("=", WHITE),
|
||||
+ PaperAdventure.asAdventure(NbtUtils.toPrettyComponent(serialized))
|
||||
+ ));
|
||||
+ commandOutput.accept(path + "=" + new SnbtPrinterTagVisitor("", 0, new ArrayList<>()).visit(serialized));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(final CommandSender sender, final String subCommand, final String[] args) {
|
||||
+ if (args.length == 1) {
|
||||
+ return CommandUtil.getListMatchingLast(sender, args, "all");
|
||||
+ }
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+}
|
||||
|
@ -30,10 +30,10 @@ index de40e522960469b98f987bd688489740446d9f85..a0a34f680e21007ebf2c2497d2e6505e
|
||||
public CraftAttributeMap(AttributeMap handle) {
|
||||
this.handle = handle;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index e88364dfe067c605856390d2cce07ba320632df9..069666c797c39b5119e41a3c18727f89fcc3b8c5 100644
|
||||
index 0c385b713234a74ceba802f67f74e4ecab93e269..0464c7b6cc6cb523fa833c870e4028c3f599ea65 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -607,7 +607,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -613,7 +613,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
||||
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Prevent headless pistons from being created
|
||||
Prevent headless pistons from being created by explosions or tree/mushroom growth.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 30109db978563fab1a33b450f0ca82e176539703..d29b4268431472c6132efdfcd305e9616c57da21 100644
|
||||
index 0f02361110143c839fde6ada38e9e0b512aef978..414297ab9e953049b5f0b091e54d37c6e9edf861 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -206,6 +206,15 @@ public class Explosion {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index bf3785e3b347ebc1ce1e044c9db1a9d23c80f880..1fe34b2b160569b41ce87910eff56d590731e708 100644
|
||||
index 91f342912372326a6ced16c23550da7727d6d3ad..b4cb9ff5553995dddfb99b6b3ac1250b92a65d9d 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -501,7 +501,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
@ -21,10 +21,10 @@ index c8e4e37b706bd8cb9698ac2d13d0d8668e2d1d14..909575a02bf5f7040eb9c8edb034e7b6
|
||||
+ // Paper end - Expose entity id counter
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 13568d93bf9c0243a9505d1c0aa36fb912bf2bb7..b338b83d333b420c54c0362e2fc9839332fcc32e 100644
|
||||
index 54e5d76e5ec40912a5c09123d879cd5bef8da4b1..9b199fffb86cb04b9ad0013316a911ccf59d4051 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -526,6 +526,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -525,6 +525,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
|
||||
return compound;
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ manually reload the advancement data for all players, which
|
||||
normally takes place as a part of the datapack reloading.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index b338b83d333b420c54c0362e2fc9839332fcc32e..07befa14f64c5ae097378023a5b352278df2731a 100644
|
||||
index 9b199fffb86cb04b9ad0013316a911ccf59d4051..a5e9000034444fb36864020453acb0b183272922 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -332,7 +332,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Beacon API - custom effect ranges
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index 18450017bc3df2f0b1a5715e6021e8e5defa24a1..cdb6b89ad4c34be419f66f4f6e6a11068273765d 100644
|
||||
index cf48d4531821c2b1b031a63c8f007aa7d3fbef1d..dc39e7e3d166b0f7fb09e04b222b8db00d42b11b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -86,6 +86,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Expose LivingEntity hurt direction
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 8fe41d4291736fd8c45d73429062a597d54ac30b..ecae1708feee507df1440ad2822e7af8c3c278de 100644
|
||||
index f07c2bd727a8e3e65bb2e6b1367a4bb392febe23..47ace2c3f395a86db3aa67d597686c8275a91323 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -187,7 +187,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -67,10 +67,10 @@ index 1460060f2ff42ebaa7b2418b375ce661c73bd17f..b9180b7552796331d09c3aef1e863a25
|
||||
// Check if a World already exists with the UID.
|
||||
if (this.getWorld(world.getUID()) != null) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 07befa14f64c5ae097378023a5b352278df2731a..c0592a85a1a0781b83232533b9ca1b30b116eb98 100644
|
||||
index a5e9000034444fb36864020453acb0b183272922..a847717c0da236ee9743773eed3f2a3f1a8b10a6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -537,6 +537,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -536,6 +536,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public int nextEntityId() {
|
||||
return net.minecraft.world.entity.Entity.nextEntityId();
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index c0592a85a1a0781b83232533b9ca1b30b116eb98..d11d0a9a2c6b13033437a22b7270e7d37bfe8046 100644
|
||||
index a847717c0da236ee9743773eed3f2a3f1a8b10a6..dd28ead9b0d7cea53e7cf952ec1e2ca594efe0bb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -542,6 +542,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -541,6 +541,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public String getMainLevelName() {
|
||||
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerDeepSleepEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index ecae1708feee507df1440ad2822e7af8c3c278de..1f4351c1701465a3b5dfcb8d61aa5035956bbd42 100644
|
||||
index 47ace2c3f395a86db3aa67d597686c8275a91323..bed2f9903378c16d630a08156f5c39047b613ad4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -260,6 +260,13 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerBedFailEnterEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
index 68326d7c3bd14e5a66971f34e6ec8ec8e93b728a..03035ed3df2f32e14a8eb9bc3d536ef64b5d87ba 100644
|
||||
index 28689e333bb2ddb3c22e793b5c3d379233034840..c353643a9c9b400d351ef49e1b7d4f516ed0b0eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
|
||||
@@ -118,14 +118,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Introduce beacon activation/deactivation events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
index cdb6b89ad4c34be419f66f4f6e6a11068273765d..00ce8c45d906d8a468d93f464638f367d77e40fb 100644
|
||||
index dc39e7e3d166b0f7fb09e04b222b8db00d42b11b..a11f487197274da7cf3217f24e1cae2a343a7331 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||
@@ -225,6 +225,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
|
@ -5,10 +5,10 @@ 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 d11d0a9a2c6b13033437a22b7270e7d37bfe8046..c2a7801ee4f6642813778f5e8ae89db46a253a3d 100644
|
||||
index dd28ead9b0d7cea53e7cf952ec1e2ca594efe0bb..18d46779f56f97aae264325a5202568d8a06a747 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -547,6 +547,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -546,6 +546,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public int getProtocolVersion() {
|
||||
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fix item default attributes API
|
||||
(previously added this API but upstream also added it)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index c2a7801ee4f6642813778f5e8ae89db46a253a3d..61686e63b2d1a98b9747e11058f450a51e2d4d01 100644
|
||||
index 18d46779f56f97aae264325a5202568d8a06a747..abc5f221e90fb39fe2fa192bcbd0a3bb75444d64 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -396,9 +396,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -395,9 +395,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@Override
|
||||
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {
|
||||
|
@ -44,7 +44,7 @@ index ef24112c5360ec329dc8a89546f64bad68d7fd8e..1ac19a789bee22fe512a019e618e2b99
|
||||
|
||||
this.awardStat(Stats.DROP);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 1f4351c1701465a3b5dfcb8d61aa5035956bbd42..44e2a0f36359ab914c9328b633dd8a360591751d 100644
|
||||
index bed2f9903378c16d630a08156f5c39047b613ad4..40fb59c799850915c3ae71a4c4121e664c79d9b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -726,6 +726,11 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -17,7 +17,7 @@ index 1ac19a789bee22fe512a019e618e2b99bb07f183..d3f3eed67557b362c0f51a83967f6027
|
||||
public boolean isRealPlayer; // Paper
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 0273998b72c9d8a1e7de4b1195c547001922cb8e..802ea97fe03028cfe911aa4052d9c82ad23058f2 100644
|
||||
index dde1d3850af610241e1f76a194efe1a58dc96bd5..8ac5d8ccf731100a1be690cb2ed1be82cadba8ed 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -109,6 +109,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
@ -167,7 +167,7 @@ index 2b7ad2b9cd525814c9f91d22606c42aa82ce9f94..d7bbdcc97745246718c92c9aba56d9f9
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
index e18726915d1491d74084827afd9978800aecb644..a4a90df0b500fb440226b07462faaa87594b12a5 100644
|
||||
index 3cfe325f14b6b184517de7c6982f54e0895b1eb8..be85535767bc79875c38da78a209d33d4be87c8a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
|
||||
@@ -89,9 +89,14 @@ public class RespawnAnchorBlock extends Block {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityDamageItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 1fe34b2b160569b41ce87910eff56d590731e708..f5547caeaeeb8fa37f2aa9bfea6f176b1cc3430a 100644
|
||||
index b4cb9ff5553995dddfb99b6b3ac1250b92a65d9d..2947a43a1d9e49273ed0242691273e50c657cd05 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -647,7 +647,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
@ -9,7 +9,7 @@ public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations toBukkitSlo
|
||||
public org.bukkit.craftbukkit.scoreboard.CraftScoreboardTranslations fromBukkitSlot(Lorg/bukkit/scoreboard/DisplaySlot;)Lnet/minecraft/world/scores/DisplaySlot;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
index 658f3962543a36bc8c16f306ccb3e254b5b3d0a8..a1510dfd4824c0e246543d770f0e74f0f97c4ace 100644
|
||||
index 9e1896199d10be606a6c6304d849c7c9eb3c9fa1..b8a5ff5702f5a504c5b3aa0d9c27eb15f99471b7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/FieldRename.java
|
||||
@@ -27,6 +27,7 @@ public class FieldRename {
|
||||
|
@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 61686e63b2d1a98b9747e11058f450a51e2d4d01..5f460ab55025ff5dd66d7e52f92b4e7f36f2bb3f 100644
|
||||
index abc5f221e90fb39fe2fa192bcbd0a3bb75444d64..29661c484414e98c036045459dedf675aa661d85 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -560,6 +560,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -559,6 +559,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add critical damage API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
index 435490f2931dae9d4fc5adb713c47a962684eeb5..ec52c7a75d9988475fbb4fe12ef7f4489ef3d894 100644
|
||||
index 70e946483f09195c82d4b306c487ba22a8f8cf6f..ffb7c966617bdfa2c3f05ec4e753e32996493343 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -238,4 +238,18 @@ public class DamageSource {
|
||||
@@ -240,4 +240,18 @@ public class DamageSource {
|
||||
public Holder<DamageType> typeHolder() {
|
||||
return this.type;
|
||||
}
|
||||
@ -28,7 +28,7 @@ index 435490f2931dae9d4fc5adb713c47a962684eeb5..ec52c7a75d9988475fbb4fe12ef7f448
|
||||
+ // Paper end - add critical damage API
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 44e2a0f36359ab914c9328b633dd8a360591751d..c3fc0adeafbebaaaab8c155df9829f488e41d8ab 100644
|
||||
index 40fb59c799850915c3ae71a4c4121e664c79d9b2..7cb10e9c8ba6d100f1ae4d949401cd83034f0f14 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1274,7 +1274,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -39,10 +39,10 @@ index 1002123cd0c6f57cecc4e80f5f21cc6ff5886d37..e96023b71845526383288917e8d7c575
|
||||
+ // 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 5f460ab55025ff5dd66d7e52f92b4e7f36f2bb3f..f0cbe0ae5123bebce82aa677f196f7e8e096dfc9 100644
|
||||
index 29661c484414e98c036045459dedf675aa661d85..03ac06c4bd89e6da2272c3ff109a1b2d3454efd2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -572,6 +572,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -571,6 +571,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
||||
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0c
|
||||
@Override
|
||||
public boolean isInvisible() { // Paper - moved up from LivingEntity
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index f0cbe0ae5123bebce82aa677f196f7e8e096dfc9..365f7846d4c522811cf992ea1a2da67b025661b9 100644
|
||||
index 03ac06c4bd89e6da2272c3ff109a1b2d3454efd2..64327d5dd0e1ec3f5ad411ee692923a340d6174f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -510,7 +510,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
@@ -509,7 +509,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ index 22f9b40e2c9a71f8944b1738e91ee2e189a77cec..c3e8efd58c191ac8f479f8a979e73cc3
|
||||
@Override
|
||||
public void doCloseContainer() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index c3fc0adeafbebaaaab8c155df9829f488e41d8ab..4003dfeae8b2486045a3dbe4c1adc65a882e70ba 100644
|
||||
index 7cb10e9c8ba6d100f1ae4d949401cd83034f0f14..f861a942807f8b8af36d6b70a124da7853eda053 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -509,6 +509,11 @@ public abstract class Player extends LivingEntity {
|
||||
|
@ -13,10 +13,10 @@ the material type of the block at that location.
|
||||
public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index 90b218ebc947a1d8a8c7dfc677fe145b6386654a..df945a152747bea0452ec18c09d59598903aa91f 100644
|
||||
index d22cc83725cee3df20bb6f99de23aceb62923eef..978125c69b2a9ea465595c7eef10a1aea7ccf26c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -350,7 +350,7 @@ public abstract class BlockEntity {
|
||||
@@ -361,7 +361,7 @@ public abstract class BlockEntity {
|
||||
// Paper end
|
||||
if (this.level == null) return null;
|
||||
org.bukkit.block.Block block = this.level.getWorld().getBlockAt(this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ());
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Validate usernames
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index b968026728b8b4e549eed9fa9b43919c6c19eb7a..c44a15fc358c28345302b1bf37fc4b111a77fe0e 100644
|
||||
index b968026728b8b4e549eed9fa9b43919c6c19eb7a..9bcded0466f3b10fafd709edc44c60f85cb48b7f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -83,6 +83,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@ -16,12 +16,18 @@ index b968026728b8b4e549eed9fa9b43919c6c19eb7a..c44a15fc358c28345302b1bf37fc4b11
|
||||
|
||||
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) {
|
||||
this.state = ServerLoginPacketListenerImpl.State.HELLO;
|
||||
@@ -164,7 +165,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -164,7 +165,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@Override
|
||||
public void handleHello(ServerboundHelloPacket packet) {
|
||||
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
||||
- Validate.validState(StringUtil.isValidPlayerName(packet.name()), "Invalid characters in username", new Object[0]);
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) Validate.validState(StringUtil.isValidPlayerName(packet.name()), "Invalid characters in username", new Object[0]); // Paper - config username validation
|
||||
+ // Paper start - Validate usernames
|
||||
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
+ && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
|
||||
+ && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
|
||||
+ Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", new Object[0]);
|
||||
+ }
|
||||
+ // Paper end - Validate usernames
|
||||
this.requestedUsername = packet.name();
|
||||
GameProfile gameprofile = this.server.getSingleplayerProfile();
|
||||
|
||||
@ -39,22 +45,21 @@ index d7bbdcc97745246718c92c9aba56d9f926897975..7406784899ba5f3575adf1ffe5e5d85a
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/StringUtil.java b/src/main/java/net/minecraft/util/StringUtil.java
|
||||
index d3fc549a08993376c76c4ebebb788fea3f4ddf69..ae7ef47446c15b8a6878dd2d31b60cd0670eaf83 100644
|
||||
index d3fc549a08993376c76c4ebebb788fea3f4ddf69..0bd191acb9596d3aa21c337230d26f09d26f6888 100644
|
||||
--- a/src/main/java/net/minecraft/util/StringUtil.java
|
||||
+++ b/src/main/java/net/minecraft/util/StringUtil.java
|
||||
@@ -64,7 +64,23 @@ public class StringUtil {
|
||||
@@ -67,6 +67,25 @@ public class StringUtil {
|
||||
return name.length() <= 16 && name.chars().filter(c -> c <= 32 || c >= 127).findAny().isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isValidPlayerName(String name) {
|
||||
- return name.length() <= 16 && name.chars().filter(c -> c <= 32 || c >= 127).findAny().isEmpty();
|
||||
+ // Paper start - username validation overriding
|
||||
+ if (name == null || name.isEmpty() || name.length() > 16) {
|
||||
+ // Paper start - Username validation
|
||||
+ public static boolean isReasonablePlayerName(final String name) {
|
||||
+ if (name.isEmpty() || name.length() > 16) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0, len = name.length(); i < len; ++i) {
|
||||
+ char c = name.charAt(i);
|
||||
+
|
||||
+ final char c = name.charAt(i);
|
||||
+ if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (c == '_' || c == '.')) {
|
||||
+ continue;
|
||||
+ }
|
||||
@ -63,7 +68,9 @@ index d3fc549a08993376c76c4ebebb788fea3f4ddf69..ae7ef47446c15b8a6878dd2d31b60cd0
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ // Paper end - username validation overriding
|
||||
}
|
||||
|
||||
+ }
|
||||
+ // Paper end - Username validation
|
||||
+
|
||||
public static String filterText(String string) {
|
||||
return filterText(string, false);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ snow bucket didn't revert grass that became snowy because of the
|
||||
placement.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index f5547caeaeeb8fa37f2aa9bfea6f176b1cc3430a..2f60e67de38bb4b39deb505f23e35aeff9eded73 100644
|
||||
index 2947a43a1d9e49273ed0242691273e50c657cd05..51a7919b019f2fd5d2e2ab850ed512769b0b1685 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -401,7 +401,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Expand PlayerItemDamageEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 2f60e67de38bb4b39deb505f23e35aeff9eded73..0a883564b9dda4fa0e6a7174a6e46b98af8be3e6 100644
|
||||
index 51a7919b019f2fd5d2e2ab850ed512769b0b1685..acce1b72185d4687ef5a72dd4014d87149f4b092 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -661,10 +661,11 @@ public final class ItemStack implements DataComponentHolder {
|
||||
|
@ -5,15 +5,15 @@ Subject: [PATCH] Sanitize sent BlockEntity NBT
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||
index 1970c0fa24764f6bbd0cc360b7d32d7906eaf808..db03254682b827d650160d6f2c1a18cf12c861d7 100644
|
||||
index 4f3ba61f13dbe5773034a19e749b7c4f5dc3d291..5d3e739d28d394ed59fe0003245cc55ac62e6087 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||
@@ -23,7 +23,7 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
|
||||
public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity, BiFunction<BlockEntity, RegistryAccess, CompoundTag> nbtGetter) {
|
||||
RegistryAccess iregistrycustom = blockEntity.getLevel().registryAccess();
|
||||
@@ -29,7 +29,7 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
|
||||
|
||||
- return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), (CompoundTag) nbtGetter.apply(blockEntity, iregistrycustom));
|
||||
+ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), (CompoundTag) blockEntity.sanitizeSentNbt(nbtGetter.apply(blockEntity, iregistrycustom))); // Paper - Sanitize sent data
|
||||
public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity, BiFunction<BlockEntity, RegistryAccess, CompoundTag> nbtGetter) {
|
||||
RegistryAccess registryAccess = blockEntity.getLevel().registryAccess();
|
||||
- return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), nbtGetter.apply(blockEntity, registryAccess));
|
||||
+ return new ClientboundBlockEntityDataPacket(blockEntity.getBlockPos(), blockEntity.getType(), blockEntity.sanitizeSentNbt(nbtGetter.apply(blockEntity, registryAccess))); // Paper - Sanitize sent data
|
||||
}
|
||||
|
||||
public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) {
|
||||
@ -30,10 +30,10 @@ index ac900dfdc5c90e9e60d47efa734be8f0a5b20dca..ec1cb034d840633240f2b379b09f7d2f
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index df945a152747bea0452ec18c09d59598903aa91f..a7dfad2696e7145af1355a5db132af14d09a6f30 100644
|
||||
index 978125c69b2a9ea465595c7eef10a1aea7ccf26c..30a75492a4b25450c194b4cc44deb665711db5af 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -357,6 +357,14 @@ public abstract class BlockEntity {
|
||||
@@ -368,6 +368,14 @@ public abstract class BlockEntity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Nameable Banner API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
|
||||
index 2656e06ab2269141a13011eaa906f601887ca3e2..26d2f63d2add276a2f51c399f494a7219413d3e3 100644
|
||||
index 925608bfa9c848ed6285de5e35d60aa66e12004a..60c26076e7acf869fa0e20fdc14eeec341387d99 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerBlockEntity.java
|
||||
@@ -29,7 +29,7 @@ public class BannerBlockEntity extends BlockEntity implements Nameable {
|
||||
|
@ -8,10 +8,10 @@ in command blocks, and if called asynchronously, would throw
|
||||
an error
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
index e40069d937de5fd00741ae6873abeecc46b93732..552f7ab11dc09fa69034f009235cb22429a9ed11 100644
|
||||
index 8c2dcc4134d96351cee75773214f3f47e71533e9..e6bfcc50cdf728216084bc00a5bb8b6b3b8f72e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
||||
@@ -177,6 +177,7 @@ public abstract class BaseCommandBlock implements CommandSource {
|
||||
@@ -178,6 +178,7 @@ public abstract class BaseCommandBlock implements CommandSource {
|
||||
@Override
|
||||
public void sendSystemMessage(Component message) {
|
||||
if (this.trackOutput) {
|
||||
|
@ -134,7 +134,7 @@ index 784788d8d3d1a07efbd406b6c463e046699081e2..fdff82ed5dbf5176d470b9b6c41acfe6
|
||||
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index c44a15fc358c28345302b1bf37fc4b111a77fe0e..3333cb70744dc7ef8b181d332b63766aaaaad11f 100644
|
||||
index 9bcded0466f3b10fafd709edc44c60f85cb48b7f..cb006ae0e5be2f1d31261bdd36964229ec44416d 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -84,6 +84,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@ -145,7 +145,7 @@ index c44a15fc358c28345302b1bf37fc4b111a77fe0e..3333cb70744dc7ef8b181d332b63766a
|
||||
|
||||
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) {
|
||||
this.state = ServerLoginPacketListenerImpl.State.HELLO;
|
||||
@@ -176,6 +177,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -182,6 +183,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
this.state = ServerLoginPacketListenerImpl.State.KEY;
|
||||
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true));
|
||||
} else {
|
||||
@ -162,7 +162,7 @@ index c44a15fc358c28345302b1bf37fc4b111a77fe0e..3333cb70744dc7ef8b181d332b63766a
|
||||
// CraftBukkit start
|
||||
// Paper start - Cache authenticator threads
|
||||
authenticatorPool.execute(new Runnable() {
|
||||
@@ -328,6 +339,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -334,6 +345,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
|
||||
// CraftBukkit start
|
||||
private GameProfile callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { // Paper - Add more fields to AsyncPlayerPreLoginEvent
|
||||
@ -175,7 +175,7 @@ index c44a15fc358c28345302b1bf37fc4b111a77fe0e..3333cb70744dc7ef8b181d332b63766a
|
||||
String playerName = gameprofile.getName();
|
||||
java.net.InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
|
||||
java.util.UUID uniqueId = gameprofile.getId();
|
||||
@@ -373,6 +390,51 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
@@ -379,6 +396,51 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
|
||||
@Override
|
||||
public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket packet) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user