mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 10:08:35 +00:00
Compare commits
22 Commits
190be49a0e
...
1.20.6
Author | SHA1 | Date | |
---|---|---|---|
4d0f96a46b | |||
df19c176cc | |||
c5b33792e6 | |||
ae4eb94393 | |||
3b1b15af8d | |||
8a5cd403f3 | |||
a46abcece9 | |||
6a1a02da01 | |||
bf02d9cb8c | |||
32ba851514 | |||
ad933c7373 | |||
81c800b36a | |||
76583f75f4 | |||
c2a84d8bbe | |||
f032b42dff | |||
276b46e903 | |||
bae78ff7b9 | |||
b3603b3fc9 | |||
c52d9c138d | |||
0870033b8a | |||
6f4b9b1167 | |||
1e08d8b5bc |
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@ -14,13 +14,12 @@ pipeline {
|
|||||||
stage('paperclipJar') {
|
stage('paperclipJar') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
sh './gradlew createReobfPaperclipJar --no-daemon --refresh-dependencies'
|
sh './gradlew createMojmapBundlerJar --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
sh """
|
sh """
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
BRANCH=\$(echo "\${BRANCH_NAME}" | sed 's/\\//_/g')
|
BRANCH=\$(echo "\${BRANCH_NAME}" | sed 's/\\//_/g')
|
||||||
mv \${WORKSPACE}/build/libs/Scissors-paperclip-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH}-\${BUILD_NUMBER}.jar
|
mv \${WORKSPACE}/build/libs/Scissors-bundler-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH}-\${BUILD_NUMBER}.jar
|
||||||
rm \${WORKSPACE}/build/libs/Scissors-bundler-*.jar
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.20.4/)
|
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.20.6/)
|
||||||
|
|
||||||
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
|
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
|
||||||
Paper's own team has either refused to fix or would have.
|
Paper's own team has either refused to fix or would have.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
### [Scissors Download](https://ci.plex.us.org/job/Scissors)
|
### [Scissors Download](https://ci.plex.us.org/job/Scissors)
|
||||||
### [Scissors Javadoc](https://javadoc.scissors.gg/1.20.4)
|
### [Scissors Javadoc](https://javadoc.scissors.gg/1.20.6)
|
||||||
### [Scissors Announcements](https://totalfreedom.tf/forums/scissors-announcements.55)
|
### [Scissors Announcements](https://totalfreedom.tf/forums/scissors-announcements.55)
|
||||||
### [Scissors General Discussion](https://totalfreedom.tf/forums/scissors-discussion.56/)
|
### [Scissors General Discussion](https://totalfreedom.tf/forums/scissors-discussion.56/)
|
||||||
|
|
||||||
|
@ -8,5 +8,3 @@
|
|||||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||||
minecraft net.minecraft.network.chat.FormattedText
|
|
||||||
minecraft net.minecraft.network.chat.contents.TranslatableContents.java
|
|
@ -2,7 +2,7 @@ plugins {
|
|||||||
java
|
java
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||||
id("io.papermc.paperweight.patcher") version "1.5.13"
|
id("io.papermc.paperweight.patcher") version "1.7.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||||
@ -15,8 +15,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
remapper("net.fabricmc:tiny-remapper:0.8.11:fat")
|
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
|
||||||
decompiler("net.minecraftforge:forgeflower:2.0.629.1")
|
decompiler("org.vineflower:vineflower:1.10.1")
|
||||||
paperclip("io.papermc:paperclip:3.0.4-SNAPSHOT")
|
paperclip("io.papermc:paperclip:3.0.4-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ allprojects {
|
|||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(17))
|
languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ allprojects {
|
|||||||
subprojects {
|
subprojects {
|
||||||
tasks.withType<JavaCompile> {
|
tasks.withType<JavaCompile> {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release.set(17)
|
options.release.set(21)
|
||||||
}
|
}
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc> {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
@ -80,7 +80,6 @@ paperweight {
|
|||||||
|
|
||||||
tasks.generateDevelopmentBundle {
|
tasks.generateDevelopmentBundle {
|
||||||
apiCoordinates.set("me.totalfreedom.scissors:scissors-api")
|
apiCoordinates.set("me.totalfreedom.scissors:scissors-api")
|
||||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
|
||||||
libraryRepositories.set(
|
libraryRepositories.set(
|
||||||
listOf(
|
listOf(
|
||||||
"https://repo.maven.apache.org/maven2/",
|
"https://repo.maven.apache.org/maven2/",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
group=me.totalfreedom.scissors
|
group=me.totalfreedom.scissors
|
||||||
version=1.20.4-R0.1-SNAPSHOT
|
version=1.20.6-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion=1.20.4
|
mcVersion=1.20.6
|
||||||
paperRef=4445d23544e0801fb6f658de98815ce0d8c04f58
|
paperRef=e41d44fa873466064879ebed476d280932379a9c
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add Scissors configuration file
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 4ff1b38eb65f97344257204cf018f176f247ed36..be766fc9c24bedcc58dac2cb1991345bf5ed17e0 100644
|
index 30cbe3bdc7142769019765b03cc4fe1f9ba1ddb4..d1f5766f2b021df282b929457a27d09f7c21a21e 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2235,6 +2235,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -2257,6 +2257,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
|
@ -1,31 +1,25 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Dec 2023 12:34:45 -0600
|
Date: Fri, 14 Jun 2024 17:38:20 -0500
|
||||||
Subject: [PATCH] Build changes
|
Subject: [PATCH] Build changes
|
||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..855784d7f9c2993c5d91f67c9b8cc46fe6e4147e 100644
|
index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..b0e9bf22d546110d995b5625ce8ed22501992679 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||||
val alsoShade: Configuration by configurations.creating
|
val alsoShade: Configuration by configurations.creating
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
- implementation(project(":paper-api"))
|
- implementation(project(":paper-api"))
|
||||||
- implementation(project(":paper-mojangapi"))
|
+ implementation(project(":Scissors-API")) // Scissors
|
||||||
+ // Scissors start
|
|
||||||
+ implementation(project(":Scissors-API"))
|
|
||||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.4-R0.1-SNAPSHOT") {
|
|
||||||
+ exclude("io.papermc.paper", "paper-api")
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
// Paper start
|
// Paper start
|
||||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
@@ -67,11 +71,19 @@ tasks.jar {
|
@@ -77,17 +77,25 @@ tasks.jar {
|
||||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||||
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
|
||||||
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
||||||
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
@ -39,13 +33,22 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..855784d7f9c2993c5d91f67c9b8cc46f
|
|||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "CraftBukkit",
|
"Implementation-Title" to "Paper",
|
||||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
"Implementation-Version" to implementationVersion,
|
||||||
+ "Implementation-Version" to "git-Scissors-$implementationVersion", // Scissors
|
|
||||||
"Implementation-Vendor" to date, // Paper
|
"Implementation-Vendor" to date, // Paper
|
||||||
"Specification-Title" to "Bukkit",
|
- "Specification-Title" to "Paper",
|
||||||
|
+ "Specification-Title" to "Scissors",
|
||||||
"Specification-Version" to project.version,
|
"Specification-Version" to project.version,
|
||||||
@@ -150,7 +162,7 @@ fun TaskContainer.registerRunTask(
|
- "Specification-Vendor" to "Paper Team",
|
||||||
|
- "Brand-Id" to "papermc:paper",
|
||||||
|
- "Brand-Name" to "Paper",
|
||||||
|
+ "Specification-Vendor" to "Scissors Team",
|
||||||
|
+ "Brand-Id" to "scissorsmc:scissors",
|
||||||
|
+ "Brand-Name" to "Scissors",
|
||||||
|
"Build-Number" to (build ?: ""),
|
||||||
|
"Build-Time" to Instant.now().toString(),
|
||||||
|
"Git-Branch" to gitBranch, // Paper
|
||||||
|
@@ -144,7 +152,7 @@ fun TaskContainer.registerRunTask(
|
||||||
name: String,
|
name: String,
|
||||||
block: JavaExec.() -> Unit
|
block: JavaExec.() -> Unit
|
||||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||||
@ -55,7 +58,7 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..855784d7f9c2993c5d91f67c9b8cc46f
|
|||||||
standardInput = System.`in`
|
standardInput = System.`in`
|
||||||
workingDir = rootProject.layout.projectDirectory
|
workingDir = rootProject.layout.projectDirectory
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..a46d3f40642bbf249c2d24e689f474d07175ca09 100644
|
index 4b002e8b75d117b726b0de274a76d3596fce015b..5ff11b9bcef76cb767f0b03ffc326d3f7a361371 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
@@ -593,7 +593,7 @@ public class Metrics {
|
@@ -593,7 +593,7 @@ public class Metrics {
|
||||||
@ -63,7 +66,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..a46d3f40642bbf249c2d24e689f474d0
|
|||||||
// Only start Metrics, if it's enabled in the config
|
// Only start Metrics, if it's enabled in the config
|
||||||
if (config.getBoolean("enabled", true)) {
|
if (config.getBoolean("enabled", true)) {
|
||||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||||
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger()); // Scissors
|
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||||
|
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||||
String minecraftVersion = Bukkit.getVersion();
|
String minecraftVersion = Bukkit.getVersion();
|
||||||
@ -72,17 +75,17 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..a46d3f40642bbf249c2d24e689f474d0
|
|||||||
if (implVersion != null) {
|
if (implVersion != null) {
|
||||||
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
||||||
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
||||||
+ paperVersion = "git-Scissors-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Scissors
|
+ paperVersion = "git-Scissors-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
||||||
} else {
|
} else {
|
||||||
paperVersion = "unknown";
|
paperVersion = "unknown";
|
||||||
}
|
}
|
||||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
|
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
|
||||||
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> paperVersion)); // Scissors
|
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> paperVersion));
|
||||||
|
|
||||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||||
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..21ded7c14c56a40feaa7741131be5166947f7169 100644
|
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..2fbb5fc19e6d7f3767c7c6eedcbc6af2b0877ae5 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||||
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||||
@ -90,36 +93,10 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..21ded7c14c56a40feaa7741131be5166
|
|||||||
protected LineReader buildReader(LineReaderBuilder builder) {
|
protected LineReader buildReader(LineReaderBuilder builder) {
|
||||||
builder
|
builder
|
||||||
- .appName("Paper")
|
- .appName("Paper")
|
||||||
+ .appName("Scissors") // Scissors
|
+ .appName("Scissors")
|
||||||
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
||||||
.completer(new ConsoleCommandCompleter(this.server))
|
.completer(new ConsoleCommandCompleter(this.server))
|
||||||
.option(LineReader.Option.COMPLETE_IN_WORD, true);
|
.option(LineReader.Option.COMPLETE_IN_WORD, true);
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index c8772c773f9933ed1d1debfe707af4373c458152..05b0d82114aadbb713b7e5dad94ee0fe6221856a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
|
|
||||||
@DontObfuscate
|
|
||||||
public String getServerModName() {
|
|
||||||
- return "Paper"; // Paper
|
|
||||||
+ return "Scissors"; // Scissors
|
|
||||||
}
|
|
||||||
|
|
||||||
public SystemReport fillSystemReport(SystemReport details) {
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
||||||
index c490a29bcf7410bc54959ee71375605964379ed5..f192db9868129bd1ee45e2b29c0c7479af33ebe1 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
||||||
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
|
|
||||||
import javax.annotation.Nonnull; // Paper
|
|
||||||
|
|
||||||
public final class CraftServer implements Server {
|
|
||||||
- private final String serverName = "Paper"; // Paper
|
|
||||||
+ private final String serverName = "Scissors"; // Scissors > // Paper
|
|
||||||
private final String serverVersion;
|
|
||||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
|
||||||
private final Logger logger = Logger.getLogger("Minecraft");
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
index 774556a62eb240da42e84db4502e2ed43495be17..741c76c4dfa0bb34cc23bd795c194bdea10418cc 100644
|
index 774556a62eb240da42e84db4502e2ed43495be17..741c76c4dfa0bb34cc23bd795c194bdea10418cc 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
|
@ -1,24 +1,16 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Dec 2023 13:11:22 -0600
|
Date: Sun, 5 May 2024 12:16:30 -0500
|
||||||
Subject: [PATCH] UUID validation
|
Subject: [PATCH] UUID validation
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
index 9067bab8ec695417d479393f07d9bc6432427d73..433e586bed53a8c17adec74b3088899c748d4be3 100644
|
index 1a958f994365eb8f2e010d703046fb73e04b66e4..d8de9ec38f5e5b10c177895728815d8659d0b601 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
|
@@ -171,7 +171,14 @@ public class HoverEvent {
|
||||||
import net.minecraft.nbt.TagParser;
|
DynamicOps<JsonElement> dynamicOps = (DynamicOps<JsonElement>)(ops != null ? ops.withParent(JsonOps.INSTANCE) : JsonOps.INSTANCE);
|
||||||
import net.minecraft.resources.ResourceLocation;
|
DataResult<Component> dataResult = ComponentSerialization.CODEC.parse(dynamicOps, JsonParser.parseString(compoundTag.getString("name")));
|
||||||
import net.minecraft.util.ExtraCodecs;
|
|
||||||
+import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.util.StringRepresentable;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.item.Item;
|
|
||||||
@@ -148,7 +149,14 @@ public class HoverEvent {
|
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
||||||
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
|
||||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
||||||
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
@ -29,6 +21,6 @@ index 9067bab8ec695417d479393f07d9bc6432427d73..433e586bed53a8c17adec74b3088899c
|
|||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
|
return dataResult.map(textx -> new HoverEvent.EntityTooltipInfo(entityType, uUID, textx));
|
||||||
} catch (Exception var5) {
|
} catch (Exception var7) {
|
||||||
return DataResult.error(() -> "Failed to parse tooltip: " + var5.getMessage());
|
return DataResult.error(() -> "Failed to parse tooltip: " + var7.getMessage());
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 10 Dec 2023 16:57:48 -0600
|
|
||||||
Subject: [PATCH] Fixes log spam caused by invalid entities in beehives
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
|
||||||
index d445ed0895293dd45c36226051f5809be8587ebe..b9c8b70fb0bf47ffe62cf0d082156479d07da331 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
|
||||||
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.ListTag;
|
|
||||||
import net.minecraft.nbt.NbtUtils;
|
|
||||||
import net.minecraft.network.protocol.game.DebugPackets;
|
|
||||||
+import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.sounds.SoundEvents;
|
|
||||||
import net.minecraft.sounds.SoundSource;
|
|
||||||
import net.minecraft.tags.BlockTags;
|
|
||||||
@@ -380,6 +381,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
|
||||||
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
|
|
||||||
+
|
|
||||||
+ // Scissors start - Do not allow invalid entities from being used for bees
|
|
||||||
+ if (!nbttagcompound1.contains("id") || !ResourceLocation.isValidResourceLocation(nbttagcompound1.getString("id")) || EntityType.byString(nbttagcompound1.getString("id")).isEmpty()) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData").copy(), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
|
||||||
|
|
||||||
this.stored.add(tileentitybeehive_hivebee);
|
|
40
patches/server/0003-ResourceLocation-validation.patch
Normal file
40
patches/server/0003-ResourceLocation-validation.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Fri, 14 Jun 2024 17:48:49 -0500
|
||||||
|
Subject: [PATCH] ResourceLocation validation
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
index 8b612b772ca87c852d0b108c2afd6785c261c9b9..e063562fdbe05882c4a81f9fb15141056c35ed8b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
@@ -678,7 +678,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final ResourceKey<LootTable> getLootTable() {
|
||||||
|
- return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable;
|
||||||
|
+ try {
|
||||||
|
+ return this.lootTable == null ? this.getDefaultLootTable() : this.lootTable;
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return this.getDefaultLootTable();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ResourceKey<LootTable> getDefaultLootTable() {
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
||||||
|
index 1f90f4b3f310b8cf5750c3a581be178f19b979d2..0c6aad363f99bd86393335b9df1e186a3198274f 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java
|
||||||
|
@@ -38,7 +38,11 @@ public class CraftLootTable implements org.bukkit.loot.LootTable {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static org.bukkit.loot.LootTable minecraftToBukkit(ResourceKey<LootTable> minecraft) {
|
||||||
|
- return (minecraft == null || minecraft.location().getPath().isEmpty()) ? null : Bukkit.getLootTable(CraftLootTable.minecraftToBukkitKey(minecraft)); // Paper - fix some NamespacedKey parsing
|
||||||
|
+ try {
|
||||||
|
+ return (minecraft == null || minecraft.location().getPath().isEmpty()) ? null : Bukkit.getLootTable(CraftLootTable.minecraftToBukkitKey(minecraft)); // Paper - fix some NamespacedKey parsing
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NamespacedKey minecraftToBukkitKey(ResourceKey<LootTable> minecraft) {
|
45
patches/server/0004-Fixes-log-spam.patch
Normal file
45
patches/server/0004-Fixes-log-spam.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sun, 5 May 2024 12:31:13 -0500
|
||||||
|
Subject: [PATCH] Fixes log spam
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
index d8de9ec38f5e5b10c177895728815d8659d0b601..d141a39f98f58c5d61e25cab89e742845ca8185b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
@@ -271,7 +271,7 @@ public class HoverEvent {
|
||||||
|
DynamicOps<Tag> dynamicOps = (DynamicOps<Tag>)(ops != null ? ops.withParent(NbtOps.INSTANCE) : NbtOps.INSTANCE);
|
||||||
|
return ItemStack.CODEC.parse(dynamicOps, compoundTag).map(HoverEvent.ItemStackInfo::new);
|
||||||
|
} catch (CommandSyntaxException var4) {
|
||||||
|
- return DataResult.error(() -> "Failed to parse item tag: " + var4.getMessage());
|
||||||
|
+ return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
index ee972fa1a2bc023ed18eaceae21c8c8244754e6a..4f92d9c5850156c2349371d801a96a477f1af96c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
@@ -385,7 +385,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
||||||
|
|
||||||
|
if (nbt.contains("Particle", 10)) {
|
||||||
|
ParticleTypes.CODEC.parse(registryops, nbt.get("Particle")).resultOrPartial((s) -> {
|
||||||
|
- AreaEffectCloud.LOGGER.warn("Failed to parse area effect cloud particle options: '{}'", s);
|
||||||
|
+ // Scissors - Don't log custom particle errors
|
||||||
|
}).ifPresent(this::setParticle);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
index a46bf73c608641bf1f00fd55242de71a0f2ee06e..06a4a1cb9e46b3981629f1f8c4a0028c407ce234 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
@@ -603,7 +603,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
|
if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
|
||||||
|
entity.load(nbt);
|
||||||
|
}, () -> {
|
||||||
|
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||||
|
+ // Scissors - Don't log invalid entities
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -1,123 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Wed, 24 Jan 2024 16:28:16 -0600
|
|
||||||
Subject: [PATCH] ResourceLocation validation
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
|
||||||
index 15173e715fa36546820d930a46e0f0c493d07cfc..356cc6f468975faa676db87db8fc0fa2df32f020 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
|
||||||
@@ -17,7 +17,7 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.bukkit.loot.LootTable getLootTable() {
|
|
||||||
- return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
|
|
||||||
+ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() && entity.getLootTable().toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; // Scissors - Validate length of loot tables before even trying
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
|
||||||
index 2ee4ee14ab3345486dad6b24fd9a4fcc6c746b99..c5ac6cda91a81d3075f5c763e30dc009b6be7936 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
|
||||||
@@ -15,7 +15,7 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.bukkit.loot.LootTable getLootTable() {
|
|
||||||
- return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null;
|
|
||||||
+ return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() && tileEntityLootable.lootTable.toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; // Scissors - Validate length of loot tables before even trying
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
||||||
index 094ab43e5a209ea848bf0994db9018281c64e08d..c6faba7da6809e24d734b7d6b0b787d20163b051 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
||||||
@@ -410,7 +410,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
|
||||||
try {
|
|
||||||
this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle")), (HolderLookup) BuiltInRegistries.PARTICLE_TYPE.asLookup()));
|
|
||||||
} catch (CommandSyntaxException commandsyntaxexception) {
|
|
||||||
- AreaEffectCloud.LOGGER.warn("Couldn't load custom particle {}", nbt.getString("Particle"), commandsyntaxexception);
|
|
||||||
+ // Scissors - Don't log custom particle errors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
||||||
index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..cfb2ce684da0ae97a844554b5ad3d41290058f32 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
||||||
@@ -595,7 +595,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
|
||||||
if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
|
|
||||||
entity.load(nbt);
|
|
||||||
}, () -> {
|
|
||||||
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
|
||||||
+ // Scissors - Don't log invalid entities
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
|
||||||
index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd6492057e 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
|
||||||
@@ -34,8 +34,14 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
- ResourceLocation key = this.getSnapshot().lootTable;
|
|
||||||
- return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
|
||||||
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
||||||
+ try {
|
|
||||||
+ ResourceLocation key = this.getSnapshot().lootTable;
|
|
||||||
+ return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
||||||
index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..a115a13ec911884a804800fc13f0347be1a30932 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
||||||
@@ -33,8 +33,15 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
|
||||||
return null; // return empty loot table?
|
|
||||||
}
|
|
||||||
|
|
||||||
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
|
||||||
- return Bukkit.getLootTable(key);
|
|
||||||
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
||||||
+ try
|
|
||||||
+ {
|
|
||||||
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
|
||||||
+ return Bukkit.getLootTable(key);
|
|
||||||
+ } catch (Exception exception) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
index 31f62fbb54ec7b270fbd8afba7bd7c4bfafa09e3..684e69753be0398ebe57172454aba8cc45cf6502 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
@@ -80,8 +80,15 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LootTable getLootTable() {
|
|
||||||
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
|
||||||
- return Bukkit.getLootTable(key);
|
|
||||||
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
||||||
+ try
|
|
||||||
+ {
|
|
||||||
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
|
||||||
+ return Bukkit.getLootTable(key);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
@ -1,23 +1,27 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 13 Mar 2022 08:14:44 -0600
|
Date: Sun, 5 May 2024 12:32:55 -0500
|
||||||
Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
|
Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
|
||||||
with content in them
|
with content in them
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||||
index 756d0434472921992c9d84597d7c9c824e93614c..77e9e106c522712a484d01bf7e7434c380de3621 100644
|
index 9549eee0d92f322bd5232abd7e695213660c2e22..94a689e1adf24f6385dc97eb5cc3790c8e14da97 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||||
@@ -147,7 +147,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -142,8 +142,14 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
|
@Override
|
||||||
public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) {
|
- if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) {
|
||||||
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||||
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
+ if (!this.level().isClientSide && entity_removalreason.shouldDestroy())
|
||||||
|
+ {
|
||||||
|
+ // Scissors start - Ignore errors thrown when trying to remove Minecart entities with content in them
|
||||||
+ try {
|
+ try {
|
||||||
+ Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
+ Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||||
+ } catch (Exception ignored) {}
|
+ } catch (Exception ignored)
|
||||||
|
+ {}
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sun, 5 May 2024 12:47:29 -0500
|
||||||
|
Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
|
||||||
|
provided
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
|
index 635936aaac2426de05f0450f10815b29b52ca617..0b122b281c195ca47e7eeb27be29bffd916a8535 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
|
@@ -38,9 +38,9 @@ public class KnowledgeBookItem extends Item {
|
||||||
|
List<RecipeHolder<?>> list2 = new ArrayList<>(list.size());
|
||||||
|
|
||||||
|
for (ResourceLocation resourceLocation : list) {
|
||||||
|
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(resourceLocation);
|
||||||
|
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(resourceLocation.getNamespace())); // Scissors - Validate resource location
|
||||||
|
if (!optional.isPresent()) {
|
||||||
|
- LOGGER.error("Invalid recipe: {}", resourceLocation);
|
||||||
|
+ // Scissors - don't log errors caused by invalid recipes being provided
|
||||||
|
return InteractionResultHolder.fail(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
index 20638aa593e0a6c78e4bfdb936e69f3d36e18f4e..00b877fb43a8793a0f07580be93d026b624ad011 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
@@ -38,7 +38,12 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
||||||
|
for (int i = 0; i < pages.size(); i++) {
|
||||||
|
ResourceLocation recipe = pages.get(i);
|
||||||
|
|
||||||
|
- this.addRecipe(CraftNamespacedKey.fromMinecraft(recipe));
|
||||||
|
+ // Scissors start - Don't add recipes with invalid namespaces
|
||||||
|
+ try {
|
||||||
|
+ this.addRecipe(CraftNamespacedKey.fromMinecraft(recipe));
|
||||||
|
+ } catch (Exception ignored)
|
||||||
|
+ {}
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Sun, 13 Mar 2022 14:38:38 -0300
|
|
||||||
Subject: [PATCH] ItemEntity - Check if items are air before calling setItem
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
||||||
index c7f06c3cfb737bd17a706798bf9cf0e1af5f0cc0..4fd00227d035284688e641cb2c55a3214dcbaa38 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
||||||
@@ -445,11 +445,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
||||||
|
|
||||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
|
||||||
|
|
||||||
- this.setItem(ItemStack.of(nbttagcompound1));
|
|
||||||
- if (this.getItem().isEmpty()) {
|
|
||||||
- this.discard(null); // CraftBukkit - add Bukkit remove cause
|
|
||||||
+ // Scissors start
|
|
||||||
+ ItemStack item = ItemStack.of(nbttagcompound1);
|
|
||||||
+ if (item.isEmpty()) {
|
|
||||||
+ this.discard(null);
|
|
||||||
+ return;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ this.setItem(item);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Jul 2022 10:12:04 +0100
|
Date: Fri, 14 Jun 2024 17:56:03 -0500
|
||||||
Subject: [PATCH] Add Scissors configuration file & command
|
Subject: [PATCH] Add Scissors configuration file & command
|
||||||
|
|
||||||
|
|
||||||
@ -184,10 +184,10 @@ index 0000000000000000000000000000000000000000..797677d892d83cf54d9a60af1e277b67
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b025b3c52
|
index 0000000000000000000000000000000000000000..1ada5b7778f03815455cac1a4aad4411d0cae053
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
@@ -0,0 +1,225 @@
|
@@ -0,0 +1,224 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
@ -412,12 +412,11 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b
|
|||||||
+ return config.getString(path, config.getString(path));
|
+ return config.getString(path, config.getString(path));
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index bc391d27399d8c22e78735ca39aa8ab45efb6413..ce5d500ff4642e646a84c09dcff07375b9d80176 100644
|
index 244a19ecd0234fa1d7a6ecfea20751595688605d..fdc76373fd458884a45312c6edf2915a811910eb 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -130,6 +130,7 @@ public class Main {
|
@@ -133,6 +133,7 @@ public class Main {
|
||||||
// Paper start - load config files early for access below if needed
|
// Paper start - load config files early for access below if needed
|
||||||
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
|
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
|
||||||
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
|
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
|
||||||
@ -426,12 +425,12 @@ index bc391d27399d8c22e78735ca39aa8ab45efb6413..ce5d500ff4642e646a84c09dcff07375
|
|||||||
|
|
||||||
if (optionset.has("initSettings")) { // CraftBukkit
|
if (optionset.has("initSettings")) { // CraftBukkit
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index 68d268b6fff126e8645b6deec3fb549ea2286b77..5cb58e351d38b7214e2002bf608512024744f0ee 100644
|
index ad967cc2283f902c76e48a59d59cf0dbdacbb5e3..0342ea47cb313e28027cb76e632a4d5b1565fc8d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -234,6 +234,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
|
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // Paper - init PaperBrigadierProvider
|
|
||||||
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ try {
|
+ try {
|
||||||
@ -447,10 +446,10 @@ index 68d268b6fff126e8645b6deec3fb549ea2286b77..5cb58e351d38b7214e2002bf60851202
|
|||||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||||
this.setMotd(dedicatedserverproperties.motd);
|
this.setMotd(dedicatedserverproperties.motd);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d0898642f 100644
|
index 5db08432b6afd3639688830e717f40ceaf599248..f2497d08157d3007d20be7ab333ab7c4f282c414 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1053,6 +1053,7 @@ public final class CraftServer implements Server {
|
@@ -1055,6 +1055,7 @@ public final class CraftServer implements Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||||
@ -458,7 +457,7 @@ index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d
|
|||||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||||
for (ServerLevel world : this.console.getAllLevels()) {
|
for (ServerLevel world : this.console.getAllLevels()) {
|
||||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
@@ -1084,6 +1085,7 @@ public final class CraftServer implements Server {
|
@@ -1087,6 +1088,7 @@ public final class CraftServer implements Server {
|
||||||
this.reloadData();
|
this.reloadData();
|
||||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||||
@ -466,7 +465,7 @@ index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d
|
|||||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||||
|
|
||||||
@@ -3028,6 +3030,14 @@ public final class CraftServer implements Server {
|
@@ -3053,6 +3055,14 @@ public final class CraftServer implements Server {
|
||||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,27 +481,26 @@ index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d
|
|||||||
public void restart() {
|
public void restart() {
|
||||||
org.spigotmc.RestartCommand.restart();
|
org.spigotmc.RestartCommand.restart();
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 8d626fadcd4743b6472a2954d2b1b2ec89669814..c0538206a53f0e6d9b54bddde0259b89ac73d675 100644
|
index b86ba59158964f73abd6622341a9acb98a33fa44..6101ff98022e7c1ad253edb112a0bf87b139e62b 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -181,6 +181,20 @@ public class Main {
|
@@ -169,6 +169,19 @@ public class Main {
|
||||||
.defaultsTo("Unknown Server")
|
.defaultsTo(new File("paper.yml"))
|
||||||
.describedAs("Name");
|
.describedAs("Yml file");
|
||||||
// Paper end
|
|
||||||
+
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ acceptsAll(asList("scissors-dir", "scissors-settings-directory"), "Directory for Scissors settings")
|
+ acceptsAll(asList("scissors-dir", "scissors-settings-directory"), "Directory for Scissors settings")
|
||||||
+ .withRequiredArg()
|
+ .withRequiredArg()
|
||||||
+ .ofType(File.class)
|
+ .ofType(File.class)
|
||||||
+ .defaultsTo(new File(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR))
|
+ .defaultsTo(new File(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR))
|
||||||
+ .describedAs("Config directory");
|
+ .describedAs("Config directory");
|
||||||
+
|
|
||||||
+ acceptsAll(asList("scissors", "scissors-settings"), "File for Scissors settings")
|
+ acceptsAll(asList("scissors", "scissors-settings"), "File for Scissors settings")
|
||||||
+ .withRequiredArg()
|
+ .withRequiredArg()
|
||||||
+ .ofType(File.class)
|
+ .ofType(File.class)
|
||||||
+ .defaultsTo(new File("scissors.yml"))
|
+ .defaultsTo(new File("scissors.yml"))
|
||||||
+ .describedAs("YAML file");
|
+ .describedAs("YAML file");
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
+
|
||||||
};
|
acceptsAll(asList("add-plugin", "add-extra-plugin-jar"), "Specify paths to extra plugin jars to be loaded in addition to those in the plugins folder. This argument can be specified multiple times, once for each extra plugin jar path.")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(File.class)
|
@ -1,49 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 13 Mar 2022 18:42:07 -0600
|
|
||||||
Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
|
|
||||||
provided
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
|
||||||
index 5ebc309aed545a4c22970e617519fe916a29fa3c..14a35465e41c9ecb51bea5b084e2637ebd21d295 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
|
||||||
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
|
|
||||||
|
|
||||||
for (int i = 0; i < listTag.size(); i++) {
|
|
||||||
String string = listTag.getString(i);
|
|
||||||
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string));
|
|
||||||
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
|
|
||||||
if (!optional.isPresent()) {
|
|
||||||
- LOGGER.error("Invalid recipe: {}", string);
|
|
||||||
+ // Scissors - Don't log errors caused by invalid recipes being provided
|
|
||||||
return InteractionResultHolder.fail(itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public class KnowledgeBookItem extends Item {
|
|
||||||
|
|
||||||
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
|
|
||||||
} else {
|
|
||||||
- LOGGER.error("Tag not valid: {}", compoundTag);
|
|
||||||
+ // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag.
|
|
||||||
return InteractionResultHolder.fail(itemStack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
|
||||||
index e904bf8b6a7d18a0e846c3b59e2d7f3d6e530e39..65b076b376bf6ab363a3eb62dfa2c96c45624957 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
|
||||||
@@ -41,7 +41,11 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
|
||||||
for (int i = 0; i < pages.size(); i++) {
|
|
||||||
String recipe = pages.getString(i);
|
|
||||||
|
|
||||||
- this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
|
||||||
+ // Scissors start - Don't add recipes with invalid namespaces
|
|
||||||
+ try {
|
|
||||||
+ this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
|
||||||
+ } catch (Exception ignored) {}
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +1,22 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 28 Mar 2022 16:49:17 -0600
|
Date: Wed, 8 May 2024 12:08:31 -0500
|
||||||
Subject: [PATCH] Reject oversized components from updating
|
Subject: [PATCH] Reject oversized components from updating
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51d1d5f868 100644
|
index 3365aed2b67ae0e4dd0410f5190ba474f146139b..5dea669ed5da073dcdfe4cbbf5521a622242563b 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
@@ -38,8 +38,9 @@ public class ComponentUtils {
|
@@ -1,6 +1,7 @@
|
||||||
|
package net.minecraft.network.chat;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
+import com.google.gson.JsonParser;
|
||||||
|
import com.mojang.brigadier.Message;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import com.mojang.datafixers.DataFixUtils;
|
||||||
|
@@ -38,8 +39,9 @@ public class ComponentUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
||||||
@ -19,14 +27,14 @@ index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51
|
|||||||
} else {
|
} else {
|
||||||
// Paper start - adventure; pass actual vanilla component
|
// Paper start - adventure; pass actual vanilla component
|
||||||
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
||||||
@@ -52,8 +53,9 @@ public class ComponentUtils {
|
@@ -52,8 +54,9 @@ public class ComponentUtils {
|
||||||
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||||
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth)); // Scissors
|
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||||
}
|
}
|
||||||
+ return Component.Serializer.toJson(result).length() > 65535 ? Component.empty() : result; // Scissors
|
+ return JsonParser.parseString(result.toString()).toString().length() > 65535 ? Component.empty() : result; // Scissors
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 13 Mar 2022 21:56:29 -0600
|
|
||||||
Subject: [PATCH] Validate BlockState and SoundEvent values
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
index fe4bea6af0d8734f3a5b972dce5f1e3914d6690e..0ee64be4288f59240beec26c470b78cc1aeac424 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
@@ -223,7 +223,7 @@ public final class NbtUtils {
|
|
||||||
return Blocks.AIR.defaultBlockState();
|
|
||||||
} else {
|
|
||||||
// Paper start - Validate resource location
|
|
||||||
- ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name"));
|
|
||||||
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState
|
|
||||||
Optional<? extends Holder<Block>> optional = resourceLocation != null ? blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation)) : Optional.empty();
|
|
||||||
// Paper end - Validate resource location
|
|
||||||
if (optional.isEmpty()) {
|
|
@ -1,49 +1,40 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 15 Apr 2024 22:36:13 -0500
|
Date: Wed, 8 May 2024 12:15:48 -0500
|
||||||
Subject: [PATCH] Better handling of invalid JSON components
|
Subject: [PATCH] Better handling of invalid JSON components
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
index e028353e0261310afc42ca0454b723d9f1ffc131..ed8810319db2ce754245193a62ea7a9a32ac13ec 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
@@ -675,12 +675,6 @@ public final class MCUtil {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
String string = compound.getString(key);
|
|
||||||
- try {
|
|
||||||
- return net.minecraft.network.chat.Component.Serializer.fromJson(string);
|
|
||||||
- } catch (com.google.gson.JsonParseException e) {
|
|
||||||
- org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage());
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- return null;
|
|
||||||
+ return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string); // Scissors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ae84d06564b2560e13404f6d89f88ad71dbc2cc6 100644
|
index 6dcade427f19771b08e04cfa036dedcfac30b5cd..3b075dcb6bda40b278296fc8750f2af90c13acc4 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
@@ -315,6 +315,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
@@ -23,6 +23,8 @@ import java.util.List;
|
||||||
return json == null ? null : Serializer.deserialize(json);
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.network.chat.contents.DataSource;
|
||||||
|
import net.minecraft.network.chat.contents.KeybindContents;
|
||||||
|
@@ -311,6 +313,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
return json == null ? null : Serializer.deserialize(json, registries);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ public static MutableComponent fromJsonSafe(String json) {
|
+ public static MutableComponent fromJsonSafe(String json, HolderLookup.Provider registries) {
|
||||||
+ try {
|
+ try {
|
||||||
+ return fromJson(json);
|
+ return fromJson(json, registries);
|
||||||
+ } catch (Exception ex) {
|
+ } catch (Exception ex) {
|
||||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ public static MutableComponent fromJsonSafe(JsonElement json) {
|
+ public static MutableComponent fromJsonSafe(JsonElement json, HolderLookup.Provider registries) {
|
||||||
+ try {
|
+ try {
|
||||||
+ return fromJson(json);
|
+ return fromJson(json, registries);
|
||||||
+ } catch (Exception ex) {
|
+ } catch (Exception ex) {
|
||||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||||
+ }
|
+ }
|
||||||
@ -51,31 +42,18 @@ index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ae84d06564b2560e13404f6d89f88ad7
|
|||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
@Nullable
|
@Nullable
|
||||||
public static MutableComponent fromJsonLenient(String json) {
|
public static MutableComponent fromJsonLenient(String json, HolderLookup.Provider registries) {
|
||||||
JsonReader jsonreader = new JsonReader(new StringReader(json));
|
JsonReader jsonreader = new JsonReader(new StringReader(json));
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
index a82b4e39c3160114aded3f33c85fad2e95065b72..e1f15ac481ab598e420ad79bcf289251d9f1c99a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
@@ -147,7 +147,7 @@ public class HoverEvent {
|
|
||||||
public static DataResult<HoverEvent.EntityTooltipInfo> legacyCreate(Component text) {
|
|
||||||
try {
|
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("name")); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
|
||||||
// Scissors start
|
|
||||||
UUID uUID;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
index c5673657ca6332147a5cbd2f4107fee13b9b7f47..3fec6f3e0adef6e2094157ef9040c7c6dc41a6c2 100644
|
index df26c39a2bb20e2021b50211dce905483a77f4e6..0b85d5aef65fdb08c1c11f0ebb973078b57e5773 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
@@ -124,10 +124,10 @@ public class NbtContents implements ComponentContents {
|
@@ -124,10 +124,10 @@ public class NbtContents implements ComponentContents {
|
||||||
);
|
);
|
||||||
return stream.flatMap(text -> {
|
return stream.flatMap(text -> {
|
||||||
try {
|
try {
|
||||||
- MutableComponent mutableComponent = Component.Serializer.fromJson(text);
|
- MutableComponent mutableComponent = Component.Serializer.fromJson(text, source.registryAccess());
|
||||||
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text); // Scissors
|
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text, source.registryAccess()); // Scissors
|
||||||
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
|
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
|
||||||
} catch (Exception var5x) {
|
} catch (Exception var5x) {
|
||||||
- LOGGER.warn("Failed to parse component: {}", text, var5x);
|
- LOGGER.warn("Failed to parse component: {}", text, var5x);
|
||||||
@ -84,58 +62,72 @@ index c5673657ca6332147a5cbd2f4107fee13b9b7f47..3fec6f3e0adef6e2094157ef9040c7c6
|
|||||||
}
|
}
|
||||||
}).reduce((accumulator, current) -> accumulator.append(component).append(current)).orElseGet(Component::empty);
|
}).reduce((accumulator, current) -> accumulator.append(component).append(current)).orElseGet(Component::empty);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 637478fd8a284e6833cf8f5fa17ccf9d73d1dd3f..2ecf2d8ff546ed097cb3b547db22d28a31d29ec4 100644
|
index 7ef9f67d27cc240191dd5d07e8dcf5fbdebe1049..6ee2d11e4f3fbc8424a2ffbe6a7ebd1832a25503 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -2545,11 +2545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -2602,12 +2602,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
this.setRot(this.getYRot(), this.getXRot());
|
||||||
if (nbt.contains("CustomName", 8)) {
|
if (nbt.contains("CustomName", 8)) {
|
||||||
String s = nbt.getString("CustomName");
|
String s = nbt.getString("CustomName");
|
||||||
|
-
|
||||||
- try {
|
- try {
|
||||||
- this.setCustomName(Component.Serializer.fromJson(s));
|
- this.setCustomName(Component.Serializer.fromJson(s, this.registryAccess()));
|
||||||
- } catch (Exception exception) {
|
- } catch (Exception exception) {
|
||||||
- Entity.LOGGER.warn("Failed to parse entity custom name {}", s, exception);
|
- Entity.LOGGER.warn("Failed to parse entity custom name {}", s, exception);
|
||||||
- }
|
- }
|
||||||
+ this.setCustomName(Component.Serializer.fromJsonSafe(s)); // Scissors - Use safer method for getting Components from JSON
|
+ this.setCustomName(Component.Serializer.fromJsonSafe(s, this.registryAccess())); // Scissors - Use safer method for getting Components from JSON
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible"));
|
this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible"));
|
||||||
|
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 c0563260277f9f4bd9ff08993b2efb4bca9a0c60..f3c296f2464620083e44c14cc99eca1add8f8d9b 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
|
||||||
|
@@ -362,7 +362,7 @@ public abstract class BlockEntity {
|
||||||
|
@Nullable
|
||||||
|
public static Component parseCustomNameSafe(String json, HolderLookup.Provider registryLookup) {
|
||||||
|
try {
|
||||||
|
- return Component.Serializer.fromJson(json, registryLookup);
|
||||||
|
+ return Component.Serializer.fromJsonSafe(json, registryLookup); // Scissors
|
||||||
|
} catch (Exception exception) {
|
||||||
|
BlockEntity.LOGGER.warn("Failed to parse custom name from string '{}', discarding", json, exception);
|
||||||
|
return null;
|
||||||
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
index 7eb1c28886741bdfe7985d16b6824f3e85ffae50..a6b7ff2e50c9700589428cc7d61b5ef9f9082ea8 100644
|
index b679bbdfa307d3aa9f2f5e4c70c559695b2733de..4c195b56b956b31028c4f51453d6e9bf31cada0c 100644
|
||||||
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
@@ -41,7 +41,7 @@ public class ScoreboardSaveData extends SavedData {
|
@@ -42,7 +42,7 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
CompoundTag compoundTag = nbt.getCompound(i);
|
CompoundTag compoundTag = nbt.getCompound(i);
|
||||||
String string = compoundTag.getString("Name");
|
String string = compoundTag.getString("Name");
|
||||||
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"), registries);
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName"), registries); // Scissors - Use safer method for getting Components from JSON
|
||||||
if (component != null) {
|
if (component != null) {
|
||||||
playerTeam.setDisplayName(component);
|
playerTeam.setDisplayName(component);
|
||||||
}
|
}
|
||||||
@@ -59,14 +59,14 @@ public class ScoreboardSaveData extends SavedData {
|
@@ -60,14 +60,14 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
||||||
- Component component2 = Component.Serializer.fromJson(compoundTag.getString("MemberNamePrefix"));
|
- Component component2 = Component.Serializer.fromJson(compoundTag.getString("MemberNamePrefix"), registries);
|
||||||
+ Component component2 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNamePrefix")); // Scissors - Use safer method for getting Components from JSON
|
+ Component component2 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNamePrefix"), registries); // Scissors - Use safer method for getting Components from JSON
|
||||||
if (component2 != null) {
|
if (component2 != null) {
|
||||||
playerTeam.setPlayerPrefix(component2);
|
playerTeam.setPlayerPrefix(component2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNameSuffix", 8)) {
|
if (compoundTag.contains("MemberNameSuffix", 8)) {
|
||||||
- Component component3 = Component.Serializer.fromJson(compoundTag.getString("MemberNameSuffix"));
|
- Component component3 = Component.Serializer.fromJson(compoundTag.getString("MemberNameSuffix"), registries);
|
||||||
+ Component component3 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNameSuffix")); // Scissors - Use safer method for getting Components from JSON
|
+ Component component3 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNameSuffix"), registries); // Scissors - Use safer method for getting Components from JSON
|
||||||
if (component3 != null) {
|
if (component3 != null) {
|
||||||
playerTeam.setPlayerSuffix(component3);
|
playerTeam.setPlayerSuffix(component3);
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ public class ScoreboardSaveData extends SavedData {
|
@@ -124,7 +124,7 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
return ObjectiveCriteria.DUMMY;
|
return ObjectiveCriteria.DUMMY;
|
||||||
});
|
});
|
||||||
String string2 = compoundTag.getString("Name");
|
String string2 = compoundTag.getString("Name");
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"), registries);
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName"), registries); // Scissors - Use safer method for getting Components from JSON
|
||||||
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
|
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
|
||||||
boolean bl = compoundTag.getBoolean("display_auto_update");
|
boolean bl = compoundTag.getBoolean("display_auto_update");
|
||||||
NumberFormat numberFormat = NumberFormatTypes.CODEC.parse(NbtOps.INSTANCE, compoundTag.get("format")).result().orElse(null);
|
NumberFormat numberFormat = NumberFormatTypes.CODEC
|
@ -1,32 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Mon, 15 Apr 2024 22:26:14 -0500
|
|
||||||
Subject: [PATCH] Do not log invalid items in HoverEvent and ItemFrame
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
index 433e586bed53a8c17adec74b3088899c748d4be3..a82b4e39c3160114aded3f33c85fad2e95065b72 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
@@ -261,7 +261,7 @@ public class HoverEvent {
|
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
||||||
return DataResult.success(new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag)));
|
|
||||||
} catch (CommandSyntaxException var2) {
|
|
||||||
- return DataResult.error(() -> "Failed to parse item tag: " + var2.getMessage());
|
|
||||||
+ return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
||||||
index c34701f95580e4cf45fe086115563127432a28c5..fc7547381a5dd7c0aae352c0cae72a980953b98f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
|
||||||
@@ -436,7 +436,7 @@ public class ItemFrame extends HangingEntity {
|
|
||||||
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
|
||||||
|
|
||||||
if (itemstack.isEmpty()) {
|
|
||||||
- ItemFrame.LOGGER.warn("Unable to load item from: {}", nbttagcompound1);
|
|
||||||
+ // Scissors - ignore invalid items
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack itemstack1 = this.getItem();
|
|
@ -0,0 +1,28 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Fri, 14 Jun 2024 18:00:35 -0500
|
||||||
|
Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
||||||
|
to CraftMetaItems
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
index b6cd6897844aa9c8b9a94e41c56c4cfe4ac78780..34130c2cc3f643fcfe32a02747c45dd1eba05396 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
@@ -57,6 +57,7 @@ import net.minecraft.nbt.NbtOps;
|
||||||
|
import net.minecraft.nbt.SnbtPrinterTagVisitor;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
+import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.util.Unit;
|
||||||
|
import net.minecraft.world.entity.EquipmentSlotGroup;
|
||||||
|
@@ -764,7 +765,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String attributeName = (String) obj;
|
||||||
|
- if (Strings.isNullOrEmpty(attributeName)) {
|
||||||
|
+ if (Strings.isNullOrEmpty(attributeName) || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<?> list = SerializableMeta.getObject(List.class, mods, attributeName, true);
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Dec 2023 17:39:52 -0600
|
Date: Wed, 8 May 2024 12:35:56 -0500
|
||||||
Subject: [PATCH] Don't query player data in the `nbt` component
|
Subject: [PATCH] Don't query player data in the `nbt` component
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
index 2750702cff35762bc817ffbe5bf81631e86bc49b..8714c3be77490a87aa6df0ff36a87557c6b99e25 100644
|
index 2750702cff35762bc817ffbe5bf81631e86bc49b..f69261dae717cbb3e7bc9f5e0767adc897f0388d 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
@@ -8,12 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
@@ -8,12 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
@ -20,7 +20,7 @@ index 2750702cff35762bc817ffbe5bf81631e86bc49b..8714c3be77490a87aa6df0ff36a87557
|
|||||||
import net.minecraft.commands.arguments.selector.EntitySelectorParser;
|
import net.minecraft.commands.arguments.selector.EntitySelectorParser;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
+import net.minecraft.world.entity.player.Player;
|
+import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
||||||
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec(
|
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec(
|
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Fri, 8 Apr 2022 23:38:12 -0300
|
Date: Wed, 8 May 2024 12:43:35 -0500
|
||||||
Subject: [PATCH] Limit string tag visitors to 1024 elements
|
Subject: [PATCH] Limit string tag visitors to 1024 elements
|
||||||
|
|
||||||
|
|
||||||
@ -95,10 +95,10 @@ index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f76951
|
|||||||
|
|
||||||
for (String string : list) {
|
for (String string : list) {
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
diff --git a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||||
index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006c15cee41 100644
|
index 6644359d68706b7c3af2f782c33f930387c221d7..b76cd0ff6f60d83da8754ef788bc0e669b8b4f9c 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||||
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||||
@@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -105,6 +105,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
Component component = Component.literal("B").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
Component component = Component.literal("B").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
||||||
byte[] bs = element.getAsByteArray();
|
byte[] bs = element.getAsByteArray();
|
||||||
@ -106,7 +106,7 @@ index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006
|
|||||||
|
|
||||||
for (int i = 0; i < bs.length; i++) {
|
for (int i = 0; i < bs.length; i++) {
|
||||||
MutableComponent mutableComponent2 = Component.literal(String.valueOf(bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
MutableComponent mutableComponent2 = Component.literal(String.valueOf(bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
||||||
@@ -115,6 +116,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -123,6 +124,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
||||||
int[] is = element.getAsIntArray();
|
int[] is = element.getAsIntArray();
|
||||||
@ -114,7 +114,7 @@ index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006
|
|||||||
|
|
||||||
for (int i = 0; i < is.length; i++) {
|
for (int i = 0; i < is.length; i++) {
|
||||||
mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER));
|
mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER));
|
||||||
@@ -132,6 +134,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -140,6 +142,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
||||||
long[] ls = element.getAsLongArray();
|
long[] ls = element.getAsLongArray();
|
||||||
@ -122,21 +122,21 @@ index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006
|
|||||||
|
|
||||||
for (int i = 0; i < ls.length; i++) {
|
for (int i = 0; i < ls.length; i++) {
|
||||||
Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
||||||
@@ -147,7 +150,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -155,7 +158,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitList(ListTag element) {
|
public void visitList(ListTag element) {
|
||||||
- if (element.isEmpty()) {
|
- if (element.isEmpty()) {
|
||||||
+ if (element.isEmpty() || element.size() > 1024) { // Scissors
|
+ if (element.isEmpty() || element.size() > 1024) { // Scissors
|
||||||
this.result = Component.literal("[]");
|
this.result = Component.literal("[]");
|
||||||
} else if (INLINE_ELEMENT_TYPES.contains(element.getElementType()) && element.size() <= 8) {
|
} else if (this.depth >= 64) {
|
||||||
String string = ELEMENT_SEPARATOR + " ";
|
this.result = Component.literal("[").append(TOO_DEEP).append("]");
|
||||||
@@ -190,7 +193,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
@@ -202,7 +205,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitCompound(CompoundTag compound) {
|
public void visitCompound(CompoundTag compound) {
|
||||||
- if (compound.isEmpty()) {
|
- if (compound.isEmpty()) {
|
||||||
+ if (compound.isEmpty() || compound.size() > 1024) { // Scissors
|
+ if (compound.isEmpty() || compound.size() > 1024) { // Scissors
|
||||||
this.result = Component.literal("{}");
|
this.result = Component.literal("{}");
|
||||||
} else {
|
} else if (this.depth >= 64) {
|
||||||
MutableComponent mutableComponent = Component.literal("{");
|
this.result = Component.literal("{").append(TOO_DEEP).append("}");
|
@ -1,180 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: ayunami2000 <spwilliamsiam@gmail.com>
|
|
||||||
Date: Thu, 25 Jan 2024 23:48:51 -0600
|
|
||||||
Subject: [PATCH] Block server-side chunkbans
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
@@ -7,8 +7,17 @@ import io.netty.handler.codec.MessageToByteEncoder;
|
|
||||||
import io.netty.util.Attribute;
|
|
||||||
import io.netty.util.AttributeKey;
|
|
||||||
import java.io.IOException;
|
|
||||||
+import java.util.Collections;
|
|
||||||
+
|
|
||||||
+import net.minecraft.ChatFormatting;
|
|
||||||
+import net.minecraft.core.NonNullList;
|
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
|
||||||
+import net.minecraft.network.chat.Component;
|
|
||||||
+import net.minecraft.network.chat.SignedMessageBody;
|
|
||||||
import net.minecraft.network.protocol.Packet;
|
|
||||||
+import net.minecraft.network.protocol.game.*;
|
|
||||||
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
|
||||||
+import net.minecraft.world.item.ItemStack;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
|
||||||
@@ -19,6 +28,23 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
|
||||||
this.codecKey = protocolKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ private int tryWrite(Packet packet, FriendlyByteBuf friendlyByteBuf, ChannelHandlerContext channelHandlerContext, int i) {
|
|
||||||
+ friendlyByteBuf.writeVarInt(i);
|
|
||||||
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
|
|
||||||
+
|
|
||||||
+ int j = friendlyByteBuf.writerIndex();
|
|
||||||
+ packet.write(friendlyByteBuf);
|
|
||||||
+ int k = friendlyByteBuf.writerIndex() - j;
|
|
||||||
+ int packetLength = friendlyByteBuf.readableBytes();
|
|
||||||
+ if (packetLength > MAX_PACKET_SIZE) {
|
|
||||||
+ throw new PacketTooLargeException(packet, this.codecKey, packetLength);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return k;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
|
|
||||||
Attribute<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey);
|
|
||||||
ConnectionProtocol.CodecData<?> codecData = attribute.get();
|
|
||||||
@@ -34,45 +60,58 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
|
||||||
throw new IOException("Can't serialize unregistered packet");
|
|
||||||
} else {
|
|
||||||
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
|
|
||||||
- friendlyByteBuf.writeVarInt(i);
|
|
||||||
- friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - adventure; set player's locale
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ int k;
|
|
||||||
try {
|
|
||||||
- int j = friendlyByteBuf.writerIndex();
|
|
||||||
- packet.write(friendlyByteBuf);
|
|
||||||
- int k = friendlyByteBuf.writerIndex() - j;
|
|
||||||
- if (false && k > 8388608) { // Paper - Handle large packets disconnecting client; disable
|
|
||||||
- throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
|
|
||||||
+ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
|
|
||||||
} catch (Throwable var13) {
|
|
||||||
- // Paper start - Give proper error message
|
|
||||||
- String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName());
|
|
||||||
- if (packetName.contains(".")) {
|
|
||||||
- packetName = packetName.substring(packetName.lastIndexOf(".") + 1);
|
|
||||||
+ packet = capPacket(packet, i);
|
|
||||||
+ if (packet == null) {
|
|
||||||
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
|
|
||||||
}
|
|
||||||
-
|
|
||||||
- LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13);
|
|
||||||
- // Paper end
|
|
||||||
- if (packet.isSkippable()) {
|
|
||||||
- throw new SkipPacketException(var13);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- throw var13;
|
|
||||||
- } finally {
|
|
||||||
- // Paper start - Handle large packets disconnecting client
|
|
||||||
- int packetLength = friendlyByteBuf.readableBytes();
|
|
||||||
- if (packetLength > MAX_PACKET_SIZE) {
|
|
||||||
- throw new PacketTooLargeException(packet, this.codecKey, packetLength);
|
|
||||||
- }
|
|
||||||
- // Paper end - Handle large packets disconnecting client
|
|
||||||
- ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
|
|
||||||
}
|
|
||||||
+ JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
|
|
||||||
+ ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ private static Packet capPacket(Packet packet, int i) {
|
|
||||||
+ if (packet instanceof ClientboundBlockEntityDataPacket blockEntityDataPacket) {
|
|
||||||
+ packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag());
|
|
||||||
+ } else if (packet instanceof ClientboundLevelChunkPacketData chunkPacket) {
|
|
||||||
+ chunkPacket.clearNBT();
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) {
|
|
||||||
+ packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY);
|
|
||||||
+ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) {
|
|
||||||
+ packet = new ClientboundSetEquipmentPacket(setEquipmentPacket.getEntity(), Collections.emptyList());
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket) {
|
|
||||||
+ packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY);
|
|
||||||
+ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) {
|
|
||||||
+ packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(), mapItemDataPacket.getScale(), mapItemDataPacket.isLocked(), null, null);
|
|
||||||
+ } else if (packet instanceof ClientboundPlayerChatPacket playerChatPacket) {
|
|
||||||
+ final SignedMessageBody.Packed body = playerChatPacket.body();
|
|
||||||
+ packet = new ClientboundPlayerChatPacket(playerChatPacket.sender(), // Not sending this packet results in a kick when someone says something.
|
|
||||||
+ playerChatPacket.index(),
|
|
||||||
+ playerChatPacket.signature(),
|
|
||||||
+ playerChatPacket.body(),
|
|
||||||
+ Component.empty().append("** Message too large **").withStyle(ChatFormatting.RED),
|
|
||||||
+ playerChatPacket.filterMask(),
|
|
||||||
+ playerChatPacket.chatType()
|
|
||||||
+ );
|
|
||||||
+ } else {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return packet;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start
|
|
||||||
private static int MAX_PACKET_SIZE = 8388608;
|
|
||||||
|
|
||||||
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 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f309df6a79e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
|
||||||
@@ -24,7 +24,7 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
|
|
||||||
return create(blockEntity, BlockEntity::getUpdateTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
- private ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) {
|
|
||||||
+ public ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) { // Scissors - private -> public
|
|
||||||
this.pos = pos;
|
|
||||||
this.type = blockEntityType;
|
|
||||||
this.tag = nbt.isEmpty() ? null : nbt;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
|
||||||
index 76bde683d193b37e563a67c1c7b9bdcf17d64524..185aa88ff28e6f3e3314abe19dff88609a47334e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
|
||||||
@@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData {
|
|
||||||
}
|
|
||||||
// Paper end - Handle oversized block entities in chunks
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ public void clearNBT() {
|
|
||||||
+ this.blockEntitiesData.clear();
|
|
||||||
+ this.extraPackets.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start - Anti-Xray - Add chunk packet info
|
|
||||||
@Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkPacketData(LevelChunk chunk) { this(chunk, null); }
|
|
||||||
public ClientboundLevelChunkPacketData(LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) {
|
|
||||||
@@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData {
|
|
||||||
int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
|
|
||||||
|
|
||||||
for (Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
|
||||||
+ if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size
|
|
||||||
// Paper start - Handle oversized block entities in chunks
|
|
||||||
if (++totalTileEntities > TE_LIMIT) {
|
|
||||||
var packet = entry2.getValue().getUpdatePacket();
|
|
@ -1,34 +1,34 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 11 Apr 2022 13:33:52 -0600
|
Date: Wed, 8 May 2024 12:46:29 -0500
|
||||||
Subject: [PATCH] Fixes creative-killing potion effects and certain potion
|
Subject: [PATCH] Fixes creative-killing potion effects and certain potion
|
||||||
effect overflows
|
effect overflows
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
diff --git a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
||||||
index 1c7794de5f0a7238b944c9473e2cc9d011ef2306..9c594c504611b9da5fcd119284b2dcb4b59d3bf4 100644
|
index b95afa9f6b7cf6c522ff5ec278adec7a9a851e9a..3f65f24936cdf3379e39bab3cd8bd46aacd95518 100644
|
||||||
--- a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
--- a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
||||||
+++ b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
+++ b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
||||||
@@ -16,6 +16,11 @@ class HealOrHarmMobEffect extends InstantenousMobEffect {
|
@@ -15,6 +15,10 @@ class HealOrHarmMobEffect extends InstantenousMobEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
||||||
super.applyEffectTick(entity, amplifier);
|
|
||||||
+ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't.
|
+ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't.
|
||||||
+ if (entity instanceof net.minecraft.world.entity.player.Player player && (player.isCreative() || player.isInvulnerable())) return;
|
+ if (entity instanceof net.minecraft.world.entity.player.Player player && (player.isCreative() || player.isInvulnerable())) return false;
|
||||||
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
|
||||||
if (this.isHarm == entity.isInvertedHealAndHarm()) {
|
if (this.isHarm == entity.isInvertedHealAndHarm()) {
|
||||||
entity.heal((float) Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
|
entity.heal((float) Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
|
||||||
} else {
|
} else {
|
||||||
@@ -27,6 +32,10 @@ class HealOrHarmMobEffect extends InstantenousMobEffect {
|
@@ -28,6 +32,11 @@ class HealOrHarmMobEffect extends InstantenousMobEffect {
|
||||||
@Override
|
|
||||||
public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) {
|
public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
+ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't.
|
+ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't.
|
||||||
+ if (target instanceof net.minecraft.world.entity.player.Player player && (player.isCreative() || player.isInvulnerable())) return;
|
+ if (target instanceof net.minecraft.world.entity.player.Player player && (player.isCreative() || player.isInvulnerable())) return;
|
||||||
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
|
+
|
||||||
if (this.isHarm == target.isInvertedHealAndHarm()) {
|
if (this.isHarm == target.isInvertedHealAndHarm()) {
|
||||||
j = (int) (proximity * (double) (4 << amplifier) + 0.5D);
|
j = (int) (proximity * (double) (4 << amplifier) + 0.5D);
|
||||||
|
target.heal((float) j, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sat, 24 Feb 2024 15:32:48 -0600
|
Date: Wed, 8 May 2024 12:48:19 -0500
|
||||||
Subject: [PATCH] Fix negative death times
|
Subject: [PATCH] Fix negative death times
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index e9bb7feb591032904516d1b9374f486d8a7d066c..60961c54e870148b5c649045e7347ca1064b6bde 100644
|
index 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..8ff815b1bb77eab735c65fa9c6bf469dca8562c4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -629,7 +629,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -650,7 +650,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
|
||||||
protected void tickDeath() {
|
protected void tickDeath() {
|
||||||
++this.deathTime;
|
++this.deathTime;
|
@ -1,28 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Wed, 30 Mar 2022 18:20:09 -0600
|
|
||||||
Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
|
||||||
to CraftMetaItems
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
||||||
index 5cd0fbac267f9c69c5de4c200a95860f5c56d42e..f2ccf2af05524be91eb0f4855cb8006dea2aede4 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
||||||
@@ -47,6 +47,7 @@ import net.minecraft.nbt.NbtIo;
|
|
||||||
import net.minecraft.nbt.StringTag;
|
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
+import net.minecraft.resources.ResourceLocation; // Scissors
|
|
||||||
import net.minecraft.world.item.BlockItem;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import org.apache.commons.lang3.EnumUtils;
|
|
||||||
@@ -488,7 +489,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
||||||
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
|
||||||
|
|
||||||
String attributeName = org.bukkit.craftbukkit.attribute.CraftAttributeMap.convertIfNeeded(entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
|
||||||
- if (attributeName == null || attributeName.isEmpty()) {
|
|
||||||
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Thu, 21 Apr 2022 13:52:32 +0100
|
Date: Wed, 8 May 2024 13:00:39 -0500
|
||||||
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
||||||
vehicles if they collide with more than 15 other entities
|
vehicles if they collide with more than 15 other entities
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b05463fc6f 100644
|
index 4d7454e5a64fc18e63793a221daa94617f17c666..0ebc9b469d684251ba73989b3f7483522faf48d7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
@@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair;
|
@@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
+import java.util.concurrent.TimeUnit; // Scissors
|
+import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.BlockUtil;
|
import net.minecraft.BlockUtil;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
@@ -104,6 +105,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
@@ -101,6 +102,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||||
private double flyingX = 0.95;
|
private double flyingX = 0.95;
|
||||||
private double flyingY = 0.95;
|
private double flyingY = 0.95;
|
||||||
private double flyingZ = 0.95;
|
private double flyingZ = 0.95;
|
||||||
@ -25,7 +25,7 @@ index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b0
|
|||||||
public double maxSpeed = 0.4D;
|
public double maxSpeed = 0.4D;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@@ -384,8 +386,8 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
@@ -381,8 +383,8 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||||
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
|
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
|
||||||
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||||
|
|
||||||
@ -36,11 +36,10 @@ index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b0
|
|||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
@@ -414,6 +416,14 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
@@ -411,6 +413,13 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||||
entity.push(this);
|
entity.push(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ // Scissors start - Add a collision debounce
|
+ // Scissors start - Add a collision debounce
|
||||||
+ if (list.size() > 15) {
|
+ if (list.size() > 15) {
|
||||||
+ this.discard(null);
|
+ this.discard(null);
|
||||||
@ -52,26 +51,27 @@ index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b0
|
|||||||
} else {
|
} else {
|
||||||
Iterator iterator1 = this.level().getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
|
Iterator iterator1 = this.level().getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
index db6aa75d642f4a7258f197933671907faf79c8f2..e4490494a865e129c69d7df3742f61860763a8d8 100644
|
index b068cff9b5aa457d65b679529956e8210296d799..8274154f2ce4a752ea49790c6526ecb353934a04 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
|
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.UnmodifiableIterator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
+import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.IntFunction;
|
import java.util.function.IntFunction;
|
||||||
+import java.util.concurrent.TimeUnit; // Scissors
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.BlockUtil;
|
import net.minecraft.BlockUtil;
|
||||||
import net.minecraft.core.BlockPos;
|
@@ -107,6 +108,8 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||||
@@ -108,6 +109,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
|
||||||
public double unoccupiedDeceleration = -1;
|
|
||||||
public boolean landBoats = false;
|
public boolean landBoats = false;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
|
||||||
|
|
||||||
|
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
||||||
|
+
|
||||||
public Boat(EntityType<? extends Boat> type, Level world) {
|
public Boat(EntityType<? extends Boat> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
@@ -408,9 +410,9 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
this.paddlePositions = new float[2];
|
||||||
|
@@ -401,9 +404,9 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||||
this.checkInsideBlocks();
|
this.checkInsideBlocks();
|
||||||
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||||
|
|
||||||
@ -83,11 +83,10 @@ index db6aa75d642f4a7258f197933671907faf79c8f2..e4490494a865e129c69d7df3742f6186
|
|||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
@@ -423,6 +425,14 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
@@ -416,6 +419,13 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ // Scissors start - Add collision debounce
|
+ // Scissors start - Add collision debounce
|
||||||
+ if (list.size() > 15) {
|
+ if (list.size() > 15) {
|
||||||
+ this.discard(null);
|
+ this.discard(null);
|
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sat, 11 Jun 2022 22:56:59 -0500
|
Date: Wed, 8 May 2024 13:01:45 -0500
|
||||||
Subject: [PATCH] Add custom classes used by Scissors
|
Subject: [PATCH] Add custom classes used by Scissors
|
||||||
|
|
||||||
|
|
||||||
@ -41,18 +41,19 @@ index 0000000000000000000000000000000000000000..754b578b575137a9c48cb20dee965a93
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/NbtUtility.java b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/NbtUtility.java b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..b3efac47ee700d5a7ff26452d6bcbf2f687a32cf
|
index 0000000000000000000000000000000000000000..9ad690056bffd9e85e469c5a54dffa3e1e13db5a
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
+++ b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||||
@@ -0,0 +1,75 @@
|
@@ -0,0 +1,76 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+import java.nio.charset.StandardCharsets;
|
|
||||||
+import javax.annotation.Nullable;
|
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
+import net.minecraft.nbt.CompoundTag;
|
||||||
+import net.minecraft.nbt.ListTag;
|
+import net.minecraft.nbt.ListTag;
|
||||||
+import net.minecraft.nbt.Tag;
|
+import net.minecraft.nbt.Tag;
|
||||||
+
|
+
|
||||||
|
+import javax.annotation.Nullable;
|
||||||
|
+import java.nio.charset.StandardCharsets;
|
||||||
|
+
|
||||||
+public class NbtUtility
|
+public class NbtUtility
|
||||||
+{
|
+{
|
||||||
+ public static final long MAXIMUM_SIZE = (256 * 1024);
|
+ public static final long MAXIMUM_SIZE = (256 * 1024);
|
@ -1,15 +1,15 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Tue, 17 May 2022 05:57:52 +0100
|
Date: Sat, 11 May 2024 12:24:26 -0500
|
||||||
Subject: [PATCH] Don't log invalid teams to console
|
Subject: [PATCH] Don't log invalid teams to console
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 60961c54e870148b5c649045e7347ca1064b6bde..0ce25857188029335d0afd0a9f0c22b79d4b0b69 100644
|
index 8ff815b1bb77eab735c65fa9c6bf469dca8562c4..8768ab338836569d53e0a70cc5f097b5a6d721ec 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -869,7 +869,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -901,7 +901,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
- LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
- LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
index eaad15a4d201356c34c1a09c7fbe5c35f76a2176..e166411e05287d97ea7c9d35b19d4ae3106401c3 100644
|
index bf2d91bbb4bf401696f5f5d14a67e3920a179084..e31102bb56fac4ffc1e114cc8ea2075af0f92e7f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
@@ -280,6 +280,13 @@ public abstract class HangingEntity extends Entity {
|
@@ -279,6 +279,13 @@ public abstract class HangingEntity extends Entity {
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Dec 2023 18:11:55 -0600
|
Date: Sat, 11 May 2024 12:31:03 -0500
|
||||||
Subject: [PATCH] Add MasterBlockFireEvent
|
Subject: [PATCH] Add MasterBlockFireEvent
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead72509dc67b8 100644
|
index ec1a8c60ccac50e5131f937c4262128fd2768331..385c73cc952caea21f6ebf5512fdf72bf121b953 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils;
|
@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils;
|
||||||
@ -15,8 +15,8 @@ index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead725
|
|||||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.core.component.DataComponents;
|
||||||
@@ -28,6 +29,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
@@ -27,6 +28,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
@ -24,14 +24,13 @@ index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead725
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
@@ -130,6 +132,14 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
@@ -128,6 +130,13 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors start - Add master block fire event
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
+ if (!event.callEvent())
|
+ if (!event.callEvent()) {
|
||||||
+ {
|
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
@ -40,7 +39,7 @@ index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead725
|
|||||||
executor.performCommand(world);
|
executor.performCommand(world);
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d5437f3929dd 100644
|
index 922592f2073eaea8ca361a3a1efcda8b18bea21c..7fec97a00f271eca29beca0ec0862de4036dd546 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block.entity;
|
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block.entity;
|
||||||
@ -51,8 +50,8 @@ index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d543
|
|||||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.HolderLookup;
|
||||||
@@ -17,6 +19,7 @@ import net.minecraft.world.level.block.JigsawBlock;
|
@@ -18,6 +20,7 @@ import net.minecraft.world.level.block.JigsawBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement;
|
import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement;
|
||||||
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
||||||
@ -60,16 +59,14 @@ index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d543
|
|||||||
|
|
||||||
public class JigsawBlockEntity extends BlockEntity {
|
public class JigsawBlockEntity extends BlockEntity {
|
||||||
public static final String TARGET = "target";
|
public static final String TARGET = "target";
|
||||||
@@ -134,6 +137,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
@@ -135,6 +138,14 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors start - Add master block fire event
|
||||||
+ final BlockPos pos = this.getBlockPos();
|
+ final BlockPos pos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
+
|
+ if (!event.callEvent()) {
|
||||||
+ if (!event.callEvent())
|
|
||||||
+ {
|
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
@ -78,7 +75,7 @@ index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d543
|
|||||||
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
||||||
// Paper start - Replace getHolderOrThrow with a null check
|
// Paper start - Replace getHolderOrThrow with a null check
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dbac6c2b229 100644
|
index ab3e35069a069040f72900a9581f41848e4c4653..d390b05486dcaa563269500b350aecd9dfa3bc28 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
@@ -5,6 +5,8 @@ import java.util.Objects;
|
@@ -5,6 +5,8 @@ import java.util.Objects;
|
||||||
@ -90,7 +87,7 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
|
|||||||
import net.minecraft.ResourceLocationException;
|
import net.minecraft.ResourceLocationException;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -29,6 +31,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
@@ -30,6 +32,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||||
@ -98,25 +95,14 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
|
|||||||
|
|
||||||
public class StructureBlockEntity extends BlockEntity {
|
public class StructureBlockEntity extends BlockEntity {
|
||||||
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
||||||
@@ -259,7 +262,7 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -317,6 +320,14 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
BlockPos blockPos = this.getBlockPos();
|
|
||||||
- int i = 80;
|
|
||||||
+ // Scissors - Obfuscation fixes
|
|
||||||
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
|
||||||
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
|
||||||
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
|
||||||
@@ -316,6 +319,16 @@ public class StructureBlockEntity extends BlockEntity {
|
|
||||||
if (this.structureName == null) {
|
if (this.structureName == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors start - Add master block fire event
|
||||||
+ final BlockPos pos = this.getBlockPos();
|
+ final BlockPos pos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
+
|
+ if (!event.callEvent()) {
|
||||||
+ if (!event.callEvent())
|
|
||||||
+ {
|
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
@ -124,24 +110,21 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
|
|||||||
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
||||||
ServerLevel serverLevel = (ServerLevel)this.level;
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
||||||
@@ -367,6 +380,16 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -368,6 +379,13 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
if (structureTemplate == null) {
|
if (structureTemplate == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors start - Add master block fire event
|
||||||
+ final BlockPos blockPos = this.getBlockPos();
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
+
|
+ if (!event.callEvent()) {
|
||||||
+ if (!event.callEvent())
|
|
||||||
+ {
|
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
|
||||||
this.loadStructureInfo(structureTemplate);
|
this.loadStructureInfo(structureTemplate);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -407,6 +430,15 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -408,6 +426,14 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unloadStructure() {
|
public void unloadStructure() {
|
||||||
@ -149,8 +132,7 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
|
|||||||
+ final BlockPos blockPos = this.getBlockPos();
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
+
|
+
|
||||||
+ if (!event.callEvent())
|
+ if (!event.callEvent()) {
|
||||||
+ {
|
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
@ -1,21 +1,23 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Tue, 5 Jul 2022 04:12:31 +0100
|
Date: Sat, 11 May 2024 13:02:20 -0500
|
||||||
Subject: [PATCH] Add spectator teleport event
|
Subject: [PATCH] Add spectator teleport event
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 860d33ac56680babd87358b1d7d2216dac3f7865..a60f594b3d7c8c30344f5e888e4309b8f75fdeaf 100644
|
index 5e9202bc7fc649764568b55d66ba0d684118c00c..31a6be18075723eb53fd1cbb664429e49909cf66 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -29,6 +29,8 @@ import java.util.function.Consumer;
|
||||||
package net.minecraft.server.network;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
import javax.annotation.Nullable;
|
||||||
import com.google.common.collect.Lists;
|
+
|
||||||
import com.google.common.primitives.Floats;
|
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
import com.mojang.authlib.GameProfile;
|
import net.minecraft.ChatFormatting;
|
||||||
@@ -2033,6 +2034,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.advancements.AdvancementHolder;
|
||||||
|
@@ -2033,6 +2035,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
Entity entity = packet.getEntity(worldserver);
|
Entity entity = packet.getEntity(worldserver);
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
@ -1,22 +1,22 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Jul 2022 02:55:01 +0100
|
Date: Sat, 11 May 2024 13:04:21 -0500
|
||||||
Subject: [PATCH] Prevent invalid container events
|
Subject: [PATCH] Prevent invalid container events
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index a60f594b3d7c8c30344f5e888e4309b8f75fdeaf..cfe4f98458c1b1fd311535552b99937d1f319c0e 100644
|
index 2b93d90da92559da021bac81bb3bc0a4e556ffb6..f8c6d5e2e384e3cf549c68b71c77b0f376cf32f0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -29,6 +29,7 @@ import java.util.function.UnaryOperator;
|
@@ -31,6 +31,7 @@ import java.util.stream.Stream;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import net.kyori.adventure.text.format.NamedTextColor; // Scissors
|
|
||||||
|
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.SharedConstants;
|
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
@@ -2898,6 +2899,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
import net.minecraft.advancements.AdvancementHolder;
|
||||||
|
@@ -2964,6 +2965,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 11 Jul 2022 17:29:12 -0300
|
Date: Sat, 11 May 2024 13:08:40 -0500
|
||||||
Subject: [PATCH] Validate block entity/entity tag query positions
|
Subject: [PATCH] Validate block entity/entity tag query positions
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index cfe4f98458c1b1fd311535552b99937d1f319c0e..adbb1036913ba6299f2093c84480e4147a36b344 100644
|
index 65284355b6fc97eb1967e5c6fd51bc5b018e3e29..26eb85c9be17fcac00a5f31c2ede3111319c4044 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1278,7 +1278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1266,7 +1266,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
if (this.player.hasPermissions(2)) {
|
if (this.player.hasPermissions(2)) {
|
||||||
Entity entity = this.player.level().getEntity(packet.getEntityId());
|
Entity entity = this.player.level().getEntity(packet.getEntityId());
|
||||||
|
|
||||||
@ -17,15 +17,15 @@ index cfe4f98458c1b1fd311535552b99937d1f319c0e..adbb1036913ba6299f2093c84480e414
|
|||||||
CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag());
|
CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag());
|
||||||
|
|
||||||
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
|
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
|
||||||
@@ -1310,7 +1310,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1298,7 +1298,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@Override
|
@Override
|
||||||
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQueryPacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
- if (this.player.hasPermissions(2)) {
|
- if (this.player.hasPermissions(2)) {
|
||||||
+ // Scissors start - Validate block entity tag query positions
|
+ // Scissors start - Validate block entity tag query positions
|
||||||
+ if (this.player.hasPermissions(2) && this.player.level().isLoadedAndInBounds(packet.getPos())
|
+ if (this.player.hasPermissions(2) && this.player.level().isLoadedAndInBounds(packet.getPos())
|
||||||
+ && this.player.distanceToSqr(packet.getPos().getX(), packet.getPos().getY(), packet.getPos().getZ()) < 32 * 32) {
|
+ && this.player.distanceToSqr(packet.getPos().getX(), packet.getPos().getY(), packet.getPos().getZ()) < 32 * 32) {
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(packet.getPos());
|
BlockEntity tileentity = this.player.level().getBlockEntity(packet.getPos());
|
||||||
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata(this.player.registryAccess()) : null;
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Tue, 16 Aug 2022 17:13:02 +0100
|
Date: Sat, 11 May 2024 13:09:44 -0500
|
||||||
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
|
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
index 753200057e74b8e2d5274894b982e6ee946a559e..25df28c8a2061a754cb576634b63d5ca6e5011d1 100644
|
index 70f207f016959402ff3cba9de924f906fea28110..f4751469d925f350a7eda9ae6a1f340d41636b2c 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
@@ -198,6 +198,7 @@ public final class CraftChatMessage {
|
@@ -216,6 +216,7 @@ public final class CraftChatMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
@ -1,25 +1,26 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Tue, 23 Jan 2024 19:04:22 -0600
|
Date: Sat, 11 May 2024 13:11:20 -0500
|
||||||
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
|
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e24da8561 100644
|
index a28be7a332659be655f419d969e0c64e659b6c21..7867f88fdb7ed0b644ab7c4e3c971d1164feea7a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
@@ -8,8 +8,10 @@ import java.util.Objects;
|
@@ -9,8 +9,11 @@ import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.UnaryOperator;
|
import java.util.function.UnaryOperator;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
import net.minecraft.commands.CommandSource;
|
import net.minecraft.commands.CommandSource;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
+import net.minecraft.commands.Commands;
|
+import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtOps;
|
@@ -21,6 +24,7 @@ import net.minecraft.network.chat.Component;
|
||||||
@@ -19,6 +21,7 @@ import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.ComponentUtils;
|
import net.minecraft.network.chat.ComponentUtils;
|
||||||
import net.minecraft.network.chat.Style;
|
import net.minecraft.network.chat.Style;
|
||||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
@ -27,7 +28,7 @@ index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e
|
|||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.network.FilteredText;
|
import net.minecraft.server.network.FilteredText;
|
||||||
@@ -32,6 +35,8 @@ import net.minecraft.world.level.block.SignBlock;
|
@@ -34,6 +38,8 @@ import net.minecraft.world.level.block.SignBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
@ -36,7 +37,7 @@ index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.bukkit.block.sign.Side;
|
import org.bukkit.block.sign.Side;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
@@ -289,6 +294,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
@@ -290,6 +296,19 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||||
}
|
}
|
||||||
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
||||||
// Paper end - Fix commands from signs not firing command events
|
// Paper end - Fix commands from signs not firing command events
|
||||||
@ -46,12 +47,10 @@ index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e
|
|||||||
+ final CraftHumanEntity craftPlayer = player.getBukkitEntity();
|
+ final CraftHumanEntity craftPlayer = player.getBukkitEntity();
|
||||||
+ final Commands commands = vanillaServer.getCommands();
|
+ final Commands commands = vanillaServer.getCommands();
|
||||||
+
|
+
|
||||||
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
+ if (ScissorsConfig.commandSignsBypassPermissions) {
|
||||||
+ {
|
|
||||||
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
||||||
+ }
|
+ }
|
||||||
+ else
|
+ else {
|
||||||
+ {
|
|
||||||
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
@ -1,319 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Mon, 15 Apr 2024 22:49:31 -0500
|
|
||||||
Subject: [PATCH] Reset large tags
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
|
||||||
index 4105bb71b1f1614b3e91478b40b85add94a9257b..52d2a8fd6e16c8d85f2544ffdb9ed4d18b298e1c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java
|
|
||||||
@@ -2,6 +2,8 @@ package net.minecraft.world;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.ListTag;
|
|
||||||
@@ -22,10 +24,12 @@ public class ContainerHelper {
|
|
||||||
|
|
||||||
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
|
|
||||||
ListTag listTag = new ListTag();
|
|
||||||
+ long total = 0; // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < stacks.size(); i++) {
|
|
||||||
ItemStack itemStack = stacks.get(i);
|
|
||||||
if (!itemStack.isEmpty()) {
|
|
||||||
+ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors
|
|
||||||
CompoundTag compoundTag = new CompoundTag();
|
|
||||||
compoundTag.putByte("Slot", (byte)i);
|
|
||||||
itemStack.save(compoundTag);
|
|
||||||
@@ -33,7 +37,7 @@ public class ContainerHelper {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!listTag.isEmpty() || setIfEmpty) {
|
|
||||||
+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) { // Scissors
|
|
||||||
nbt.put("Items", listTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -42,11 +46,19 @@ public class ContainerHelper {
|
|
||||||
|
|
||||||
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
|
||||||
ListTag listTag = nbt.getList("Items", 10);
|
|
||||||
+ long total = 0; // Scissors - Account for items inside containers
|
|
||||||
|
|
||||||
for (int i = 0; i < listTag.size(); i++) {
|
|
||||||
CompoundTag compoundTag = listTag.getCompound(i);
|
|
||||||
int j = compoundTag.getByte("Slot") & 255;
|
|
||||||
if (j >= 0 && j < stacks.size()) {
|
|
||||||
+ // Scissors start
|
|
||||||
+ total += NbtUtility.getTagSize(compoundTag);
|
|
||||||
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ stacks.clear();
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
stacks.set(j, ItemStack.of(compoundTag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
index 1ad126d992d95062a3db08374db7a927f23a0cac..6af963d383293a4a6f8d517e2dc179ab70744b31 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
||||||
@@ -23,6 +23,8 @@ import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
|
||||||
@@ -278,6 +280,12 @@ public final class ItemStack {
|
|
||||||
|
|
||||||
// CraftBukkit - break into own method
|
|
||||||
private void load(CompoundTag nbttagcompound) {
|
|
||||||
+ // Scissors start - Reset large tags
|
|
||||||
+ if (NbtUtility.isTooLarge(nbttagcompound)) {
|
|
||||||
+ // Reset tag without destroying item
|
|
||||||
+ nbttagcompound = NbtUtility.Item.removeItemData(nbttagcompound);
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
|
|
||||||
this.count = nbttagcompound.getByte("Count");
|
|
||||||
if (nbttagcompound.contains("tag", 10)) {
|
|
||||||
@@ -585,7 +593,11 @@ public final class ItemStack {
|
|
||||||
nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
|
|
||||||
nbt.putByte("Count", (byte) this.count);
|
|
||||||
if (this.tag != null) {
|
|
||||||
- nbt.put("tag", this.tag.copy());
|
|
||||||
+ // Scissors start - Don't save large tags
|
|
||||||
+ if (!NbtUtility.isTooLarge(this.tag)) {
|
|
||||||
+ nbt.put("tag", this.tag.copy());
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
return nbt;
|
|
||||||
@@ -919,6 +931,7 @@ public final class ItemStack {
|
|
||||||
// Paper end
|
|
||||||
|
|
||||||
public void setTag(@Nullable CompoundTag nbt) {
|
|
||||||
+ if (NbtUtility.isTooLarge(nbt)) return; // Scissors - Ignore large tags
|
|
||||||
this.tag = nbt;
|
|
||||||
this.processEnchantOrder(this.tag); // Paper
|
|
||||||
if (this.getItem().canBeDepleted()) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
||||||
index 89d06253b00604114e543ebbe12a9993ae95dc41..d0af3a9b956b37126811080d65474eacd76bc083 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
||||||
@@ -9,6 +9,8 @@ import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.SharedConstants;
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
@@ -213,6 +215,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
|
||||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
||||||
index 416aa989ebb18a8741cc9d605a1180ab830f6643..af7ed06c083161212784f746290129a17523575a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.level.block.entity;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -34,6 +35,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
||||||
index 9bb542ce3a8c52e1688bb1f66fc916dd23a5fd10..d8386aa10dc1616c4da87bc8078548d13bff5bdf 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
||||||
@@ -3,6 +3,8 @@ package net.minecraft.world.level.block.entity;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -73,6 +75,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
||||||
index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..2cf4a854a40aabbfff2f6ee4fb9e36e8d466afd5 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.level.block.entity;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -40,6 +41,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
||||||
private int maxStack = MAX_STACK;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
||||||
index 881379681c39230a00b3a1f11cd87498984396c7..8e1ef455c1b563844c416021c478b2a34b90c418 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.level.block.entity;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
@@ -28,6 +29,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
|
||||||
private int maxStack = MAX_STACK;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
||||||
index cdb739df2a285032d25d84f4464f202a7a3fa578..69845474c207220c0146891be90e3232ac8a3547 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
||||||
@@ -6,6 +6,8 @@ import java.util.function.BooleanSupplier;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -57,6 +59,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
||||||
private int maxStack = MAX_STACK;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.items) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.items.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
||||||
index 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..c37f0f12283f528d16fd0450075eab1974ba5057 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
|
||||||
@@ -4,6 +4,8 @@ import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.Direction;
|
|
||||||
import net.minecraft.core.NonNullList;
|
|
||||||
@@ -61,6 +63,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
|
||||||
public boolean opened;
|
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
|
||||||
+ // Scissors start - Account for items inside containers
|
|
||||||
+ long total = 0;
|
|
||||||
+
|
|
||||||
+ for (ItemStack item : this.itemStacks) {
|
|
||||||
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
|
||||||
+ this.itemStacks.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return this.itemStacks;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 10 Dec 2023 18:57:50 -0600
|
Date: Sat, 11 May 2024 13:18:03 -0500
|
||||||
Subject: [PATCH] Patch large selector distance crash
|
Subject: [PATCH] Patch large selector distance crash
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
diff --git a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
index f62640152027b874d4266d868574af062bd684d7..f94385837d5ed1ef52458b73410df5fd186d66e2 100644
|
index 060c0ffe57a4648598870c6168be203bf3a8634d..5c697e5d85c5c65af0ec969dbd68c38e876fc02f 100644
|
||||||
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
@@ -123,11 +123,11 @@ public interface MinMaxBounds<T extends Number> {
|
@@ -121,11 +121,11 @@ public interface MinMaxBounds<T extends Number> {
|
||||||
public static record Doubles(@Override Optional<Double> min, @Override Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq)
|
public static record Doubles(@Override Optional<Double> min, @Override Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq)
|
||||||
implements MinMaxBounds<Double> {
|
implements MinMaxBounds<Double> {
|
||||||
public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
|
public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
|
||||||
@ -23,7 +23,7 @@ index f62640152027b874d4266d868574af062bd684d7..f94385837d5ed1ef52458b73410df5fd
|
|||||||
|
|
||||||
private static MinMaxBounds.Doubles create(StringReader reader, Optional<Double> min, Optional<Double> max) throws CommandSyntaxException {
|
private static MinMaxBounds.Doubles create(StringReader reader, Optional<Double> min, Optional<Double> max) throws CommandSyntaxException {
|
||||||
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
|
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
|
||||||
@@ -179,7 +179,7 @@ public interface MinMaxBounds<T extends Number> {
|
@@ -177,7 +177,7 @@ public interface MinMaxBounds<T extends Number> {
|
||||||
public static record Ints(@Override Optional<Integer> min, @Override Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq)
|
public static record Ints(@Override Optional<Integer> min, @Override Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq)
|
||||||
implements MinMaxBounds<Integer> {
|
implements MinMaxBounds<Integer> {
|
||||||
public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
|
public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 20 Mar 2023 07:04:50 +0000
|
Date: Fri, 14 Jun 2024 18:07:11 -0500
|
||||||
Subject: [PATCH] Patch invalid entity rotation log spam
|
Subject: [PATCH] Patch invalid entity rotation log spam
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 2ecf2d8ff546ed097cb3b547db22d28a31d29ec4..36b1a1cc66b9852d3b10c09cbf39262f51996663 100644
|
index 6ee2d11e4f3fbc8424a2ffbe6a7ebd1832a25503..6bfe06748df9e36c20dc276471f209c1072ad3e4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -4751,7 +4751,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -4812,7 +4812,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
|
|
||||||
public void setXRot(float pitch) {
|
public void setXRot(float pitch) {
|
||||||
if (!Float.isFinite(pitch)) {
|
if (!Float.isFinite(pitch)) {
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 15 Apr 2024 23:01:26 -0500
|
Date: Fri, 14 Jun 2024 18:12:12 -0500
|
||||||
Subject: [PATCH] Add configuration option to disable chat signatures
|
Subject: [PATCH] Add configuration option to disable chat signatures
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
index c87b708c368713a23a10ad97704575ee4df27891..a650bdccc7f8fe77abe2750c9939f5eb0ccfd57b 100644
|
index c87b708c368713a23a10ad97704575ee4df27891..72b22821165efaecf9e2fa243d0ce3e45931d00c 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
||||||
@ -15,12 +15,12 @@ index c87b708c368713a23a10ad97704575ee4df27891..a650bdccc7f8fe77abe2750c9939f5eb
|
|||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
public interface OutgoingChatMessage {
|
public interface OutgoingChatMessage {
|
||||||
@@ -46,9 +47,20 @@ public interface OutgoingChatMessage {
|
@@ -46,9 +47,19 @@ public interface OutgoingChatMessage {
|
||||||
// Paper end
|
// Paper end
|
||||||
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
||||||
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
||||||
- if (!playerChatMessage.isFullyFiltered()) {
|
- if (!playerChatMessage.isFullyFiltered()) {
|
||||||
+ // Sccissors start
|
+ // Scissors start
|
||||||
+ if (!playerChatMessage.isFullyFiltered() && ScissorsConfig.chatSignaturesEnabled) {
|
+ if (!playerChatMessage.isFullyFiltered() && ScissorsConfig.chatSignaturesEnabled) {
|
||||||
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
|
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
|
||||||
+ return;
|
+ return;
|
||||||
@ -30,15 +30,14 @@ index c87b708c368713a23a10ad97704575ee4df27891..a650bdccc7f8fe77abe2750c9939f5eb
|
|||||||
+ null,
|
+ null,
|
||||||
+ SignedMessageBody.unsigned(playerChatMessage.signedContent()),
|
+ SignedMessageBody.unsigned(playerChatMessage.signedContent()),
|
||||||
+ unsigned,
|
+ unsigned,
|
||||||
+ playerChatMessage.filterMask(),
|
+ playerChatMessage.filterMask()
|
||||||
+ playerChatMessage.result()
|
|
||||||
+ ), params);
|
+ ), params);
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||||
index 0af9ed92824ccf30814eceb6a2c2e5c12661c991..c92374104b4aed2f952b250c5559ab9cc83532da 100644
|
index 300929a406905f5ff1ede664d5b99fb0938d4d2e..769da86c130354f8c31642f5d87196b68ccd2dd5 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||||
@@ -5,6 +5,8 @@ import java.time.Instant;
|
@@ -5,6 +5,8 @@ import java.time.Instant;
|
||||||
@ -50,36 +49,36 @@ index 0af9ed92824ccf30814eceb6a2c2e5c12661c991..c92374104b4aed2f952b250c5559ab9c
|
|||||||
import net.minecraft.util.SignatureValidator;
|
import net.minecraft.util.SignatureValidator;
|
||||||
import net.minecraft.util.Signer;
|
import net.minecraft.util.Signer;
|
||||||
import net.minecraft.world.entity.player.ProfilePublicKey;
|
import net.minecraft.world.entity.player.ProfilePublicKey;
|
||||||
@@ -45,7 +47,7 @@ public class SignedMessageChain {
|
@@ -55,7 +57,7 @@ public class SignedMessageChain {
|
||||||
if (!playerChatMessage.verify(signatureValidator)) {
|
this.setChainBroken();
|
||||||
throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
|
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.INVALID_SIGNATURE);
|
||||||
} else {
|
} else {
|
||||||
- if (playerChatMessage.hasExpiredServer(Instant.now())) {
|
- if (playerChatMessage.hasExpiredServer(Instant.now())) {
|
||||||
+ if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors
|
+ if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors
|
||||||
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content());
|
SignedMessageChain.LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content());
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a 100644
|
index 703a4ea4c303b28d9cebb0bec86777529ef970da..779d44f878e3ae48f1808d1f48bf2b3120cc97ed 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
||||||
package net.minecraft.server.network;
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
import com.google.common.collect.Lists;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import com.google.common.primitives.Floats;
|
import net.minecraft.ChatFormatting;
|
||||||
@@ -2243,7 +2244,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -2268,6 +2269,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
}
|
||||||
|
|
||||||
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
|
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
|
||||||
|
+ if (!ScissorsConfig.chatSignaturesEnabled) return; // Scissors
|
||||||
ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString());
|
ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString());
|
||||||
- if (exception.shouldDisconnect()) {
|
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
|
||||||
+ if (exception.shouldDisconnect() && ScissorsConfig.chatSignaturesEnabled) { // Scissors - Do not kick when chat signatures are disabled
|
}
|
||||||
this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes
|
@@ -2364,6 +2366,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
} else {
|
|
||||||
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
|
|
||||||
@@ -2291,6 +2292,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
|
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
|
||||||
|
|
||||||
if (optional.isEmpty()) {
|
if (optional.isEmpty()) {
|
||||||
@ -87,7 +86,7 @@ index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b
|
|||||||
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
||||||
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
||||||
}
|
}
|
||||||
@@ -2489,6 +2491,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -2549,6 +2552,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
|
||||||
synchronized (this.lastSeenMessages) {
|
synchronized (this.lastSeenMessages) {
|
||||||
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
|
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
|
||||||
@ -95,7 +94,7 @@ index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b
|
|||||||
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
||||||
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
||||||
}
|
}
|
||||||
@@ -3460,6 +3463,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -3532,6 +3536,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
@Override
|
@Override
|
||||||
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
|
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
@ -103,3 +102,15 @@ index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b
|
|||||||
RemoteChatSession.Data remotechatsession_a = packet.chatSession();
|
RemoteChatSession.Data remotechatsession_a = packet.chatSession();
|
||||||
ProfilePublicKey.Data profilepublickey_a = this.chatSession != null ? this.chatSession.profilePublicKey().data() : null;
|
ProfilePublicKey.Data profilepublickey_a = this.chatSession != null ? this.chatSession.profilePublicKey().data() : null;
|
||||||
ProfilePublicKey.Data profilepublickey_a1 = remotechatsession_a.profilePublicKey();
|
ProfilePublicKey.Data profilepublickey_a1 = remotechatsession_a.profilePublicKey();
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
index dbdd9cb76f9e2d0962001d9a1e82896c907d7aea..1a3417361960f470faafe0d28aa08b49b463bba4 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
@@ -182,6 +182,7 @@ public class SculkSpreader {
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
SculkSpreader.ChargeCursor sculkspreader_a = (SculkSpreader.ChargeCursor) iterator.next();
|
||||||
|
|
||||||
|
+ if (!world.getMinecraftWorld().isLoadedAndInBounds(sculkspreader_a.getPos())) continue; // Scissors
|
||||||
|
sculkspreader_a.update(world, pos, random, this, shouldConvertToBlock);
|
||||||
|
if (sculkspreader_a.charge <= 0) {
|
||||||
|
world.levelEvent(3006, sculkspreader_a.getPos(), 0);
|
@ -1,73 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Sun, 10 Jul 2022 10:29:03 +0100
|
|
||||||
Subject: [PATCH] Disable running commands in books by default
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
|
||||||
index 793ab8acd7445984cff2628e3f001661dc20c8e5..0e6e0d6a9c645db0121637262a6cf90172d3c385 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
|
||||||
@@ -2,6 +2,7 @@ package net.minecraft.world.item;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
@@ -9,8 +10,7 @@ import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.nbt.ListTag;
|
|
||||||
import net.minecraft.nbt.StringTag;
|
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
-import net.minecraft.network.chat.Component;
|
|
||||||
-import net.minecraft.network.chat.ComponentUtils;
|
|
||||||
+import net.minecraft.network.chat.*; // Scissors
|
|
||||||
import net.minecraft.stats.Stats;
|
|
||||||
import net.minecraft.util.StringUtil;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
|
||||||
@@ -162,9 +162,43 @@ public class WrittenBookItem extends Item {
|
|
||||||
component2 = Component.literal(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
- return Component.Serializer.toJson(component2);
|
|
||||||
+ return Component.Serializer.toJson(!ScissorsConfig.runCommandsInBooks ? sanitize(component2, 0) : component2); // Scissors - Allow server owners to disable run command in books
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start - Allow server owners to disable run command in books
|
|
||||||
+ public static Component sanitize(Component component, int depth)
|
|
||||||
+ {
|
|
||||||
+ if (depth > 128)
|
|
||||||
+ {
|
|
||||||
+ return Component.nullToEmpty("Sanitization function depth limit exceeded");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ MutableComponent component2 = component.copy();
|
|
||||||
+
|
|
||||||
+ final Style style = component2.getStyle();
|
|
||||||
+ final ClickEvent clickEvent = style.getClickEvent();
|
|
||||||
+
|
|
||||||
+ if (clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND))
|
|
||||||
+ {
|
|
||||||
+ final String clickEventValue = clickEvent.getValue();
|
|
||||||
+
|
|
||||||
+ component2 = component2.copy().setStyle(style
|
|
||||||
+ .withClickEvent(null)
|
|
||||||
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.nullToEmpty("Would've " + (clickEventValue.startsWith("/") ? "ran" : "said") + ": " + clickEvent.getValue())))
|
|
||||||
+ );
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ final List<Component> processedExtra = component2.getSiblings()
|
|
||||||
+ .stream()
|
|
||||||
+ .map(comp -> sanitize(comp, depth + 1))
|
|
||||||
+ .toList();
|
|
||||||
+ component2.getSiblings().clear();
|
|
||||||
+ component2.getSiblings().addAll(processedExtra);
|
|
||||||
+
|
|
||||||
+ return component2;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
@Override
|
|
||||||
public boolean isFoil(ItemStack stack) {
|
|
||||||
return true;
|
|
22
patches/server/0028-Limit-map-decorations.patch
Normal file
22
patches/server/0028-Limit-map-decorations.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Fri, 14 Jun 2024 18:20:01 -0500
|
||||||
|
Subject: [PATCH] Limit map decorations
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
index cf8ae635fce7ea66d4e1ab1dc05575f035fa95ef..6983cf8ecf299285db200ce519c781882c0d2a9b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
@@ -366,6 +366,11 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addDecoration(Holder<MapDecorationType> type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) {
|
||||||
|
+ // Scissors start - Limit decoration count
|
||||||
|
+ if (this.decorations.size() > 32) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
int i = 1 << this.scale;
|
||||||
|
float f = (float) (x - (double) this.centerX) / (float) i;
|
||||||
|
float f1 = (float) (z - (double) this.centerZ) / (float) i;
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Fri, 28 Apr 2023 16:44:50 -0300
|
Date: Fri, 14 Jun 2024 18:21:25 -0500
|
||||||
Subject: [PATCH] Prevent player banning using duplicate UUIDs
|
Subject: [PATCH] Prevent player banning using duplicate UUIDs
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 502bdc726b7890b00ee36871d905dea44e8719e3..1fbc8b372271bb4cd4375ca6b6b1d7e7961094fb 100644
|
index ca56a0b596976448da6bb2a0e82b3d5cd4133e12..f8198f99244b4a635fa6fc68757acb38008c4564 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -1667,7 +1667,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1673,7 +1673,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID());
|
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID());
|
||||||
entity.unRide();
|
entity.unRide();
|
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Fri, 28 Apr 2023 16:46:00 -0300
|
Date: Fri, 14 Jun 2024 18:22:22 -0500
|
||||||
Subject: [PATCH] Don't warn on duplicate entity UUIDs
|
Subject: [PATCH] Don't warn on duplicate entity UUIDs
|
||||||
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Wed, 7 Jun 2023 16:50:35 -0300
|
Date: Fri, 14 Jun 2024 18:23:46 -0500
|
||||||
Subject: [PATCH] Limit beacon effectRange
|
Subject: [PATCH] Limit beacon effectRange
|
||||||
|
|
||||||
|
|
||||||
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
|
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 4b81b0180dfc96fc6a88646838a886ca5b5d301b..63ea77b3e965ff18571492d511ef7c1082441f9d 100644
|
index a6ffbbc1b5021564864e42c0756342352c2b8290..724edea5d4399fef2ddadbe631adef3d22513894 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
@@ -87,7 +87,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
@@ -91,7 +91,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
private double effectRange = -1;
|
private double effectRange = -1;
|
||||||
|
|
||||||
public double getEffectRange() {
|
public double getEffectRange() {
|
||||||
@ -17,7 +17,7 @@ index 4b81b0180dfc96fc6a88646838a886ca5b5d301b..63ea77b3e965ff18571492d511ef7c10
|
|||||||
return this.levels * 10 + 10;
|
return this.levels * 10 + 10;
|
||||||
} else {
|
} else {
|
||||||
return effectRange;
|
return effectRange;
|
||||||
@@ -456,6 +456,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
@@ -458,6 +458,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
|
|
||||||
this.lockKey = LockCode.fromTag(nbt);
|
this.lockKey = LockCode.fromTag(nbt);
|
||||||
this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper - Custom beacon ranges
|
this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper - Custom beacon ranges
|
@ -1,100 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Sun, 10 Dec 2023 18:41:18 -0600
|
|
||||||
Subject: [PATCH] Prevent velocity freeze
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
|
||||||
index 20ce474b72894a8bb3fc21018b9d79bbdc8bb14b..b5c87bb5f5d3526600520913f04cfc6614a62b81 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
|
||||||
@@ -1,6 +1,8 @@
|
|
||||||
package net.minecraft.world.entity.projectile;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.MathUtility;
|
|
||||||
import net.minecraft.core.particles.ParticleOptions;
|
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
@@ -50,12 +52,15 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
|
||||||
// CraftBukkit end
|
|
||||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
|
||||||
|
|
||||||
- if (d6 != 0.0D) {
|
|
||||||
- this.xPower = d3 / d6 * 0.1D;
|
|
||||||
- this.yPower = d4 / d6 * 0.1D;
|
|
||||||
- this.zPower = d5 / d6 * 0.1D;
|
|
||||||
+ if (d6 != 0.0D)
|
|
||||||
+ {
|
|
||||||
+ // Scissors start - Prevent projectile velocity freeze
|
|
||||||
+ //this.xPower = d3 / d6 * 0.1D;
|
|
||||||
+ //this.yPower = d4 / d6 * 0.1D;
|
|
||||||
+ //this.zPower = d5 / d6 * 0.1D;
|
|
||||||
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> type, LivingEntity owner, double directionX, double directionY, double directionZ, Level world) {
|
|
||||||
@@ -167,6 +172,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
|
||||||
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start - Prevent projectile velocity freeze
|
|
||||||
+ public void setPower(double xPower, double yPower, double zPower)
|
|
||||||
+ {
|
|
||||||
+ if (Double.isInfinite(xPower) || Double.isInfinite(yPower) || Double.isInfinite(zPower))
|
|
||||||
+ {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (Double.isNaN(xPower) || Double.isNaN(yPower) || Double.isNaN(zPower))
|
|
||||||
+ {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ this.xPower = MathUtility.clampDouble(xPower, -1024, 1024);
|
|
||||||
+ this.yPower = MathUtility.clampDouble(yPower, -1024, 1024);
|
|
||||||
+ this.zPower = MathUtility.clampDouble(zPower, -1024, 1024);
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
@Override
|
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
||||||
super.readAdditionalSaveData(nbt);
|
|
||||||
@@ -174,9 +198,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
|
||||||
ListTag nbttaglist = nbt.getList("power", 6);
|
|
||||||
|
|
||||||
if (nbttaglist.size() == 3) {
|
|
||||||
- this.xPower = nbttaglist.getDouble(0);
|
|
||||||
- this.yPower = nbttaglist.getDouble(1);
|
|
||||||
- this.zPower = nbttaglist.getDouble(2);
|
|
||||||
+ // Scissors start - Prevent projectile velocity freeze
|
|
||||||
+ //this.xPower = nbttaglist.getDouble(0);
|
|
||||||
+ //this.yPower = nbttaglist.getDouble(1);
|
|
||||||
+ //this.zPower = nbttaglist.getDouble(2);
|
|
||||||
+
|
|
||||||
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -210,9 +238,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
|
||||||
Vec3 vec3d = entity.getLookAngle();
|
|
||||||
|
|
||||||
this.setDeltaMovement(vec3d);
|
|
||||||
- this.xPower = vec3d.x * 0.1D;
|
|
||||||
- this.yPower = vec3d.y * 0.1D;
|
|
||||||
- this.zPower = vec3d.z * 0.1D;
|
|
||||||
+ // Scissors start - Prevent projectile velocity freeze
|
|
||||||
+ //this.xPower = vec3d.x * 0.1D;
|
|
||||||
+ //this.yPower = vec3d.y * 0.1D;
|
|
||||||
+ //this.zPower = vec3d.z * 0.1D;
|
|
||||||
+
|
|
||||||
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
|
||||||
+ // Scissors end
|
|
||||||
this.setOwner(entity);
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Tue, 13 Jun 2023 18:29:18 -0300
|
Date: Fri, 14 Jun 2024 18:24:35 -0500
|
||||||
Subject: [PATCH] Improve validation of ResourceLocations
|
Subject: [PATCH] Improve validation of ResourceLocations
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sat, 1 Jul 2023 21:22:29 -0300
|
Date: Fri, 14 Jun 2024 18:25:43 -0500
|
||||||
Subject: [PATCH] Don't log on too many chained updates
|
Subject: [PATCH] Don't log on too many chained updates
|
||||||
|
|
||||||
|
|
@ -1,36 +1,37 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 15 Apr 2024 23:27:16 -0500
|
Date: Fri, 14 Jun 2024 18:34:17 -0500
|
||||||
Subject: [PATCH] Implement command block events
|
Subject: [PATCH] Implement command block events
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
||||||
index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400deb533d2 100644
|
index 5cee02970241caafd151cadf08fc8d7092ec13d9..81e16e36b1950d4ae81cb09c39b36d7d4ba91d31 100644
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
||||||
@@ -9,7 +9,7 @@ import net.minecraft.world.level.BaseCommandBlock;
|
@@ -14,7 +14,7 @@ public class ServerboundSetCommandMinecartPacket implements Packet<ServerGamePac
|
||||||
import net.minecraft.world.level.Level;
|
public static final StreamCodec<FriendlyByteBuf, ServerboundSetCommandMinecartPacket> STREAM_CODEC = Packet.codec(
|
||||||
|
ServerboundSetCommandMinecartPacket::write, ServerboundSetCommandMinecartPacket::new
|
||||||
public class ServerboundSetCommandMinecartPacket implements Packet<ServerGamePacketListener> {
|
);
|
||||||
- private final int entity;
|
- private final int entity;
|
||||||
+ public final int entity; // Scissors - private -> public
|
+ public final int entity; // Scissors - private -> public
|
||||||
private final String command;
|
private final String command;
|
||||||
private final boolean trackOutput;
|
private final boolean trackOutput;
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc798e431c6a 100644
|
index 779d44f878e3ae48f1808d1f48bf2b3120cc97ed..87d0dc96d8592612cefa25c378805aeea131b99e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1,6 +1,8 @@
|
@@ -31,6 +31,9 @@ import java.util.stream.Stream;
|
||||||
package net.minecraft.server.network;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import me.totalfreedom.scissors.ScissorsConfig;
|
import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
||||||
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
||||||
import com.google.common.collect.Lists;
|
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
import com.google.common.primitives.Floats;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
@@ -155,6 +157,7 @@ import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.ChatFormatting;
|
||||||
|
@@ -160,6 +163,7 @@ import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraft.world.entity.player.ProfilePublicKey;
|
import net.minecraft.world.entity.player.ProfilePublicKey;
|
||||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
import net.minecraft.world.entity.vehicle.Boat;
|
import net.minecraft.world.entity.vehicle.Boat;
|
||||||
@ -38,7 +39,7 @@ index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc79
|
|||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.AnvilMenu;
|
import net.minecraft.world.inventory.AnvilMenu;
|
||||||
import net.minecraft.world.inventory.BeaconMenu;
|
import net.minecraft.world.inventory.BeaconMenu;
|
||||||
@@ -189,6 +192,8 @@ import net.minecraft.world.phys.Vec3;
|
@@ -197,6 +201,8 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
import net.minecraft.world.phys.shapes.BooleanOp;
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
@ -47,13 +48,12 @@ index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc79
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -905,6 +910,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -931,6 +937,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity);
|
this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), s, new CraftCommandBlock(this.player.level().getWorld(), tileentitycommand));
|
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), s, new CraftCommandBlock(this.player.level().getWorld(), tileentitycommand));
|
||||||
+
|
|
||||||
+ if (!event.callEvent()) {
|
+ if (!event.callEvent()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@ -64,7 +64,7 @@ index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc79
|
|||||||
commandblocklistenerabstract.setCommand(s);
|
commandblocklistenerabstract.setCommand(s);
|
||||||
commandblocklistenerabstract.setTrackOutput(flag);
|
commandblocklistenerabstract.setTrackOutput(flag);
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
@@ -936,7 +951,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -962,7 +977,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
|
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
|
||||||
|
|
||||||
if (commandblocklistenerabstract != null) {
|
if (commandblocklistenerabstract != null) {
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Mon, 10 Apr 2023 13:56:18 -0300
|
|
||||||
Subject: [PATCH] Limit sculk catalyst cursor positions
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
|
||||||
index 01e13e6d3ebd84cff0019f56efff16747420dc95..d4058bc31ca291cbc95eeef594fc35e1ff6a3dde 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
|
||||||
@@ -181,7 +181,7 @@ public class SculkSpreader {
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
SculkSpreader.ChargeCursor sculkspreader_a = (SculkSpreader.ChargeCursor) iterator.next();
|
|
||||||
-
|
|
||||||
+ if (!world.getMinecraftWorld().isLoadedAndInBounds(sculkspreader_a.getPos())) continue; // Scissors
|
|
||||||
sculkspreader_a.update(world, pos, random, this, shouldConvertToBlock);
|
|
||||||
if (sculkspreader_a.charge <= 0) {
|
|
||||||
world.levelEvent(3006, sculkspreader_a.getPos(), 0);
|
|
@ -1,40 +1,37 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Wed, 5 Jul 2023 22:58:24 +0100
|
Date: Fri, 14 Jun 2024 18:39:39 -0500
|
||||||
Subject: [PATCH] Limit save data for Bees and Vexes
|
Subject: [PATCH] Limit save data for Bees and Vexes
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
index f9521a6e115f0c975a7885b024c99eae300b63bf..c1598d0caee40a7d73af549b31b61ee7aae77315 100644
|
index 0dfb8109fd8c022b079da00f6a0e3fc85b57bf7a..fdfe3ca7c2a1d34567651e64933392c4a17bd751 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
@@ -234,8 +234,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
@@ -231,7 +231,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
this.hivePos = null;
|
- this.hivePos = (BlockPos) NbtUtils.readBlockPos(nbt, "hive_pos").orElse(null); // CraftBukkit - decompile error
|
||||||
- if (nbt.contains("HivePos")) {
|
+ // Scissors start - limit hive_pos
|
||||||
- this.hivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos"));
|
+ if (nbt.contains("hive_pos"))
|
||||||
+ if (nbt.contains("HivePos"))
|
|
||||||
+ {
|
+ {
|
||||||
+ // Scissors start - Limit HivePos
|
+ final BlockPos savedHivePos = NbtUtils.readBlockPos(nbt, "hive_pos").orElse(null); // CraftBukkit - decompile error
|
||||||
+ final BlockPos savedHivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos"));
|
|
||||||
+ this.hivePos = this.level().isLoadedAndInBounds(savedHivePos) ? savedHivePos : null;
|
+ this.hivePos = this.level().isLoadedAndInBounds(savedHivePos) ? savedHivePos : null;
|
||||||
+ // Scissors end - Limit HivePos
|
+ }
|
||||||
}
|
+ // Scissors end
|
||||||
|
this.savedFlowerPos = (BlockPos) NbtUtils.readBlockPos(nbt, "flower_pos").orElse(null); // CraftBukkit - decompile error
|
||||||
this.savedFlowerPos = null;
|
super.readAdditionalSaveData(nbt);
|
||||||
|
this.setHasNectar(nbt.getBoolean("HasNectar"));
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||||
index f443006c1e32feee97b32312814e2447a50c45e2..ad418449f5ffd4bcceb5834b1385dc69259f3a21 100644
|
index fd3b37dde54623ba38186efb2a64d364c86b81d2..ae1051a7ebc2b2bf6d5bf5582443fedeb307ee01 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||||
@@ -118,8 +118,12 @@ public class Vex extends Monster implements TraceableEntity {
|
@@ -111,7 +111,10 @@ public class Vex extends Monster implements TraceableEntity {
|
||||||
@Override
|
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
super.readAdditionalSaveData(nbt);
|
super.readAdditionalSaveData(nbt);
|
||||||
- if (nbt.contains("BoundX")) {
|
if (nbt.contains("BoundX")) {
|
||||||
- this.boundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
- this.boundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
||||||
+ if (nbt.contains("BoundX"))
|
|
||||||
+ {
|
|
||||||
+ // Scissors start - Limit Vex bound origin
|
+ // Scissors start - Limit Vex bound origin
|
||||||
+ final BlockPos savedBoundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
+ final BlockPos savedBoundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
||||||
+ this.boundOrigin = this.level().isLoadedAndInBounds(savedBoundOrigin) ? savedBoundOrigin : null;
|
+ this.boundOrigin = this.level().isLoadedAndInBounds(savedBoundOrigin) ? savedBoundOrigin : null;
|
@ -1,36 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Fri, 28 Apr 2023 16:29:23 -0300
|
|
||||||
Subject: [PATCH] Limit map decorations
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
|
||||||
index 02e3d1c9c18952ba53507f7b6887fd3c81af33a9..61573844b236838fd219526ea35df8c7b0c94026 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
|
||||||
@@ -63,7 +63,8 @@ public class ClientboundMapItemDataPacket implements Packet<ClientGamePacketList
|
|
||||||
b.writeByte(icon.x());
|
|
||||||
b.writeByte(icon.y());
|
|
||||||
b.writeByte(icon.rot() & 15);
|
|
||||||
- b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent);
|
|
||||||
+ final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors
|
|
||||||
+ b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors
|
|
||||||
}));
|
|
||||||
if (this.colorPatch != null) {
|
|
||||||
buf.writeByte(this.colorPatch.width);
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
||||||
index 45269115e63cfc3bd7dc740a5694e2cc7c35bcb1..85ea95f55fd6177748edf921e2380142d93b8b06 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
||||||
@@ -361,6 +361,11 @@ public class MapItemSavedData extends SavedData {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) {
|
|
||||||
+ // Scissors start - Limit decoration count
|
|
||||||
+ if (this.decorations.size() > 32) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
int i = 1 << this.scale;
|
|
||||||
float f = (float) (x - (double) this.centerX) / (float) i;
|
|
||||||
float f1 = (float) (z - (double) this.centerZ) / (float) i;
|
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Thu, 6 Jul 2023 23:34:46 +0100
|
Date: Fri, 14 Jun 2024 18:49:11 -0500
|
||||||
Subject: [PATCH] Mute invalid Enderdragon phases
|
Subject: [PATCH] Mute invalid Enderdragon phases
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
index 1b1a210a86121049e507a497649727a99452c0a2..a8bcadbf64d5034b172427e16b1468b4c91c4518 100644
|
index 1b1a210a86121049e507a497649727a99452c0a2..5501d94f3b39665a94062ae97b3739ae197dadb1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
|
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
|
||||||
@ -13,12 +13,12 @@ index 1b1a210a86121049e507a497649727a99452c0a2..a8bcadbf64d5034b172427e16b1468b4
|
|||||||
public void doServerTick() {
|
public void doServerTick() {
|
||||||
if (this.targetLocation == null) {
|
if (this.targetLocation == null) {
|
||||||
- LOGGER.warn("Aborting charge player as no target was set.");
|
- LOGGER.warn("Aborting charge player as no target was set.");
|
||||||
+ // LOGGER.warn("Aborting charge player as no target was set."); // Scissors - Mute invalid Enderdragon phases
|
+ // Scissors - Mute invalid Enderdragon phases
|
||||||
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
||||||
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
|
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
|
||||||
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
||||||
index 13f60a16f07c50a278b158d64180009020a4dca6..289361cbaad2ca6392ee66627becb8f973bb1e54 100644
|
index c5269c3117901b8521720d1b32689d7f600f20a3..02dd6f72aa16e6b3edec700b7bc82a84b5ca8dd9 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
|
||||||
@@ -31,7 +31,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
|
@@ -31,7 +31,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
|
||||||
@ -26,7 +26,7 @@ index 13f60a16f07c50a278b158d64180009020a4dca6..289361cbaad2ca6392ee66627becb8f9
|
|||||||
public void doServerTick() {
|
public void doServerTick() {
|
||||||
if (this.attackTarget == null) {
|
if (this.attackTarget == null) {
|
||||||
- LOGGER.warn("Skipping player strafe phase because no player was found");
|
- LOGGER.warn("Skipping player strafe phase because no player was found");
|
||||||
+ // LOGGER.warn("Skipping player strafe phase because no player was found"); // Scissors - Mute invalid Enderdragon phases
|
+ // Scissors - Mute invalid Enderdragon phases
|
||||||
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
||||||
} else {
|
} else {
|
||||||
if (this.currentPath != null && this.currentPath.isDone()) {
|
if (this.currentPath != null && this.currentPath.isDone()) {
|
@ -1,19 +1,19 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Fri, 25 Aug 2023 11:51:47 +0100
|
Date: Fri, 14 Jun 2024 18:50:32 -0500
|
||||||
Subject: [PATCH] Add length limit to note block sound
|
Subject: [PATCH] Add length limit to note block sound
|
||||||
|
|
||||||
|
|
||||||
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
|
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 6f52256bfb668aee7fd1628c1c0c7b3434b847a6..74f1227ecf664cf0d4f62d6f9c3e65ffc07b146e 100644
|
index e79b1ccbdf12006d72401b5be1ac25187033ec59..a7b1a44de0689f7d07bd3e69048b04c28c272159 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||||
@@ -113,7 +113,7 @@ public class SkullBlockEntity extends BlockEntity {
|
@@ -147,7 +147,7 @@ public class SkullBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt.contains("note_block_sound", 8)) {
|
if (nbt.contains("note_block_sound", 8)) {
|
||||||
- this.noteBlockSound = ResourceLocation.tryParse(nbt.getString("note_block_sound"));
|
- this.noteBlockSound = ResourceLocation.tryParse(nbt.getString("note_block_sound"));
|
||||||
+ this.noteBlockSound = ResourceLocation.tryParse(StringUtil.truncateStringIfNecessary(nbt.getString("note_block_sound"), 32767, false)); // Scissors - Add length limit to note block sound
|
+ this.noteBlockSound = ResourceLocation.tryParse(StringUtil.truncateStringIfNecessary(nbt.getString("note_block_sound"), 32767, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (nbt.contains("custom_name", 8)) {
|
76
patches/server/0038-Change-version-fetcher-to-AMG.patch
Normal file
76
patches/server/0038-Change-version-fetcher-to-AMG.patch
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Fri, 14 Jun 2024 18:56:18 -0500
|
||||||
|
Subject: [PATCH] Change version fetcher to AMG
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
|
index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..1cdba130f6224ba0eb5e958d3328b1c476520efe 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
|
@@ -18,10 +18,14 @@ import java.net.URI;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.OptionalInt;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
+
|
||||||
|
+import io.papermc.paper.util.JarManifests;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.format.TextDecoration;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.Server;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||||
|
@@ -35,7 +39,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
|
private static final Logger LOGGER = LogUtils.getClassLogger();
|
||||||
|
private static final int DISTANCE_ERROR = -1;
|
||||||
|
private static final int DISTANCE_UNKNOWN = -2;
|
||||||
|
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
|
||||||
|
+ private static final String DOWNLOAD_PAGE = "https://ci.plex.us.org/job/Scissors/job/" + ServerBuildInfo.buildInfo().gitBranch(); // Scissors
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCacheTime() {
|
||||||
|
@@ -49,7 +53,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
|
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
|
||||||
|
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
|
||||||
|
} else {
|
||||||
|
- updateMessage = getUpdateStatusMessage("PaperMC/Paper", build);
|
||||||
|
+ updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", build);
|
||||||
|
}
|
||||||
|
final @Nullable Component history = this.getHistory();
|
||||||
|
|
||||||
|
@@ -59,15 +63,10 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
|
private static Component getUpdateStatusMessage(final String repo, final ServerBuildInfo build) {
|
||||||
|
int distance = DISTANCE_ERROR;
|
||||||
|
|
||||||
|
- final OptionalInt buildNumber = build.buildNumber();
|
||||||
|
- if (buildNumber.isPresent()) {
|
||||||
|
- distance = fetchDistanceFromSiteApi(build, buildNumber.getAsInt());
|
||||||
|
- } else {
|
||||||
|
- final Optional<String> gitBranch = build.gitBranch();
|
||||||
|
- final Optional<String> gitCommit = build.gitCommit();
|
||||||
|
- if (gitBranch.isPresent() && gitCommit.isPresent()) {
|
||||||
|
- distance = fetchDistanceFromGitHub(repo, gitBranch.get(), gitCommit.get());
|
||||||
|
- }
|
||||||
|
+ final Optional<String> gitBranch = build.gitBranch();
|
||||||
|
+ final Optional<String> gitCommit = build.gitCommit();
|
||||||
|
+ if (gitBranch.isPresent() && gitCommit.isPresent()) {
|
||||||
|
+ distance = fetchDistanceFromGitHub(repo, gitBranch.get(), gitCommit.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch (distance) {
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
index 6101ff98022e7c1ad253edb112a0bf87b139e62b..4338714a0bc8c3618a88b915b575e8b17a77dbd8 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -316,7 +316,7 @@ public class Main {
|
||||||
|
if (buildDate.before(deadline.getTime())) {
|
||||||
|
// Paper start - This is some stupid bullshit
|
||||||
|
System.err.println("*** Warning, you've not updated in a while! ***");
|
||||||
|
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
|
||||||
|
+ System.err.println("*** Please download a new build as per instructions from https://ci.plex.us.org/job/Scissors ***"); // Paper
|
||||||
|
//System.err.println("*** Server will start in 20 seconds ***");
|
||||||
|
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
||||||
|
// Paper end
|
@ -1,55 +1,50 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Focusvity <nathan.curran10012@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 5 Feb 2024 19:39:23 +1100
|
Date: Fri, 14 Jun 2024 19:01:14 -0500
|
||||||
Subject: [PATCH] Add depth limit to Component deserialization
|
Subject: [PATCH] Add depth limit to Component deserialization
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
index ae84d06564b2560e13404f6d89f88ad71dbc2cc6..df3c03aeaee5c12c5d57584535c9c7aa01be7dd3 100644
|
index 3b075dcb6bda40b278296fc8750f2af90c13acc4..a0c3c4faa8c80c880340e0150e16223ac0b5e5a0 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
@@ -3,9 +3,11 @@ package net.minecraft.network.chat;
|
@@ -1,15 +1,7 @@
|
||||||
|
package net.minecraft.network.chat;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.gson.Gson;
|
-import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
-import com.google.gson.GsonBuilder;
|
||||||
+import com.google.gson.JsonArray;
|
-import com.google.gson.JsonDeserializationContext;
|
||||||
import com.google.gson.JsonDeserializationContext;
|
-import com.google.gson.JsonDeserializer;
|
||||||
import com.google.gson.JsonDeserializer;
|
-import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonElement;
|
-import com.google.gson.JsonParseException;
|
||||||
+import com.google.gson.JsonObject;
|
-import com.google.gson.JsonParser;
|
||||||
import com.google.gson.JsonParseException;
|
-import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonParser;
|
-import com.google.gson.JsonSerializer;
|
||||||
import com.google.gson.JsonSerializationContext;
|
+import com.google.gson.*;
|
||||||
@@ -13,6 +15,7 @@ import com.google.gson.JsonSerializer;
|
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.mojang.brigadier.Message;
|
import com.mojang.brigadier.Message;
|
||||||
import com.mojang.serialization.JsonOps;
|
import com.mojang.serialization.JsonOps;
|
||||||
+
|
@@ -24,6 +16,7 @@ import java.util.Optional;
|
||||||
import java.io.StringReader;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
@@ -23,6 +26,9 @@ import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
+import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.network.chat.contents.DataSource;
|
import net.minecraft.network.chat.contents.DataSource;
|
||||||
import net.minecraft.network.chat.contents.KeybindContents;
|
@@ -35,8 +28,10 @@ import net.minecraft.network.chat.contents.SelectorContents;
|
||||||
@@ -33,8 +39,10 @@ import net.minecraft.network.chat.contents.SelectorContents;
|
|
||||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
import net.minecraft.network.chat.contents.TranslatableContents;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
+import net.minecraft.util.GsonHelper;
|
+import net.minecraft.util.GsonHelper;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
+import java.util.regex.Pattern; // Scissors
|
+import java.util.regex.Pattern;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@@ -284,10 +292,65 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
@@ -286,10 +281,70 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
public static class Serializer {
|
public static class Serializer {
|
||||||
|
|
||||||
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
|
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
|
||||||
@ -74,19 +69,23 @@ index ae84d06564b2560e13404f6d89f88ad71dbc2cc6..df3c03aeaee5c12c5d57584535c9c7aa
|
|||||||
+ return 0;
|
+ return 0;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
static MutableComponent deserialize(JsonElement json) {
|
static MutableComponent deserialize(JsonElement json, HolderLookup.Provider registries) {
|
||||||
+ int depth = 1;
|
+ int depth = 1;
|
||||||
+ if (!json.isJsonPrimitive()) {
|
+ if (!json.isJsonPrimitive()) {
|
||||||
+ if (!json.isJsonObject()) {
|
+ if (!json.isJsonObject()) {
|
||||||
+ if (json.isJsonArray()) {
|
+ if (json.isJsonArray()) {
|
||||||
+ JsonArray jsonArray = json.getAsJsonArray();
|
+ JsonArray jsonArray = json.getAsJsonArray();
|
||||||
+ if (jsonArray.size() <= 0) throw new JsonParseException("Unexpected empty array of components");
|
+ if (jsonArray.size() <= 0) {
|
||||||
|
+ throw new JsonParseException("Unexpected empty array of components");
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ for (JsonElement ignored : jsonArray) {
|
+ for (JsonElement ignored : jsonArray) {
|
||||||
+ depth = depthChecker(depth);
|
+ depth = depthChecker(depth);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
+ JsonObject jsonObject = json.getAsJsonObject();
|
+ JsonObject jsonObject = json.getAsJsonObject();
|
||||||
+ if (jsonObject.has("translate")) {
|
+ if (jsonObject.has("translate")) {
|
||||||
+ String s = GsonHelper.getAsString(jsonObject, "translate");
|
+ String s = GsonHelper.getAsString(jsonObject, "translate");
|
||||||
@ -102,7 +101,9 @@ index ae84d06564b2560e13404f6d89f88ad71dbc2cc6..df3c03aeaee5c12c5d57584535c9c7aa
|
|||||||
+
|
+
|
||||||
+ if (jsonObject.has("extra")) {
|
+ if (jsonObject.has("extra")) {
|
||||||
+ JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "extra");
|
+ JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "extra");
|
||||||
+ if (jsonArray.size() <= 0) throw new JsonParseException("Unexpected empty array of components");
|
+ if (jsonArray.size() <= 0) {
|
||||||
|
+ throw new JsonParseException("Unexpected empty array of components");
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ for (JsonElement ignored : jsonArray) {
|
+ for (JsonElement ignored : jsonArray) {
|
||||||
+ depth = depthChecker(depth);
|
+ depth = depthChecker(depth);
|
||||||
@ -111,7 +112,6 @@ index ae84d06564b2560e13404f6d89f88ad71dbc2cc6..df3c03aeaee5c12c5d57584535c9c7aa
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
return (MutableComponent) ComponentSerialization.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
|
||||||
return (MutableComponent) Util.getOrThrow(ComponentSerialization.CODEC.parse(JsonOps.INSTANCE, json), JsonParseException::new);
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,40 +1,39 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Focusvity <nathan.curran10012@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 11 Feb 2024 19:44:20 +1100
|
Date: Fri, 14 Jun 2024 19:05:44 -0500
|
||||||
Subject: [PATCH] Add depth limit to updateCustomBlockEntityTag
|
Subject: [PATCH] Add depth limit to updateCustomBlockEntityTag
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||||
index 8d2c0accadaf0c5d28e7db6e62a05f6c619cf02f..75d31897711cf5917bc6f8082edddbb502c46a95 100644
|
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..b27a5f2251012f256652bcb50caf317c31378b63 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||||
@@ -4,12 +4,19 @@ import java.util.Iterator;
|
@@ -2,12 +2,18 @@ package net.minecraft.world.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
+// Scissors start
|
|
||||||
+import java.util.regex.Matcher;
|
+import java.util.regex.Matcher;
|
||||||
+import java.util.regex.Pattern;
|
+import java.util.regex.Pattern;
|
||||||
+// Scissors end
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+
|
+
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
+import net.minecraft.nbt.ListTag;
|
||||||
+import net.minecraft.nbt.Tag; // Scissors
|
+import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
@@ -240,6 +247,35 @@ public class BlockItem extends Item {
|
@@ -217,6 +223,35 @@ public class BlockItem extends Item {
|
||||||
if (nbttagcompound != null) {
|
if (!customdata.isEmpty()) {
|
||||||
BlockEntity tileentity = world.getBlockEntity(pos);
|
BlockEntity tileentity = world.getBlockEntity(pos);
|
||||||
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ if (nbttagcompound.contains("CustomName")) {
|
+ if (customdata.contains("CustomName")) {
|
||||||
+ String customName = nbttagcompound.getString("CustomName");
|
+ String customName = customdata.getUnsafe().getString("CustomName");
|
||||||
+ Pattern EXTRA_PATTERN = Pattern.compile("\"extra\":(\\[(.*?)\\{|\\[\\{)");
|
+ Pattern EXTRA_PATTERN = Pattern.compile("\"extra\":(\\[(.*?)\\{|\\[\\{)");
|
||||||
+ Matcher matcher = EXTRA_PATTERN.matcher(customName);
|
+ Matcher matcher = EXTRA_PATTERN.matcher(customName);
|
||||||
+ if (matcher.find()) {
|
+ if (matcher.find()) {
|
||||||
@ -46,7 +45,7 @@ index 8d2c0accadaf0c5d28e7db6e62a05f6c619cf02f..75d31897711cf5917bc6f8082edddbb5
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ for (Tag tag : nbttagcompound.tags.values()) {
|
+ for (Tag tag : customdata.getUnsafe().tags.values()) {
|
||||||
+ if (tag instanceof CompoundTag compoundTag && compoundTag.contains("messages")) {
|
+ if (tag instanceof CompoundTag compoundTag && compoundTag.contains("messages")) {
|
||||||
+ ListTag messagesList = compoundTag.getList("messages", 8);
|
+ ListTag messagesList = compoundTag.getList("messages", 8);
|
||||||
+ Pattern TRANSLATE_PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s");
|
+ Pattern TRANSLATE_PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s");
|
157
patches/server/0041-Add-more-fallback-code-for-chunk-bans.patch
Normal file
157
patches/server/0041-Add-more-fallback-code-for-chunk-bans.patch
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sun, 16 Jun 2024 15:38:49 -0500
|
||||||
|
Subject: [PATCH] Add more fallback code for chunk bans
|
||||||
|
|
||||||
|
|
||||||
|
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 5d3e739d28d394ed59fe0003245cc55ac62e6087..e721aa95e0e11455df2fb337978cefdd1bbcf018 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
package net.minecraft.network.protocol.game;
|
||||||
|
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
+
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
@@ -36,6 +38,23 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
|
||||||
|
return create(blockEntity, BlockEntity::getUpdateTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Handle large packets disconnecting client
|
||||||
|
+ @Override
|
||||||
|
+ public boolean hasLargePacketFallback() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) {
|
||||||
|
+ if (NbtUtility.isTooLarge(this.tag))
|
||||||
|
+ {
|
||||||
|
+ this.tag.getAllKeys().forEach(tag::remove);
|
||||||
|
+ }
|
||||||
|
+ manager.send(new ClientboundBlockEntityDataPacket(pos, this.type, this.tag));
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end - Handle large packets disconnecting client
|
||||||
|
+
|
||||||
|
public ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) {
|
||||||
|
this.pos = pos;
|
||||||
|
this.type = blockEntityType;
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||||
|
index 63f6a2437da9363786b55af0a7cbc5373232d35b..38e8e3e58821da896851a42d6088bc70857ae7e1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||||
|
@@ -43,6 +43,19 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
||||||
|
return GamePacketTypes.CLIENTBOUND_CONTAINER_SET_SLOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Handle large packets disconnecting client
|
||||||
|
+ @Override
|
||||||
|
+ public boolean hasLargePacketFallback() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) {
|
||||||
|
+ manager.send(new ClientboundContainerSetSlotPacket(this.containerId, this.stateId, this.slot, ItemStack.EMPTY));
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end - Handle large packets disconnecting client
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void handle(ClientGamePacketListener listener) {
|
||||||
|
listener.handleContainerSetSlot(this);
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
||||||
|
index 466dc69d8c06766733a6164fa5c911e902493a23..84f05afd07c23ffd34492b4c45344ccbfb66c2a9 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
|
||||||
|
@@ -36,6 +36,19 @@ public record ClientboundMapItemDataPacket(
|
||||||
|
this(mapId, scale, locked, decorations != null ? Optional.of(List.copyOf(decorations)) : Optional.empty(), Optional.ofNullable(updateData));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Handle large packets disconnecting client
|
||||||
|
+ @Override
|
||||||
|
+ public boolean hasLargePacketFallback() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) {
|
||||||
|
+ manager.send(new ClientboundMapItemDataPacket(mapId, scale, locked, Optional.empty(), Optional.empty()));
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end - Handle large packets disconnecting client
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public PacketType<ClientboundMapItemDataPacket> type() {
|
||||||
|
return GamePacketTypes.CLIENTBOUND_MAP_ITEM_DATA;
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java
|
||||||
|
index 37ab438ab37b9235666ae69376509bdde7722d87..b6cdadfbfe8756a3fd10b7a2d93da31701bc44e1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java
|
||||||
|
@@ -2,6 +2,8 @@ package net.minecraft.network.protocol.game;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
|
import net.minecraft.network.chat.ChatType;
|
||||||
|
@@ -39,6 +41,19 @@ public record ClientboundPlayerChatPacket(
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Handle large packets disconnecting client
|
||||||
|
+ @Override
|
||||||
|
+ public boolean hasLargePacketFallback() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) {
|
||||||
|
+ manager.send(new ClientboundPlayerChatPacket(sender, index, signature, body, Component.empty().append("** Message too large **").withStyle(ChatFormatting.RED), filterMask, chatType));
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end - Handle large packets disconnecting client
|
||||||
|
+
|
||||||
|
private void write(RegistryFriendlyByteBuf buf) {
|
||||||
|
buf.writeUUID(this.sender);
|
||||||
|
buf.writeVarInt(this.index);
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||||
|
index 3945ca04ede578121b370592482ac917f2d4cf96..f05678ab6fc598da0416c6e0c68bc30a1beef139 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||||
|
@@ -2,6 +2,8 @@ package net.minecraft.network.protocol.game;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.mojang.datafixers.util.Pair;
|
||||||
|
+
|
||||||
|
+import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
@@ -44,6 +46,19 @@ public class ClientboundSetEquipmentPacket implements Packet<ClientGamePacketLis
|
||||||
|
} while ((i & -128) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Handle large packets disconnecting client
|
||||||
|
+ @Override
|
||||||
|
+ public boolean hasLargePacketFallback() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean packetTooLarge(net.minecraft.network.Connection manager) {
|
||||||
|
+ manager.send(new ClientboundSetEquipmentPacket(entity, Collections.emptyList()));
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end - Handle large packets disconnecting client
|
||||||
|
+
|
||||||
|
private void write(RegistryFriendlyByteBuf buf) {
|
||||||
|
buf.writeVarInt(this.entity);
|
||||||
|
int i = this.slots.size();
|
@ -1,46 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Tue, 4 Jul 2023 18:49:34 -0300
|
|
||||||
Subject: [PATCH] Fix packet-related lag exploits
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
index 8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a..88c98ba7673808819b8f85876f22743bc3a4f471 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -865,7 +865,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
|
|
||||||
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
|
||||||
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
|
|
||||||
- } else {
|
|
||||||
+ } else if (this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
||||||
BaseCommandBlock commandblocklistenerabstract = null;
|
|
||||||
CommandBlockEntity tileentitycommand = null;
|
|
||||||
BlockPos blockposition = packet.getPos();
|
|
||||||
@@ -1013,7 +1013,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
@Override
|
|
||||||
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
||||||
- if (this.player.canUseGameMasterBlocks()) {
|
|
||||||
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
||||||
BlockPos blockposition = packet.getPos();
|
|
||||||
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
|
||||||
@@ -1071,7 +1071,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
@Override
|
|
||||||
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
||||||
- if (this.player.canUseGameMasterBlocks()) {
|
|
||||||
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
||||||
BlockPos blockposition = packet.getPos();
|
|
||||||
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
|
||||||
@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
@Override
|
|
||||||
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
||||||
- if (this.player.canUseGameMasterBlocks()) {
|
|
||||||
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
||||||
BlockPos blockposition = packet.getPos();
|
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Mon, 15 Apr 2024 23:40:27 -0500
|
|
||||||
Subject: [PATCH] Add depth limit to SNBT
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java
|
|
||||||
index c77860a141064aea6a0b510bb44d35fea90aee42..3be3dd61b8a27b3a8ca3c72ae5ffa2ea8fa00231 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
|
||||||
@@ -184,9 +184,47 @@ public class TagParser {
|
|
||||||
|
|
||||||
this.expect('}');
|
|
||||||
this.depth--; // Paper
|
|
||||||
- return compoundTag;
|
|
||||||
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag; // Scissors - Add depth limit to SNBT
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start - Add depth limit to SNBT
|
|
||||||
+ private boolean exceedsDepthLimit(Tag tag) {
|
|
||||||
+ return this.exceedsDepthLimit(0, tag);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private boolean exceedsDepthLimit(long depth, Tag tag) {
|
|
||||||
+ if (depth > 256) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (tag instanceof ListTag listTag) {
|
|
||||||
+ for (Tag childTag : listTag) {
|
|
||||||
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
|
||||||
+
|
|
||||||
+ if (returnValue) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ } else if (tag instanceof CompoundTag compoundTag) {
|
|
||||||
+ for (String key : compoundTag.getAllKeys()) {
|
|
||||||
+ Tag childTag = compoundTag.get(key);
|
|
||||||
+
|
|
||||||
+ if (childTag == null) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
|
||||||
+
|
|
||||||
+ if (returnValue) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
private Tag readListTag() throws CommandSyntaxException {
|
|
||||||
this.expect('[');
|
|
||||||
this.reader.skipWhitespace();
|
|
||||||
@@ -220,7 +258,7 @@ public class TagParser {
|
|
||||||
|
|
||||||
this.expect(']');
|
|
||||||
this.depth--; // Paper
|
|
||||||
- return listTag;
|
|
||||||
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -245,7 +283,7 @@ public class TagParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T extends Number> List<T> readArray(TagType<?> arrayTypeReader, TagType<?> typeReader) throws CommandSyntaxException {
|
|
||||||
- List<T> list = Lists.newArrayList();
|
|
||||||
+ List<Number> list = Lists.newArrayList(); // Scissors - List<T> -> List<Number>
|
|
||||||
|
|
||||||
while (this.reader.peek() != ']') {
|
|
||||||
int i = this.reader.getCursor();
|
|
||||||
@@ -257,11 +295,11 @@ public class TagParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeReader == ByteTag.TYPE) {
|
|
||||||
- list.add((T)(Byte)((NumericTag)tag).getAsByte()); // Paper - decompile fix
|
|
||||||
+ list.add(((NumericTag)tag).getAsByte()); // Scissors - Remove (T) cast
|
|
||||||
} else if (typeReader == LongTag.TYPE) {
|
|
||||||
- list.add((T)(Long)((NumericTag)tag).getAsLong()); // Paper - decompile fix
|
|
||||||
+ list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast
|
|
||||||
} else {
|
|
||||||
- list.add((T)(Integer)((NumericTag)tag).getAsInt()); // Paper - decompile fix
|
|
||||||
+ list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.hasElementSeparator()) {
|
|
||||||
@@ -274,7 +312,7 @@ public class TagParser {
|
|
||||||
}
|
|
||||||
|
|
||||||
this.expect(']');
|
|
||||||
- return list;
|
|
||||||
+ return (List<T>) list; // Scissors - Cast to List<T>
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasElementSeparator() {
|
|
@ -1,35 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Thu, 6 Jul 2023 23:01:12 +0100
|
|
||||||
Subject: [PATCH] Mute invalid attributes
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
|
||||||
index b99a080ab27e24d8131fda931ca70d6d271bb01c..f88b31d9bfc8b332230fa318ba2c1de14d5cc9be 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
|
||||||
@@ -135,7 +135,10 @@ public class AttributeMap {
|
|
||||||
if (attributeInstance != null) {
|
|
||||||
attributeInstance.load(compoundTag);
|
|
||||||
}
|
|
||||||
- }, () -> LOGGER.warn("Ignoring unknown attribute '{}'", string));
|
|
||||||
+
|
|
||||||
+ }, () -> {
|
|
||||||
+ // LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string); // Scissors - Mute invalid attributes
|
|
||||||
+ });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
|
||||||
index a38e91552ead256bd8dd3b74794d742555681c2d..116af10e6e2467a3e3b0095c4968a79ebb4a19d6 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
|
||||||
@@ -90,7 +90,7 @@ public class AttributeModifier {
|
|
||||||
AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation"));
|
|
||||||
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
|
|
||||||
} catch (Exception var3) {
|
|
||||||
- LOGGER.warn("Unable to create attribute: {}", var3.getMessage());
|
|
||||||
+ // LOGGER.warn("Unable to create attribute: {}", var3.getMessage()); // Scissors - Mute invalid attributes
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Tue, 23 Jan 2024 19:01:02 -0600
|
|
||||||
Subject: [PATCH] Change version fetcher to AMG
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
|
||||||
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..48dd50d0e443a59835e92616874c9856c7cbc401 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
|
||||||
@@ -4,6 +4,7 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
import com.google.gson.*;
|
|
||||||
+import io.papermc.paper.util.JarManifests; // Scissors
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
@@ -16,11 +17,12 @@ import java.io.*;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.stream.StreamSupport;
|
|
||||||
+import org.bukkit.Bukkit; // Scissors
|
|
||||||
|
|
||||||
public class PaperVersionFetcher implements VersionFetcher {
|
|
||||||
private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
|
|
||||||
- private static final String GITHUB_BRANCH_NAME = "master";
|
|
||||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
|
|
||||||
+ private static final String GITHUB_BRANCH_NAME = getBranch(); // Scissors
|
|
||||||
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME; // Scissors
|
|
||||||
private static @Nullable String mcVer;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -31,8 +33,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
|
||||||
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
|
|
||||||
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
|
||||||
+ String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]"); // Scissors
|
|
||||||
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]); // Scissors
|
|
||||||
final Component history = getHistory();
|
|
||||||
|
|
||||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
|
||||||
@@ -54,15 +56,24 @@ public class PaperVersionFetcher implements VersionFetcher {
|
|
||||||
return mcVer;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start - Allow getting git information
|
|
||||||
+ public static String getCommit() {
|
|
||||||
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
|
||||||
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static String getBranch() {
|
|
||||||
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
|
||||||
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch");
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
private static Component getUpdateStatusMessage(@Nonnull String repo, @Nonnull String branch, @Nonnull String versionInfo) {
|
|
||||||
int distance;
|
|
||||||
- try {
|
|
||||||
- int jenkinsBuild = Integer.parseInt(versionInfo);
|
|
||||||
- distance = fetchDistanceFromSiteApi(jenkinsBuild, getMinecraftVersion());
|
|
||||||
- } catch (NumberFormatException ignored) {
|
|
||||||
- versionInfo = versionInfo.replace("\"", "");
|
|
||||||
- distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
|
||||||
- }
|
|
||||||
+ // Scissors start - always use Git for version checking
|
|
||||||
+ versionInfo = getCommit();
|
|
||||||
+ distance = fetchDistanceFromGitHub(repo, branch, versionInfo);
|
|
||||||
+ // Scissors end
|
|
||||||
|
|
||||||
switch (distance) {
|
|
||||||
case -1:
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
||||||
index c0538206a53f0e6d9b54bddde0259b89ac73d675..5ebb80ed81d9bbd4c69a14ccd0be6c67de2fcf0d 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
|
||||||
@@ -315,7 +315,7 @@ public class Main {
|
|
||||||
if (buildDate.before(deadline.getTime())) {
|
|
||||||
// Paper start - This is some stupid bullshit
|
|
||||||
System.err.println("*** Warning, you've not updated in a while! ***");
|
|
||||||
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
|
|
||||||
+ System.err.println("*** Please download a new build as per instructions from https://ci.scissors.gg/job/Scissors ***"); // Paper
|
|
||||||
//System.err.println("*** Server will start in 20 seconds ***");
|
|
||||||
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
|
||||||
// Paper end
|
|
Reference in New Issue
Block a user