mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 15:18:35 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e0076376d0 | |||
15eb4f1a10 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -50,5 +50,3 @@ Scissors-Server
|
|||||||
Scissors-API
|
Scissors-API
|
||||||
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
paper-api-generator
|
|
||||||
|
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -14,12 +14,12 @@ pipeline {
|
|||||||
stage('paperclipJar') {
|
stage('paperclipJar') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
sh './gradlew createMojmapBundlerJar --no-daemon --refresh-dependencies'
|
sh './gradlew createReobfPaperclipJar --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
sh """
|
sh """
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
BRANCH=\$(echo "\${BRANCH_NAME}" | sed 's/\\//_/g')
|
mv \${WORKSPACE}/build/libs/Scissors-paperclip-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH_NAME}-\${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,4 +39,4 @@ pipeline {
|
|||||||
cleanWs()
|
cleanWs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,5 @@ should submit a pull request to this project to add their name.
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
Allink (allinkdev) <arclicious@vivaldi.net>
|
Allink (allinkdev) <arclicious@vivaldi.net>
|
||||||
Luna (LunaWasFlaggedAgain) <lunahatesgogle@gmail.com>
|
|
||||||
Telesphoreo <me@telesphoreo.me>
|
Telesphoreo <me@telesphoreo.me>
|
||||||
```
|
```
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.20.6/)
|
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.20/)
|
||||||
|
|
||||||
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.6)
|
### [Scissors Javadoc](https://javadoc.scissors.gg/1.20)
|
||||||
### [Scissors Announcements](https://totalfreedom.tf/forums/scissors-announcements.55)
|
### [Scissors Announcements](https://totalfreedom.me/forum/board/139)
|
||||||
### [Scissors General Discussion](https://totalfreedom.tf/forums/scissors-discussion.56/)
|
### [Scissors General Discussion](https://totalfreedom.me/forum/board/140)
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
```
|
```
|
||||||
|
@ -7,4 +7,10 @@
|
|||||||
# datafixerupper com/mojang/datafixers/util/Either.java
|
# datafixerupper com/mojang/datafixers/util/Either.java
|
||||||
# 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
|
||||||
|
|
||||||
|
## Used in Scissors 1.19
|
||||||
|
#minecraft net/minecraft/world/ContainerHelper
|
||||||
|
#minecraft net/minecraft/network/chat/contents/NbtContents
|
||||||
|
#minecraft net/minecraft/network/chat/ComponentUtils
|
||||||
|
#minecraft net/minecraft/network/chat/contents/EntityDataSource
|
@ -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.7.1"
|
id("io.papermc.paperweight.patcher") version "1.5.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||||
@ -15,9 +15,9 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
|
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||||
decompiler("org.vineflower:vineflower:1.10.1")
|
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||||
paperclip("io.papermc:paperclip:3.0.4-SNAPSHOT")
|
paperclip("io.papermc:paperclip:3.0.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@ -26,7 +26,7 @@ allprojects {
|
|||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(21))
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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(21)
|
options.release.set(17)
|
||||||
}
|
}
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc> {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
@ -65,21 +65,13 @@ paperweight {
|
|||||||
|
|
||||||
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
||||||
serverOutputDir.set(layout.projectDirectory.dir("Scissors-Server"))
|
serverOutputDir.set(layout.projectDirectory.dir("Scissors-Server"))
|
||||||
|
|
||||||
patchTasks {
|
|
||||||
register("generatedApi") {
|
|
||||||
isBareDirectory.set(true)
|
|
||||||
upstreamDirPath.set("paper-api-generator/generated")
|
|
||||||
patchDir.set(layout.projectDirectory.dir("patches/generatedApi"))
|
|
||||||
outputDir.set(layout.projectDirectory.dir("paper-api-generator/generated"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,10 +1,9 @@
|
|||||||
group=me.totalfreedom.scissors
|
group=me.totalfreedom.scissors
|
||||||
version=1.20.6-R0.1-SNAPSHOT
|
version=1.20-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion=1.20.6
|
mcVersion=1.20
|
||||||
paperRef=e41d44fa873466064879ebed476d280932379a9c
|
paperRef=de19eb8c4a490ff4f427e9ad8b8bbe181c368cc1
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.vfs.watch=false
|
org.gradle.vfs.watch=false
|
||||||
org.gradle.jvmargs=-Xmx4096m
|
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,7 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
29
gradlew
vendored
29
gradlew
vendored
@ -83,8 +83,10 @@ done
|
|||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@ -131,13 +133,10 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
if ! command -v java >/dev/null 2>&1
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
then
|
|
||||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC2039,SC3045
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC2039,SC3045
|
# shellcheck disable=SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@ -198,15 +197,11 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
# Collect all arguments for the java command:
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
||||||
# and any embedded shellness will be escaped.
|
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
||||||
# treated as '${Hostname}' itself on the command line.
|
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add MasterBlockFireEvent
|
|||||||
|
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..812e6ae9f1c8eb9558e5109c522d3ce3a7deb35c
|
index 0000000000000000000000000000000000000000..a24cb52a5af62012c5d5acc29e4c3558e92ae572
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
@@ -0,0 +1,51 @@
|
@@ -0,0 +1,51 @@
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add spectator teleport event
|
|||||||
|
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..e4c9256c78f8b395aea86e9ea1a112f8e7426c1f
|
index 0000000000000000000000000000000000000000..d7efa63c316ed99c3eccfeadc1b0873b2ccb5d8a
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
@@ -0,0 +1,60 @@
|
@@ -0,0 +1,60 @@
|
||||||
|
@ -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 30cbe3bdc7142769019765b03cc4fe1f9ba1ddb4..d1f5766f2b021df282b929457a27d09f7c21a21e 100644
|
index 1d1a1d087dabc9794e0062a064da2cced4062309..1770de3705aa14232b133bce9fac56dfe89faa37 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
|
||||||
@@ -2257,6 +2257,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -1994,6 +1994,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
|
@ -1,28 +1,31 @@
|
|||||||
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: Fri, 14 Jun 2024 17:38:20 -0500
|
Date: Wed, 27 Jul 2022 22:09:00 -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 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..b0e9bf22d546110d995b5625ce8ed22501992679 100644
|
index a3a76b9b7efa773117d2ee1ce53ef784b09b277d..fad5e021f1282cd478f6ce484edbc135494b81b3 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
@@ -7,8 +7,10 @@ plugins {
|
||||||
val alsoShade: Configuration by configurations.creating
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
- implementation(project(":paper-api"))
|
- implementation(project(":paper-api"))
|
||||||
+ implementation(project(":Scissors-API")) // Scissors
|
- implementation(project(":paper-mojangapi"))
|
||||||
|
+ implementation(project(":Scissors-API"))
|
||||||
|
+ implementation("io.papermc.paper:paper-mojangapi:1.20-R0.1-SNAPSHOT") {
|
||||||
|
+ exclude("io.papermc.paper", "paper-api")
|
||||||
|
+ }
|
||||||
// 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")
|
||||||
@@ -77,17 +77,25 @@ tasks.jar {
|
@@ -58,11 +60,17 @@ tasks.jar {
|
||||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||||
val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
|
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$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
|
|
||||||
+ var gitBranch: String;
|
+ var gitBranch: String;
|
||||||
+ if (System.getenv("JENKINS_URL") == null)
|
+ if (System.getenv("JENKINS_URL") == null)
|
||||||
+ {
|
+ {
|
||||||
@ -30,30 +33,20 @@ index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..b0e9bf22d546110d995b5625ce8ed225
|
|||||||
+ } else {
|
+ } else {
|
||||||
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "Paper",
|
"Implementation-Title" to "CraftBukkit",
|
||||||
"Implementation-Version" to implementationVersion,
|
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||||
|
+ "Implementation-Version" to "git-Scissors-$implementationVersion",
|
||||||
"Implementation-Vendor" to date, // Paper
|
"Implementation-Vendor" to date, // Paper
|
||||||
- "Specification-Title" to "Paper",
|
"Specification-Title" to "Bukkit",
|
||||||
+ "Specification-Title" to "Scissors",
|
|
||||||
"Specification-Version" to project.version,
|
"Specification-Version" to project.version,
|
||||||
- "Specification-Vendor" to "Paper Team",
|
@@ -134,7 +142,7 @@ fun TaskContainer.registerRunTask(
|
||||||
- "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) {
|
||||||
- group = "paper"
|
- group = "paper"
|
||||||
+ group = "paperweight" // Scissors
|
+ group = "paperweight"
|
||||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||||
standardInput = System.`in`
|
standardInput = System.`in`
|
||||||
workingDir = rootProject.layout.projectDirectory
|
workingDir = rootProject.layout.projectDirectory
|
||||||
@ -97,8 +90,34 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..2fbb5fc19e6d7f3767c7c6eedcbc6af2
|
|||||||
.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 fb82bb52f219e7683fe1d3c0fb3acbe2251de8d4..0f9928bf68f8bc5abfe02f41c98c63888987d9b9 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -1681,7 +1681,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
public String getServerModName() {
|
||||||
|
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||||
|
+ return "Scissors"; // Scissors - Scissors > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||||
|
}
|
||||||
|
|
||||||
|
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 aefbb6a3f49a74a4c8fd004aa6a4ab1ab907e878..777b727a360683a72cef8c06ab7ab1439d69ac0a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -262,7 +262,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..5e6cce78e7987b4aa1c0052262ab8c4563905372 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||||
@ -106,7 +125,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..741c76c4dfa0bb34cc23bd795c194bde
|
|||||||
String result = "Unknown-Version";
|
String result = "Unknown-Version";
|
||||||
|
|
||||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/me.totalfreedom.scissors/Scissors-API/pom.properties"); // Scissors
|
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/me.totalfreedom.scissors/Scissors-API/pom.properties");
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 22:25:38 -0600
|
||||||
|
Subject: [PATCH] Return null when a show_entity hover event's UUID isn't valid
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
@@ -174,7 +174,14 @@ public class HoverEvent {
|
||||||
|
} else {
|
||||||
|
JsonObject jsonObject = json.getAsJsonObject();
|
||||||
|
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
|
||||||
|
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
||||||
|
+ // Scissors start
|
||||||
|
+ UUID uUID;
|
||||||
|
+ try {
|
||||||
|
+ uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
|
||||||
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
||||||
|
}
|
||||||
|
@@ -186,7 +193,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")));
|
||||||
|
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
||||||
|
+ // Scissors start
|
||||||
|
+ UUID uUID;
|
||||||
|
+ try {
|
||||||
|
+ uUID = UUID.fromString(compoundTag.getString("id"));
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
||||||
|
} catch (Exception var5) {
|
||||||
|
return null;
|
@ -1,26 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Sun, 5 May 2024 12:16:30 -0500
|
|
||||||
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
|
|
||||||
index 1a958f994365eb8f2e010d703046fb73e04b66e4..d8de9ec38f5e5b10c177895728815d8659d0b601 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
||||||
@@ -171,7 +171,14 @@ public class HoverEvent {
|
|
||||||
DynamicOps<JsonElement> dynamicOps = (DynamicOps<JsonElement>)(ops != null ? ops.withParent(JsonOps.INSTANCE) : JsonOps.INSTANCE);
|
|
||||||
DataResult<Component> dataResult = ComponentSerialization.CODEC.parse(dynamicOps, JsonParser.parseString(compoundTag.getString("name")));
|
|
||||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
|
||||||
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
|
||||||
+ // Scissors start
|
|
||||||
+ UUID uUID;
|
|
||||||
+ try {
|
|
||||||
+ uUID = UUID.fromString(compoundTag.getString("id"));
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return dataResult.map(textx -> new HoverEvent.EntityTooltipInfo(entityType, uUID, textx));
|
|
||||||
} catch (Exception var7) {
|
|
||||||
return DataResult.error(() -> "Failed to parse tooltip: " + var7.getMessage());
|
|
@ -0,0 +1,46 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Fri, 10 Jun 2022 22:55:01 -0500
|
||||||
|
Subject: [PATCH] Fixes invalid LootTables causing problems when applied to
|
||||||
|
Minecart entities
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
|
index d4a8c1bbb8fef27ac42bdf27dde495b4c649e6cb..865c61accf211d28be3c82dcf158fec9778b50c1 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/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||||
|
index b9f0dae1ec96194fe78c086b63d8a18b1d0cfcf7..bdc49a9965fd3add3dfca31fb0517c14597fb076 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||||
|
@@ -46,7 +46,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||||
|
protected boolean tryLoadLootTable(CompoundTag nbt) {
|
||||||
|
this.lootableData.loadNbt(nbt); // Paper
|
||||||
|
if (nbt.contains("LootTable", 8)) {
|
||||||
|
- this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
||||||
|
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors - Validate loot tables
|
||||||
|
try { org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.lootTable); } catch (IllegalArgumentException ex) { this.lootTable = null; } // Paper - validate
|
||||||
|
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
||||||
|
return false; // Paper - always load the items, table may still remain
|
@ -1,40 +0,0 @@
|
|||||||
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) {
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Sun, 13 Mar 2022 06:10:22 -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 41c9f074203915c31c1ae7a160ce509c13383f84..79a7fff759f062b783a540079cb43f2942799715 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;
|
||||||
|
@@ -370,6 +371,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;
|
||||||
|
+ }
|
||||||
|
+ // Scissor end
|
||||||
|
+
|
||||||
|
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
||||||
|
|
||||||
|
this.stored.add(tileentitybeehive_hivebee);
|
@ -1,45 +0,0 @@
|
|||||||
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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
31
patches/server/0005-Fixes-the-Blank-SkullOwner-exploit.patch
Normal file
31
patches/server/0005-Fixes-the-Blank-SkullOwner-exploit.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Fri, 22 Apr 2022 00:59:00 -0500
|
||||||
|
Subject: [PATCH] Fixes the Blank SkullOwner exploit
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||||
|
index deed77a3d44bc55681483d7f47f148b5220135f2..053cb78362006a94ee0d82b9b1f665c5f86a4458 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||||
|
@@ -11,6 +11,9 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.NbtUtils;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
||||||
|
+// Scissors start
|
||||||
|
+import org.apache.commons.lang3.StringUtils;
|
||||||
|
+// Scissors end
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
@@ -73,7 +76,9 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||||
|
|
||||||
|
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||||
|
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT)));
|
||||||
|
- } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) {
|
||||||
|
+ // Scissors start
|
||||||
|
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) {
|
||||||
|
+ // Scissors end
|
||||||
|
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
||||||
|
}
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Fri, 10 Jun 2022 23:26:03 -0500
|
||||||
|
Subject: [PATCH] Removes useless spammy error logging
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
index 4caf272f065a681bd7101d52fedf2642cc78d3bc..af5a1111a06789e1401f8c60bb4c8838587f2376 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
@@ -1798,8 +1798,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
|
resource = CraftNamespacedKey.fromMinecraft(key);
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
- org.bukkit.Bukkit.getLogger().warning("Namespaced resource does not validate: " + key.toString());
|
||||||
|
- ex.printStackTrace();
|
||||||
|
+ // Scissors - Don't log errors thrown by invalid namespaces when an error is thrown
|
||||||
|
}
|
||||||
|
|
||||||
|
return resource;
|
@ -1,28 +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, 5 May 2024 12:32:55 -0500
|
Date: Thu, 8 Jun 2023 19:19:37 -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 9549eee0d92f322bd5232abd7e695213660c2e22..94a689e1adf24f6385dc97eb5cc3790c8e14da97 100644
|
index 272095d7a09ab41227d741172735f66fd2798ce1..ea966ea94062be3ed9b6b2c460a316378c016fa7 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
|
||||||
@@ -142,8 +142,14 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -139,7 +139,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
@Override
|
@Override
|
||||||
public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
public void remove(Entity.RemovalReason reason) {
|
||||||
// CraftBukkit end
|
if (!this.level().isClientSide && reason.shouldDestroy()) {
|
||||||
- if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) {
|
|
||||||
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||||
+ if (!this.level().isClientSide && entity_removalreason.shouldDestroy())
|
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
||||||
+ {
|
|
||||||
+ // 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
|
||||||
}
|
}
|
||||||
|
|
||||||
super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause
|
super.remove(reason);
|
@ -0,0 +1,28 @@
|
|||||||
|
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 3d41dbe0285f8fec8adae1e93010cf464df9b08c..7ee2c5beaaca9deb61589074f55e4004d1dd76b5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
|
@@ -420,11 +420,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||||
|
|
||||||
|
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||||
|
|
||||||
|
- this.setItem(ItemStack.of(nbttagcompound1));
|
||||||
|
- if (this.getItem().isEmpty()) {
|
||||||
|
+ // Scissors start
|
||||||
|
+ ItemStack item = ItemStack.of(nbttagcompound1);
|
||||||
|
+ if (item.isEmpty()) {
|
||||||
|
this.discard();
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ this.setItem(item);
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
@ -1,133 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Wed, 8 May 2024 12:15:48 -0500
|
|
||||||
Subject: [PATCH] Better handling of invalid JSON components
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
index 6dcade427f19771b08e04cfa036dedcfac30b5cd..3b075dcb6bda40b278296fc8750f2af90c13acc4 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
@@ -23,6 +23,8 @@ import java.util.List;
|
|
||||||
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
|
|
||||||
+ @Nullable
|
|
||||||
+ public static MutableComponent fromJsonSafe(String json, HolderLookup.Provider registries) {
|
|
||||||
+ try {
|
|
||||||
+ return fromJson(json, registries);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Nullable
|
|
||||||
+ public static MutableComponent fromJsonSafe(JsonElement json, HolderLookup.Provider registries) {
|
|
||||||
+ try {
|
|
||||||
+ return fromJson(json, registries);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
@Nullable
|
|
||||||
public static MutableComponent fromJsonLenient(String json, HolderLookup.Provider registries) {
|
|
||||||
JsonReader jsonreader = new JsonReader(new StringReader(json));
|
|
||||||
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 df26c39a2bb20e2021b50211dce905483a77f4e6..0b85d5aef65fdb08c1c11f0ebb973078b57e5773 100644
|
|
||||||
--- a/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 {
|
|
||||||
);
|
|
||||||
return stream.flatMap(text -> {
|
|
||||||
try {
|
|
||||||
- MutableComponent mutableComponent = Component.Serializer.fromJson(text, source.registryAccess());
|
|
||||||
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text, source.registryAccess()); // Scissors
|
|
||||||
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
|
|
||||||
} catch (Exception var5x) {
|
|
||||||
- LOGGER.warn("Failed to parse component: {}", text, var5x);
|
|
||||||
+ // Scissors - don't log
|
|
||||||
return Stream.of();
|
|
||||||
}
|
|
||||||
}).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
|
|
||||||
index 7ef9f67d27cc240191dd5d07e8dcf5fbdebe1049..6ee2d11e4f3fbc8424a2ffbe6a7ebd1832a25503 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -2602,12 +2602,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
||||||
this.setRot(this.getYRot(), this.getXRot());
|
|
||||||
if (nbt.contains("CustomName", 8)) {
|
|
||||||
String s = nbt.getString("CustomName");
|
|
||||||
-
|
|
||||||
- try {
|
|
||||||
- this.setCustomName(Component.Serializer.fromJson(s, this.registryAccess()));
|
|
||||||
- } catch (Exception exception) {
|
|
||||||
- Entity.LOGGER.warn("Failed to parse entity custom name {}", s, exception);
|
|
||||||
- }
|
|
||||||
+ this.setCustomName(Component.Serializer.fromJsonSafe(s, this.registryAccess())); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
index b679bbdfa307d3aa9f2f5e4c70c559695b2733de..4c195b56b956b31028c4f51453d6e9bf31cada0c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
|
||||||
@@ -42,7 +42,7 @@ public class ScoreboardSaveData extends SavedData {
|
|
||||||
CompoundTag compoundTag = nbt.getCompound(i);
|
|
||||||
String string = compoundTag.getString("Name");
|
|
||||||
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"), registries);
|
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName"), registries); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
if (component != null) {
|
|
||||||
playerTeam.setDisplayName(component);
|
|
||||||
}
|
|
||||||
@@ -60,14 +60,14 @@ public class ScoreboardSaveData extends SavedData {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
|
||||||
- Component component2 = Component.Serializer.fromJson(compoundTag.getString("MemberNamePrefix"), registries);
|
|
||||||
+ Component component2 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNamePrefix"), registries); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
if (component2 != null) {
|
|
||||||
playerTeam.setPlayerPrefix(component2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNameSuffix", 8)) {
|
|
||||||
- Component component3 = Component.Serializer.fromJson(compoundTag.getString("MemberNameSuffix"), registries);
|
|
||||||
+ Component component3 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNameSuffix"), registries); // Scissors - Use safer method for getting Components from JSON
|
|
||||||
if (component3 != null) {
|
|
||||||
playerTeam.setPlayerSuffix(component3);
|
|
||||||
}
|
|
||||||
@@ -124,7 +124,7 @@ public class ScoreboardSaveData extends SavedData {
|
|
||||||
return ObjectiveCriteria.DUMMY;
|
|
||||||
});
|
|
||||||
String string2 = compoundTag.getString("Name");
|
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"), registries);
|
|
||||||
+ 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"));
|
|
||||||
boolean bl = compoundTag.getBoolean("display_auto_update");
|
|
||||||
NumberFormat numberFormat = NumberFormatTypes.CODEC
|
|
@ -0,0 +1,50 @@
|
|||||||
|
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 b79f4ce38a42e4dba8ebdfc97dadc531b7245c7a..9c49be7c53a1f2a8c203341b8ded9cd222d0c178 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<? extends Recipe<?>> optional = recipeManager.byKey(new ResourceLocation(string));
|
||||||
|
+ Optional<? extends Recipe<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
|
||||||
|
if (!optional.isPresent()) {
|
||||||
|
- LOGGER.error("Invalid recipe: {}", (Object)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: {}", (Object)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 50fdb086ffec84edc5138737c95f08ed4757a6f3..bb0f673a619810850df0d78bb4abd9d7c49ecbe4 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
|
@@ -41,7 +41,12 @@ 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,28 +0,0 @@
|
|||||||
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);
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 22:46:24 -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 6dac24354192bea79a4b9eb721543110826790b2..b87999106b5068a243c064fa3c30968411996e2b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
@@ -231,7 +231,7 @@ public final class NbtUtils {
|
||||||
|
if (!nbt.contains("Name", 8)) {
|
||||||
|
return Blocks.AIR.defaultBlockState();
|
||||||
|
} else {
|
||||||
|
- ResourceLocation resourceLocation = new ResourceLocation(nbt.getString("Name"));
|
||||||
|
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState
|
||||||
|
Optional<? extends Holder<Block>> optional = blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation));
|
||||||
|
if (optional.isEmpty()) {
|
||||||
|
return Blocks.AIR.defaultBlockState();
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
|
index 5d6d26cfe8f0ab68a3145214b3fc126ca7a71a66..7e0559cdcabeb33ff383be1a23f4ed04fa091867 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
|
@@ -541,7 +541,7 @@ public abstract class AbstractArrow extends Projectile {
|
||||||
|
this.setCritArrow(nbt.getBoolean("crit"));
|
||||||
|
this.setPierceLevel(nbt.getByte("PierceLevel"));
|
||||||
|
if (nbt.contains("SoundEvent", 8)) {
|
||||||
|
- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
|
||||||
|
+ this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Scissors - Validate SoundEvents before trying to play them
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow"));
|
@ -1,39 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Wed, 8 May 2024 12:35:56 -0500
|
|
||||||
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
|
|
||||||
index 2750702cff35762bc817ffbe5bf81631e86bc49b..f69261dae717cbb3e7bc9f5e0767adc897f0388d 100644
|
|
||||||
--- a/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;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.advancements.critereon.NbtPredicate;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.commands.arguments.selector.EntitySelector;
|
|
||||||
import net.minecraft.commands.arguments.selector.EntitySelectorParser;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
+import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
|
||||||
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec(
|
|
||||||
@@ -39,7 +42,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
|
||||||
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
|
||||||
if (this.compiledSelector != null) {
|
|
||||||
List<? extends Entity> list = this.compiledSelector.findEntities(source);
|
|
||||||
- return list.stream().map(NbtPredicate::getEntityTagToCompare);
|
|
||||||
+ // Scissors start
|
|
||||||
+ Stream<? extends Entity> stream = list.stream();
|
|
||||||
+ if (ScissorsConfig.excludePlayersFromNbtComponents) stream = stream.filter((entity) -> !(entity instanceof Player));
|
|
||||||
+ return stream.map(NbtPredicate::getEntityTagToCompare);
|
|
||||||
+ // Scissors end
|
|
||||||
} else {
|
|
||||||
return Stream.empty();
|
|
||||||
}
|
|
@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Mon, 9 May 2022 23:40:59 -0500
|
||||||
|
Subject: [PATCH] Even more ResourceLocation validation and log spam fixes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
index fa724cd34a7c469ca12068e64295cd00ad215a3c..168b60fda38a7172f4473017ccc42447b36faab2 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
@@ -425,7 +425,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/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||||
|
index e49eece9bff3a53469673d03a7bbf8f9cf8776b8..a49f32e9649155b6af4b1f236e4e8142d730e7e8 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||||
|
@@ -30,8 +30,14 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- ResourceLocation key = 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 = 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 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf11cf046fb 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
@@ -33,8 +33,14 @@ 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 ex) {
|
||||||
|
+ 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 620d918e302a00d5a6640648e3096988d15535a0..ac6831248b7c4f25d48391432afb613f25d7e23a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
@@ -80,8 +80,18 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LootTable getLootTable() {
|
||||||
|
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
||||||
|
- return Bukkit.getLootTable(key);
|
||||||
|
+ if (this.getHandle().lootTable == null) {
|
||||||
|
+ this.getHandle().lootTable = this.getHandle().getDefaultLootTable();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // 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
|
@ -0,0 +1,41 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Sun, 20 Mar 2022 09:31:16 -0300
|
||||||
|
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 c0633f9553fb5aa52e8ffc863159521d09cb3bd5..7449a024265c42f28a6c9a1ed8d8f4b9e3096aac 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
@@ -314,7 +314,7 @@ public class HoverEvent {
|
||||||
|
CompoundTag compoundTag = TagParser.parseTag(string);
|
||||||
|
return new HoverEvent.ItemStackInfo(item, i, compoundTag);
|
||||||
|
} catch (CommandSyntaxException var6) {
|
||||||
|
- HoverEvent.LOGGER.warn("Failed to parse tag: {}", string, var6);
|
||||||
|
+ // Scissors - Ignore invalid items
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -328,7 +328,7 @@ public class HoverEvent {
|
||||||
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
||||||
|
return new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag));
|
||||||
|
} catch (CommandSyntaxException var2) {
|
||||||
|
- HoverEvent.LOGGER.warn("Failed to parse item tag: {}", text, var2);
|
||||||
|
+ // Scissors - Ignore invalid items
|
||||||
|
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 955316687e2e29ad75a0052317a7b0f89034c82a..2537c48d1269d8ea51222412b2eeaac26a7dc4d4 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
|
@@ -431,7 +431,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();
|
@ -1,142 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Wed, 8 May 2024 12:43:35 -0500
|
|
||||||
Subject: [PATCH] Limit string tag visitors to 1024 elements
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
|
||||||
index b45bb4ddf6b586ba1285db230e0bc3d1b5e447e8..4a46935cac263325a87a1b0bf32302839a75516e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
|
|
||||||
@@ -89,6 +89,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
|
||||||
public void visitByteArray(ByteArrayTag element) {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("[").append("B").append(";");
|
|
||||||
byte[] bs = element.getAsByteArray();
|
|
||||||
+ if (bs.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < bs.length; i++) {
|
|
||||||
stringBuilder.append(" ").append(bs[i]).append("B");
|
|
||||||
@@ -105,6 +106,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
|
||||||
public void visitIntArray(IntArrayTag element) {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("[").append("I").append(";");
|
|
||||||
int[] is = element.getAsIntArray();
|
|
||||||
+ if (is.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < is.length; i++) {
|
|
||||||
stringBuilder.append(" ").append(is[i]);
|
|
||||||
@@ -122,6 +124,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
|
||||||
String string = "L";
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("[").append("L").append(";");
|
|
||||||
long[] ls = element.getAsLongArray();
|
|
||||||
+ if (ls.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < ls.length; i++) {
|
|
||||||
stringBuilder.append(" ").append(ls[i]).append("L");
|
|
||||||
@@ -136,7 +139,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitList(ListTag element) {
|
|
||||||
- if (element.isEmpty()) {
|
|
||||||
+ if (element.isEmpty() || element.size() > 1024) { // Scissors
|
|
||||||
this.result = "[]";
|
|
||||||
} else {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("[");
|
|
||||||
@@ -166,7 +169,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitCompound(CompoundTag compound) {
|
|
||||||
- if (compound.isEmpty()) {
|
|
||||||
+ if (compound.isEmpty() || compound.size() > 1024) { // Scissors
|
|
||||||
this.result = "{}";
|
|
||||||
} else {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("{");
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/StringTagVisitor.java b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
|
||||||
index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f769517b33058a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
|
|
||||||
@@ -53,6 +53,7 @@ public class StringTagVisitor implements TagVisitor {
|
|
||||||
public void visitByteArray(ByteArrayTag element) {
|
|
||||||
this.builder.append("[B;");
|
|
||||||
byte[] bs = element.getAsByteArray();
|
|
||||||
+ if (bs.length > 1024) { this.builder.append(']'); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < bs.length; i++) {
|
|
||||||
if (i != 0) {
|
|
||||||
@@ -69,6 +70,7 @@ public class StringTagVisitor implements TagVisitor {
|
|
||||||
public void visitIntArray(IntArrayTag element) {
|
|
||||||
this.builder.append("[I;");
|
|
||||||
int[] is = element.getAsIntArray();
|
|
||||||
+ if (is.length > 1024) { this.builder.append(']'); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < is.length; i++) {
|
|
||||||
if (i != 0) {
|
|
||||||
@@ -85,6 +87,7 @@ public class StringTagVisitor implements TagVisitor {
|
|
||||||
public void visitLongArray(LongArrayTag element) {
|
|
||||||
this.builder.append("[L;");
|
|
||||||
long[] ls = element.getAsLongArray();
|
|
||||||
+ if (ls.length > 1024) { this.builder.append(']'); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < ls.length; i++) {
|
|
||||||
if (i != 0) {
|
|
||||||
@@ -100,6 +103,7 @@ public class StringTagVisitor implements TagVisitor {
|
|
||||||
@Override
|
|
||||||
public void visitList(ListTag element) {
|
|
||||||
this.builder.append('[');
|
|
||||||
+ if (element.size() > 1024) { this.builder.append(']'); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < element.size(); i++) {
|
|
||||||
if (i != 0) {
|
|
||||||
@@ -116,6 +120,7 @@ public class StringTagVisitor implements TagVisitor {
|
|
||||||
public void visitCompound(CompoundTag compound) {
|
|
||||||
this.builder.append('{');
|
|
||||||
List<String> list = Lists.newArrayList(compound.getAllKeys());
|
|
||||||
+ if (list.size() > 1024) { this.builder.append('}'); return; } // Scissors
|
|
||||||
Collections.sort(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
|
|
||||||
index 6644359d68706b7c3af2f782c33f930387c221d7..b76cd0ff6f60d83da8754ef788bc0e669b8b4f9c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
|
||||||
@@ -105,6 +105,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
|
||||||
Component component = Component.literal("B").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
|
||||||
byte[] bs = element.getAsByteArray();
|
|
||||||
+ if (bs.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < bs.length; i++) {
|
|
||||||
MutableComponent mutableComponent2 = Component.literal(String.valueOf(bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
|
||||||
@@ -123,6 +124,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
|
||||||
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
|
||||||
int[] is = element.getAsIntArray();
|
|
||||||
+ if (is.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < is.length; i++) {
|
|
||||||
mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER));
|
|
||||||
@@ -140,6 +142,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
|
||||||
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
|
|
||||||
MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
|
|
||||||
long[] ls = element.getAsLongArray();
|
|
||||||
+ if (ls.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
|
|
||||||
|
|
||||||
for (int i = 0; i < ls.length; i++) {
|
|
||||||
Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
|
||||||
@@ -155,7 +158,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitList(ListTag element) {
|
|
||||||
- if (element.isEmpty()) {
|
|
||||||
+ if (element.isEmpty() || element.size() > 1024) { // Scissors
|
|
||||||
this.result = Component.literal("[]");
|
|
||||||
} else if (this.depth >= 64) {
|
|
||||||
this.result = Component.literal("[").append(TOO_DEEP).append("]");
|
|
||||||
@@ -202,7 +205,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitCompound(CompoundTag compound) {
|
|
||||||
- if (compound.isEmpty()) {
|
|
||||||
+ if (compound.isEmpty() || compound.size() > 1024) { // Scissors
|
|
||||||
this.result = Component.literal("{}");
|
|
||||||
} else if (this.depth >= 64) {
|
|
||||||
this.result = Component.literal("{").append(TOO_DEEP).append("}");
|
|
@ -0,0 +1,54 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 23:02:48 -0600
|
||||||
|
Subject: [PATCH] Even more resource location validation
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
index db3cddf8b227453c9b08e481b21101c5d2e0472d..77ae3bc5fd6cf34aae7bd3baa563f3e23e57de26 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
@@ -145,7 +145,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPotionType(String string) {
|
||||||
|
- this.setPotion(BuiltInRegistries.POTION.get(new ResourceLocation(string)));
|
||||||
|
+ this.setPotion(BuiltInRegistries.POTION.get(ResourceLocation.tryParse(string))); // Scissors - Validate resource locations
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..ffcb77755b28bcdb3eae981fc735e6dde664bb6e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
@@ -588,7 +588,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
|
}), (entity) -> {
|
||||||
|
entity.load(nbt);
|
||||||
|
}, () -> {
|
||||||
|
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||||
|
+ /*EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));*/ // Scissors - Don't log invalid entities
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -607,7 +607,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Optional<EntityType<?>> by(CompoundTag nbt) {
|
||||||
|
- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
|
||||||
|
+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..b0c953ad8275740679c847e348b311de93d64965 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
@@ -618,7 +618,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||||
|
|
||||||
|
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
|
||||||
|
if (nbt.contains("DeathLootTable", 8)) {
|
||||||
|
- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable"));
|
||||||
|
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable"));
|
||||||
|
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
|
||||||
|
}
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Wed, 8 May 2024 12:46:29 -0500
|
|
||||||
Subject: [PATCH] Fixes creative-killing potion effects and certain potion
|
|
||||||
effect overflows
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
|
||||||
index b95afa9f6b7cf6c522ff5ec278adec7a9a851e9a..3f65f24936cdf3379e39bab3cd8bd46aacd95518 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
|
||||||
@@ -15,6 +15,10 @@ class HealOrHarmMobEffect extends InstantenousMobEffect {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applyEffectTick(LivingEntity entity, int amplifier) {
|
|
||||||
+ // 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 false;
|
|
||||||
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
|
||||||
+ // Scissors end
|
|
||||||
if (this.isHarm == entity.isInvertedHealAndHarm()) {
|
|
||||||
entity.heal((float) Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
|
|
||||||
} else {
|
|
||||||
@@ -28,6 +32,11 @@ class HealOrHarmMobEffect extends InstantenousMobEffect {
|
|
||||||
public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) {
|
|
||||||
int j;
|
|
||||||
|
|
||||||
+ // 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;
|
|
||||||
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
if (this.isHarm == target.isInvertedHealAndHarm()) {
|
|
||||||
j = (int) (proximity * (double) (4 << amplifier) + 0.5D);
|
|
||||||
target.heal((float) j, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
|
|
91
patches/server/0014-Change-version-fetcher-to-AMG.patch
Normal file
91
patches/server/0014-Change-version-fetcher-to-AMG.patch
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Fri, 7 Apr 2023 15:35:35 -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 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..0a8fda6939152d393f07e5d2812409ad38855646 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
|
@@ -4,11 +4,13 @@ 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;
|
||||||
|
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 net.kyori.adventure.text.TextComponent;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
@@ -19,8 +21,8 @@ import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
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();
|
||||||
|
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME;
|
||||||
|
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]");
|
||||||
|
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]);
|
||||||
|
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 bfa091f72d6f477bcaf63d364639a1b4df9b1987..1fe26cb620e8b550790c3e110e2a1180cf0838fd 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -292,7 +292,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 from https://ci.scissors.gg/job/Scissors ***"); // Scissors > // Paper
|
||||||
|
//System.err.println("*** Server will start in 20 seconds ***");
|
||||||
|
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
||||||
|
// Paper End
|
@ -0,0 +1,28 @@
|
|||||||
|
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 af5a1111a06789e1401f8c60bb4c8838587f2376..bfcdc18f9b06023a5c461e06abbb93eea32bcdba 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
|
@@ -46,6 +46,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;
|
||||||
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
@@ -485,7 +486,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
|
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
||||||
|
|
||||||
|
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
||||||
|
- if (attributeName == null || attributeName.isEmpty()) {
|
||||||
|
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Wed, 30 Mar 2022 02:01:55 -0600
|
||||||
|
Subject: [PATCH] Validate String UUIDs during the CompoundTag -> GameProfile
|
||||||
|
conversion process
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
index b87999106b5068a243c064fa3c30968411996e2b..596baf1bc372875b8b82904d9d5bd53f4bedc0fb 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
@@ -78,7 +78,12 @@ public final class NbtUtils {
|
||||||
|
}
|
||||||
|
// Paper start - support string UUID's
|
||||||
|
if (nbt.contains("Id", 8)) {
|
||||||
|
- uUID = UUID.fromString(nbt.getString("Id"));
|
||||||
|
+ // Scissors start - Validate String UUIDs in game profiles
|
||||||
|
+ try {
|
||||||
|
+ uUID = UUID.fromString(nbt.getString("Id"));
|
||||||
|
+ } catch (Exception ignored) {
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Sat, 9 Apr 2022 13:00:27 -0600
|
||||||
|
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
|
||||||
|
index 8a6799b50062c1b7b141ee1568dc523f9ee7ecfd..e5a2bb129100f0f935c8f10682204e7cb6277142 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
|
@@ -11,6 +11,7 @@ import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||||
|
import net.minecraft.commands.arguments.selector.EntitySelectorParser;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
+import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
||||||
|
public EntityDataSource(String rawPath) {
|
||||||
|
@@ -31,7 +32,7 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
||||||
|
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
||||||
|
if (this.compiledSelector != null) {
|
||||||
|
List<? extends Entity> list = this.compiledSelector.findEntities(source);
|
||||||
|
- return list.stream().map(NbtPredicate::getEntityTagToCompare);
|
||||||
|
+ return list.stream().filter((entity) -> !(entity instanceof Player)).map(NbtPredicate::getEntityTagToCompare); // Scissors - Don't query NBT from players
|
||||||
|
} else {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
18
patches/server/0018-Limit-ListTags-to-1024-elements.patch
Normal file
18
patches/server/0018-Limit-ListTags-to-1024-elements.patch
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 8 Apr 2022 23:38:12 -0300
|
||||||
|
Subject: [PATCH] Limit ListTags to 1024 elements
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||||
|
index 749d3e67a877d7d1ed47b5fef511a604ee6589b6..fe7a7fd77c7dd1750144fb57e181c51ccda26329 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/ListTag.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||||
|
@@ -31,6 +31,7 @@ public class ListTag extends CollectionTag<Tag> {
|
||||||
|
list.add(tagType.load(dataInput, i + 1, nbtAccounter));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if(j > 1024) return new ListTag(Lists.newArrayListWithCapacity(0), b);
|
||||||
|
return new ListTag(list, b);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Mon, 11 Apr 2022 13:33:52 -0600
|
||||||
|
Subject: [PATCH] Fixes creative-killing potion effects and certain potion
|
||||||
|
effect overflows
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||||
|
index 2cc714585fc3790b70a7ad1ab8034543462e2b3b..2d3706d8d0dbed3b3588066eaa6b9ce1b266294f 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||||
|
@@ -58,6 +58,7 @@ public class MobEffect {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
||||||
|
+ boolean god = entity instanceof Player player && (player.isCreative() || player.isInvulnerable()); // Scissors
|
||||||
|
if (this == MobEffects.REGENERATION) {
|
||||||
|
if (entity.getHealth() < entity.getMaxHealth()) {
|
||||||
|
entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
|
||||||
|
@@ -86,17 +87,31 @@ public class MobEffect {
|
||||||
|
// CraftBukkit end
|
||||||
|
}
|
||||||
|
} else if ((this != MobEffects.HEAL || entity.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entity.isInvertedHealAndHarm())) {
|
||||||
|
- if (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm()) {
|
||||||
|
+ // Scissors start
|
||||||
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||||
|
+ if (!god && (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm())) {
|
||||||
|
entity.hurt(entity.damageSources().magic(), (float) (6 << amplifier));
|
||||||
|
}
|
||||||
|
+ // Scissors end
|
||||||
|
} else {
|
||||||
|
- entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
||||||
|
+ // Scissors start
|
||||||
|
+ if (!god) {
|
||||||
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||||
|
+ entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) {
|
||||||
|
int j;
|
||||||
|
+ // 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 Player player && (player.isCreative() || player.isInvulnerable())) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||||
|
+ // Scissors end
|
||||||
|
|
||||||
|
if ((this != MobEffects.HEAL || target.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !target.isInvertedHealAndHarm())) {
|
||||||
|
if ((this != MobEffects.HARM || target.isInvertedHealAndHarm()) && (this != MobEffects.HEAL || !target.isInvertedHealAndHarm())) {
|
@ -1,19 +1,19 @@
|
|||||||
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: Wed, 8 May 2024 12:48:19 -0500
|
Date: Thu, 8 Jun 2023 19:24:05 -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 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..8ff815b1bb77eab735c65fa9c6bf469dca8562c4 100644
|
index 67627bbf84f5aab2872f636b1dcb6728c8494147..468f64afb7e9b3ef579205d3beea025deb31b460 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
|
||||||
@@ -650,7 +650,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -630,7 +630,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
|
||||||
protected void tickDeath() {
|
protected void tickDeath() {
|
||||||
++this.deathTime;
|
++this.deathTime;
|
||||||
- if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
- if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
||||||
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved()) { // Scissors
|
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved()) {
|
||||||
this.level().broadcastEntityEvent(this, (byte) 60);
|
this.level().broadcastEntityEvent(this, (byte) 60);
|
||||||
this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
|
this.remove(Entity.RemovalReason.KILLED);
|
||||||
}
|
}
|
@ -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: Wed, 8 May 2024 13:01:45 -0500
|
Date: Sat, 11 Jun 2022 22:56:59 -0500
|
||||||
Subject: [PATCH] Add custom classes used by Scissors
|
Subject: [PATCH] Add custom classes used by Scissors
|
||||||
|
|
||||||
|
|
||||||
@ -41,19 +41,18 @@ 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..9ad690056bffd9e85e469c5a54dffa3e1e13db5a
|
index 0000000000000000000000000000000000000000..b724baaef8d565e41db1af6393d0890e919a5aa8
|
||||||
--- /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,76 @@
|
@@ -0,0 +1,74 @@
|
||||||
+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);
|
||||||
@ -76,7 +75,6 @@ index 0000000000000000000000000000000000000000..9ad690056bffd9e85e469c5a54dffa3e
|
|||||||
+ CompoundTag compoundTag = (CompoundTag) tag;
|
+ CompoundTag compoundTag = (CompoundTag) tag;
|
||||||
+ for (String key : compoundTag.getAllKeys())
|
+ for (String key : compoundTag.getAllKeys())
|
||||||
+ {
|
+ {
|
||||||
+ size += key.getBytes(StandardCharsets.UTF_8).length;
|
|
||||||
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -123,10 +121,10 @@ index 0000000000000000000000000000000000000000..9ad690056bffd9e85e469c5a54dffa3e
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/PositionUtility.java b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/PositionUtility.java b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..c5dcc833d6f2c0daa1d0c2a7ab81430f25e0b2f3
|
index 0000000000000000000000000000000000000000..c54535042a7ac12fe46b3b37db8d7b116e9469d5
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
@@ -0,0 +1,53 @@
|
@@ -0,0 +1,83 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+import net.minecraft.core.BlockPos;
|
+import net.minecraft.core.BlockPos;
|
||||||
@ -137,6 +135,36 @@ index 0000000000000000000000000000000000000000..c5dcc833d6f2c0daa1d0c2a7ab81430f
|
|||||||
+
|
+
|
||||||
+public class PositionUtility
|
+public class PositionUtility
|
||||||
+{
|
+{
|
||||||
|
+ public static Vec3 getValidVec3(double x, double y, double z, Entity entity)
|
||||||
|
+ {
|
||||||
|
+ final Level level = entity.level;
|
||||||
|
+
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ if (level.isInWorldBounds(new BlockPos(Math.floor(MathUtility.safeDoubleToInt(x)), Math.floor(MathUtility.safeDoubleToInt(y)), Math.floor(MathUtility.safeDoubleToInt(z)))))
|
||||||
|
+ {
|
||||||
|
+ return new Vec3(x, y, z);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ final WorldBorder worldBorder = level.getWorldBorder();
|
||||||
|
+
|
||||||
|
+ final double maxX = worldBorder.getMaxX();
|
||||||
|
+ final double maxY = level.getMaxBuildHeight();
|
||||||
|
+ final double maxZ = worldBorder.getMaxZ();
|
||||||
|
+
|
||||||
|
+ final double minX = worldBorder.getMinX();
|
||||||
|
+ final double minY = level.getMinBuildHeight();
|
||||||
|
+ final double minZ = worldBorder.getMinZ();
|
||||||
|
+
|
||||||
|
+ return new Vec3(MathUtility.clampDouble(x, minX, maxX), MathUtility.clampDouble(y, minY, maxY), MathUtility.clampDouble(z, minZ, maxZ));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ catch (Exception e)
|
||||||
|
+ { // If we throw some sort of exception due to the position being crazy, catch it
|
||||||
|
+ return new Vec3(0, 0, 0);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
+ public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
||||||
+ {
|
+ {
|
@ -1,31 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Sat, 11 May 2024 13:08:40 -0500
|
|
||||||
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
|
|
||||||
index 65284355b6fc97eb1967e5c6fd51bc5b018e3e29..26eb85c9be17fcac00a5f31c2ede3111319c4044 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -1266,7 +1266,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
if (this.player.hasPermissions(2)) {
|
|
||||||
Entity entity = this.player.level().getEntity(packet.getEntityId());
|
|
||||||
|
|
||||||
- if (entity != null) {
|
|
||||||
+ if (entity != null && this.player.distanceToSqr(entity.position().x, entity.position().y, entity.position().z) < 32 * 32) { // Scissors - Validate entity tag query positions
|
|
||||||
CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag());
|
|
||||||
|
|
||||||
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
|
|
||||||
@@ -1298,7 +1298,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
@Override
|
|
||||||
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQueryPacket packet) {
|
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
||||||
- if (this.player.hasPermissions(2)) {
|
|
||||||
+ // Scissors start - Validate block entity tag query positions
|
|
||||||
+ 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) {
|
|
||||||
+ // Scissors end
|
|
||||||
BlockEntity tileentity = this.player.level().getBlockEntity(packet.getPos());
|
|
||||||
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata(this.player.registryAccess()) : null;
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Wed, 27 Jul 2022 22:30:39 -0500
|
||||||
|
Subject: [PATCH] Validate coordinates before attempting to get block entities
|
||||||
|
when handling Creative Inventory packets
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 1288f651fa83d5ab99a88858f52a6d3212284df0..61f6b51b9d868ae6bd79185cc066976a094da8ce 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1920,6 +1920,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
}
|
||||||
|
// Spigot end
|
||||||
|
|
||||||
|
+ // Scissors start - Readd the following Paper code
|
||||||
|
+ // Paper start
|
||||||
|
+ private static final int SURVIVAL_PLACE_DISTANCE_SQUARED = 6 * 6;
|
||||||
|
+ private static final int CREATIVE_PLACE_DISTANCE_SQUARED = 7 * 7;
|
||||||
|
+ private boolean isOutsideOfReach(double x, double y, double z) {
|
||||||
|
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
|
||||||
|
+ double reachDistance = org.bukkit.util.NumberConversions.square(eyeLoc.getX() - x) + org.bukkit.util.NumberConversions.square(eyeLoc.getY() - y) + org.bukkit.util.NumberConversions.square(eyeLoc.getZ() - z);
|
||||||
|
+ return reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void handleUseItemOn(ServerboundUseItemOnPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
@@ -3344,17 +3356,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
|
||||||
|
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
|
||||||
|
|
||||||
|
- if (this.player.level().isLoaded(blockposition)) {
|
||||||
|
- // Paper start
|
||||||
|
- BlockEntity tileentity = null;
|
||||||
|
- if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.serverLevel().isLoadedAndInBounds(blockposition)) {
|
||||||
|
- tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
|
- }
|
||||||
|
- // Paper end
|
||||||
|
+ if (this.player.level().isLoaded(blockposition))
|
||||||
|
+ {
|
||||||
|
+ // Scissors start - Validate coordinates and whether the player can reach them
|
||||||
|
+ if (Level.isInSpawnableBounds(blockposition) && !isOutsideOfReach(blockposition.getX(), blockposition.getY(), blockposition.getZ()))
|
||||||
|
+ {
|
||||||
|
+ BlockEntity tileentity = null;
|
||||||
|
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.serverLevel().isLoadedAndInBounds(blockposition))
|
||||||
|
+ {
|
||||||
|
+ tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
|
||||||
|
- if (tileentity != null) {
|
||||||
|
- tileentity.saveToItem(itemstack);
|
||||||
|
+ if (tileentity != null)
|
||||||
|
+ {
|
||||||
|
+ tileentity.saveToItem(itemstack);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Sat, 11 May 2024 13:09:44 -0500
|
|
||||||
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
|
|
||||||
index 70f207f016959402ff3cba9de924f906fea28110..f4751469d925f350a7eda9ae6a1f340d41636b2c 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
|
||||||
@@ -216,6 +216,7 @@ public final class CraftChatMessage {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
|
||||||
+ if (message.length() > 1_000) return new Component[]{Component.empty()}; // Scissors - Refuse to convert legacy messages over 1k characters
|
|
||||||
return new StringMessage(message, keepNewlines, plain).getOutput();
|
|
||||||
}
|
|
||||||
|
|
54
patches/server/0023-Reset-large-tags.patch
Normal file
54
patches/server/0023-Reset-large-tags.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 23:38:53 -0600
|
||||||
|
Subject: [PATCH] Reset large tags
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
index b367ec1feaccbd67e9e28c0d0515e163f37135fe..d1547b9ba36baec925751b9bb0498c8a8cac12f8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
@@ -21,6 +21,7 @@ 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;
|
||||||
|
@@ -253,6 +254,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)) {
|
||||||
|
@@ -550,7 +557,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;
|
||||||
|
@@ -880,6 +891,9 @@ public final class ItemStack {
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
public void setTag(@Nullable CompoundTag nbt) {
|
||||||
|
+ // Scissors start - Ignore large tags
|
||||||
|
+ if (NbtUtility.isTooLarge(nbt)) return;
|
||||||
|
+ // Scissors end
|
||||||
|
this.tag = nbt;
|
||||||
|
this.processEnchantOrder(this.tag); // Paper
|
||||||
|
if (this.getItem().canBeDepleted()) {
|
260
patches/server/0024-Account-for-items-inside-containers.patch
Normal file
260
patches/server/0024-Account-for-items-inside-containers.patch
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
|
Date: Sat, 11 Jun 2022 23:33:13 -0500
|
||||||
|
Subject: [PATCH] Account for items inside containers
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..9e0ab51dd7a4f9fed8f9edde962d42d4bbf604c1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
@@ -2,6 +2,7 @@ package net.minecraft.world;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
@@ -22,10 +23,13 @@ public class ContainerHelper {
|
||||||
|
|
||||||
|
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
|
||||||
|
ListTag listTag = new ListTag();
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
|
||||||
|
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,18 @@ public class ContainerHelper {
|
||||||
|
|
||||||
|
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
||||||
|
ListTag listTag = nbt.getList("Items", 10);
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
|
||||||
|
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()) {
|
||||||
|
+ total += NbtUtility.getTagSize(compoundTag);
|
||||||
|
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ stacks.clear();
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
stacks.set(j, ItemStack.of(compoundTag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 2a786c9fd29dc2139cf487fa645cd43345d60167..dbdc66620ae4284cfe96f633b1f4db46866b597b 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,7 @@ 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;
|
||||||
|
@@ -212,6 +213,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||||
|
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
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..893cf89dd2b022e2b785318e7e86eb5d75be8ed8 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,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
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 c57efcb9a79337ec791e4e8f6671612f0a82b441..2963b72061a9ede734842d6fb46a67a1c41d4740 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,7 @@ 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 +74,16 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
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 a71414397bd45ee7bcacfeef0041d80dfa25f114..1b6f91055eb01627761e83e5e99e1731029b32ab 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,16 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
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..1be5d600573f7632e6630224530dd76522e1b191 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,16 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
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 789e5458f4a137694563a22612455506807de51b..84c721da46b7786857677b56f439c2b9448ba4b8 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,7 @@ 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;
|
||||||
|
@@ -56,6 +57,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
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 b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..c2904048625bb4439c7f0ba8a2605d3194b66070 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
|
||||||
|
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||||
|
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;
|
||||||
|
@@ -60,6 +61,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||||
|
public boolean opened;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - 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();
|
||||||
|
+ }
|
||||||
|
return this.itemStacks;
|
||||||
|
}
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Sat, 11 May 2024 13:11:20 -0500
|
|
||||||
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
|
|
||||||
index a28be7a332659be655f419d969e0c64e659b6c21..7867f88fdb7ed0b644ab7c4e3c971d1164feea7a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
|
||||||
@@ -9,8 +9,11 @@ import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.UnaryOperator;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.commands.CommandSource;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
+import net.minecraft.commands.Commands;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.core.HolderLookup;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
@@ -21,6 +24,7 @@ import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.ComponentUtils;
|
|
||||||
import net.minecraft.network.chat.Style;
|
|
||||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
|
||||||
+import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.server.network.FilteredText;
|
|
||||||
@@ -34,6 +38,8 @@ import net.minecraft.world.level.block.SignBlock;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.minecraft.world.phys.Vec2;
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
|
||||||
+import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.bukkit.block.sign.Side;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
|
||||||
@@ -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());
|
|
||||||
// Paper end - Fix commands from signs not firing command events
|
|
||||||
+ // Scissors start - Add optional permissions to command signs
|
|
||||||
+ final MinecraftServer vanillaServer = player.getServer();
|
|
||||||
+ final CraftServer craftServer = vanillaServer.server;
|
|
||||||
+ final CraftHumanEntity craftPlayer = player.getBukkitEntity();
|
|
||||||
+ final Commands commands = vanillaServer.getCommands();
|
|
||||||
+
|
|
||||||
+ if (ScissorsConfig.commandSignsBypassPermissions) {
|
|
||||||
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
|
||||||
+ }
|
|
||||||
+ else {
|
|
||||||
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
flag1 = true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +1,12 @@
|
|||||||
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: Wed, 8 May 2024 13:00:39 -0500
|
Date: Sat, 10 Dec 2022 23:44:05 -0600
|
||||||
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 4d7454e5a64fc18e63793a221daa94617f17c666..0ebc9b469d684251ba73989b3f7483522faf48d7 100644
|
index 9948a28dae4edba877c13ef0156be5ff58df3fa2..93f359c71659c0b2fdf25b1c76c072bf9209db2a 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;
|
||||||
@ -17,83 +17,93 @@ index 4d7454e5a64fc18e63793a221daa94617f17c666..0ebc9b469d684251ba73989b3f748352
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.BlockUtil;
|
import net.minecraft.BlockUtil;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
@@ -101,6 +102,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
@@ -107,6 +108,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
private double flyingX = 0.95;
|
private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
private double flyingY = 0.95;
|
private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
private double flyingZ = 0.95;
|
private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
||||||
public double maxSpeed = 0.4D;
|
public double maxSpeed = 0.4D;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@@ -381,8 +383,8 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
@@ -434,8 +436,10 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
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));
|
||||||
|
|
||||||
- if (!list.isEmpty()) {
|
- if (!list.isEmpty()) {
|
||||||
- Iterator iterator = list.iterator();
|
- for (int l = 0; l < list.size(); ++l) {
|
||||||
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Scissors - add collision debounce, using TimeUnit for better code readability
|
+ // Scissors - Add a collision debounce
|
||||||
+ Iterator iterator = list.size() <= 15 ? list.iterator() : list.subList(0, 15).iterator(); // Scissors
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
|
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||||
|
+ for (int l = 0; l < Math.min(3, list.size()); ++l) {
|
||||||
|
Entity entity = (Entity) list.get(l);
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) {
|
||||||
Entity entity = (Entity) iterator.next();
|
@@ -462,6 +466,16 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
@@ -411,6 +413,13 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
|
||||||
entity.push(this);
|
entity.push(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ // Scissors start - Add a collision debounce
|
+
|
||||||
+ if (list.size() > 15) {
|
+ // Scissors - Add a collision debounce
|
||||||
+ this.discard(null);
|
+ if (list.size() > 3) {
|
||||||
+ } else if (list.size() > 3) {
|
|
||||||
+ lastLargeCollision = System.currentTimeMillis();
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+
|
||||||
|
+ // Scissors - Delete entity if the collision amount is over 15
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Iterator iterator1 = this.level().getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
|
Iterator iterator = 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 b068cff9b5aa457d65b679529956e8210296d799..8274154f2ce4a752ea49790c6526ecb353934a04 100644
|
index 35aeba4e8430e6419caa9db4a0b931a994228618..11b337298ac824adce04cf0608f8f960e59640c9 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
|
||||||
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
|
||||||
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;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.BlockUtil;
|
import net.minecraft.BlockUtil;
|
||||||
@@ -107,6 +108,8 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -109,6 +110,7 @@ public class Boat extends Entity 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);
|
||||||
this.paddlePositions = new float[2];
|
@@ -421,10 +423,12 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
@@ -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));
|
||||||
|
|
||||||
- if (!list.isEmpty()) {
|
- if (!list.isEmpty()) {
|
||||||
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Scissors - add collision debounce, using TimeUnit for better code readability
|
+ // Scissors - Add collision debounce
|
||||||
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player);
|
boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player);
|
||||||
- Iterator iterator = list.iterator();
|
|
||||||
+ Iterator iterator = list.size() <= 15 ? list.iterator() : list.subList(0, 15).iterator(); // Scissors
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
- for (int j = 0; j < list.size(); ++j) {
|
||||||
Entity entity = (Entity) iterator.next();
|
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||||
@@ -416,6 +419,13 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
+ for (int j = 0; j < Math.min(3, list.size()); ++j) {
|
||||||
|
Entity entity = (Entity) list.get(j);
|
||||||
|
|
||||||
|
if (!entity.hasPassenger((Entity) this)) {
|
||||||
|
@@ -435,6 +439,16 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ // Scissors start - Add collision debounce
|
+
|
||||||
+ if (list.size() > 15) {
|
+ // Scissors - Add collision debounce
|
||||||
+ this.discard(null);
|
+ if (list.size() > 3) {
|
||||||
+ } else if (list.size() > 3) {
|
|
||||||
+ lastLargeCollision = System.currentTimeMillis();
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+
|
||||||
|
+ // Scissors - Delete entity if the collision amount is over 15
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,76 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Sat, 11 May 2024 13:18:03 -0500
|
|
||||||
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
|
|
||||||
index 060c0ffe57a4648598870c6168be203bf3a8634d..5c697e5d85c5c65af0ec969dbd68c38e876fc02f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
|
||||||
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
|
||||||
@@ -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)
|
|
||||||
implements MinMaxBounds<Double> {
|
|
||||||
public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
|
|
||||||
- public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new);
|
|
||||||
+ public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.<Double, MinMaxBounds.Doubles>createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); // Scissors - compile fixes
|
|
||||||
|
|
||||||
- private Doubles(Optional<Double> min, Optional<Double> max) {
|
|
||||||
+ public Doubles(Optional<Double> min, Optional<Double> max) {
|
|
||||||
this(min, max, squareOpt(min), squareOpt(max));
|
|
||||||
- }
|
|
||||||
+ } // Scissors - private -> public
|
|
||||||
|
|
||||||
private static MinMaxBounds.Doubles create(StringReader reader, Optional<Double> min, Optional<Double> max) throws CommandSyntaxException {
|
|
||||||
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
|
|
||||||
@@ -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)
|
|
||||||
implements MinMaxBounds<Integer> {
|
|
||||||
public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
|
|
||||||
- public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new);
|
|
||||||
+ public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.<Integer, MinMaxBounds.Ints>createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes
|
|
||||||
|
|
||||||
private Ints(Optional<Integer> min, Optional<Integer> max) {
|
|
||||||
this(min, max, min.map(i -> i.longValue() * i.longValue()), squareOpt(max));
|
|
||||||
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
|
||||||
index 676a1499747b071515479130875157263d3a8352..6a65850101b8ea348a4bfeaeca805a39987b06fc 100644
|
|
||||||
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
|
||||||
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
|
||||||
@@ -10,6 +10,8 @@ import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.MathUtility;
|
|
||||||
import net.minecraft.advancements.critereon.MinMaxBounds;
|
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
|
||||||
import net.minecraft.commands.arguments.EntityArgument;
|
|
||||||
@@ -60,9 +62,26 @@ public class EntitySelector {
|
|
||||||
this.includesEntities = includesNonPlayers;
|
|
||||||
this.worldLimited = localWorldOnly;
|
|
||||||
this.predicate = basePredicate;
|
|
||||||
- this.range = distance;
|
|
||||||
+ // Scissors start - Patch large selector distance crash
|
|
||||||
+ this.range = new MinMaxBounds.Doubles(
|
|
||||||
+ distance.min().map(min -> Math.min(min, 1024)),
|
|
||||||
+ distance.max().map(max -> Math.min(max, 1024))
|
|
||||||
+ );
|
|
||||||
this.position = positionOffset;
|
|
||||||
- this.aabb = box;
|
|
||||||
+ if (box != null) {
|
|
||||||
+ this.aabb = new AABB(
|
|
||||||
+ MathUtility.clampDouble(box.minX, -1024, 1025),
|
|
||||||
+ MathUtility.clampDouble(box.minY, -1024, 1025),
|
|
||||||
+ MathUtility.clampDouble(box.minZ, -1024, 1025),
|
|
||||||
+ MathUtility.clampDouble(box.maxX, -1024, 1025),
|
|
||||||
+ MathUtility.clampDouble(box.maxY, -1024, 1025),
|
|
||||||
+ MathUtility.clampDouble(box.maxZ, -1024, 1025),
|
|
||||||
+ false
|
|
||||||
+ );
|
|
||||||
+ } else {
|
|
||||||
+ this.aabb = null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
this.order = sorter;
|
|
||||||
this.currentEntity = senderOnly;
|
|
||||||
this.playerName = playerName;
|
|
@ -0,0 +1,194 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 23:48:28 -0600
|
||||||
|
Subject: [PATCH] Better handling of invalid JSON components
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
index 37fc353c3e59dd5af2fd6c58ac084fb0e6e155d7..3c0ee4e1f42f6056ca86a6f9f129d467e29a2fbc 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
@@ -26,6 +26,7 @@ import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.network.chat.contents.BlockDataSource;
|
||||||
|
import net.minecraft.network.chat.contents.DataSource;
|
||||||
|
@@ -522,6 +523,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
return GsonHelper.toStableString(Serializer.toJsonTree(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ @Nullable
|
||||||
|
+ public static MutableComponent fromJsonSafe(String json) {
|
||||||
|
+ try {
|
||||||
|
+ return fromJson(json);
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Nullable
|
||||||
|
+ public static MutableComponent fromJsonSafe(JsonElement json) {
|
||||||
|
+ try {
|
||||||
|
+ return fromJson(json);
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
public static JsonElement toJsonTree(Component text) {
|
||||||
|
return Component.Serializer.GSON.toJsonTree(text);
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
index 7449a024265c42f28a6c9a1ed8d8f4b9e3096aac..487c68abc3eb5c18dc7fee762b2164001283cab7 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
|
@@ -79,7 +79,7 @@ public class HoverEvent {
|
||||||
|
if (jsonElement != null) {
|
||||||
|
return action.deserialize(jsonElement);
|
||||||
|
} else {
|
||||||
|
- Component component = Component.Serializer.fromJson(json.get("value"));
|
||||||
|
+ Component component = Component.Serializer.fromJsonSafe(json.get("value")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
return component != null ? action.deserializeFromLegacy(component) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -94,7 +94,7 @@ public class HoverEvent {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Action<T> {
|
||||||
|
- public static final HoverEvent.Action<Component> SHOW_TEXT = new HoverEvent.Action<>("show_text", true, Component.Serializer::fromJson, Component.Serializer::toJsonTree, Function.identity());
|
||||||
|
+ public static final HoverEvent.Action<Component> SHOW_TEXT = new HoverEvent.Action<>("show_text", true, Component.Serializer::fromJsonSafe, Component.Serializer::toJsonTree, Function.identity()); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
public static final HoverEvent.Action<HoverEvent.ItemStackInfo> SHOW_ITEM = new HoverEvent.Action<>("show_item", true, HoverEvent.ItemStackInfo::create, HoverEvent.ItemStackInfo::serialize, HoverEvent.ItemStackInfo::create);
|
||||||
|
public static final HoverEvent.Action<HoverEvent.EntityTooltipInfo> SHOW_ENTITY = new HoverEvent.Action<>("show_entity", true, HoverEvent.EntityTooltipInfo::create, HoverEvent.EntityTooltipInfo::serialize, HoverEvent.EntityTooltipInfo::create);
|
||||||
|
private static final Map<String, HoverEvent.Action<?>> LOOKUP = Stream.of(SHOW_TEXT, SHOW_ITEM, SHOW_ENTITY).collect(ImmutableMap.toImmutableMap(HoverEvent.Action::getName, (action) -> {
|
||||||
|
@@ -182,7 +182,7 @@ public class HoverEvent {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// Scissors end
|
||||||
|
- Component component = Component.Serializer.fromJson(jsonObject.get("name"));
|
||||||
|
+ Component component = Component.Serializer.fromJsonSafe(jsonObject.get("name")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -191,7 +191,7 @@ public class HoverEvent {
|
||||||
|
public static HoverEvent.EntityTooltipInfo create(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
|
||||||
|
index 97a2657bc98d41c3c1e376b266d2c85f685acc88..7b6476455e095eed15c92797ce3a3e1146dbdc3f 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
|
@@ -8,6 +8,7 @@ import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import net.kyori.adventure.text.TextComponent;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.arguments.NbtPathArgument;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
|
@@ -107,10 +108,11 @@ public class NbtContents implements ComponentContents {
|
||||||
|
Component component = DataFixUtils.orElse(ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR);
|
||||||
|
return stream.flatMap((text) -> {
|
||||||
|
try {
|
||||||
|
- MutableComponent mutableComponent = Component.Serializer.fromJson(text);
|
||||||
|
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text); // Scissors
|
||||||
|
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
|
||||||
|
} catch (Exception var5) {
|
||||||
|
- LOGGER.warn("Failed to parse component: {}", text, var5);
|
||||||
|
+ // Scissors - don't log
|
||||||
|
+ // LOGGER.warn("Failed to parse component: {}", text, var5);
|
||||||
|
return Stream.of();
|
||||||
|
}
|
||||||
|
}).reduce((accumulator, current) -> {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
index 92202262eff01ae3bbeff0e6ebdcf26ad613c169..38c027c0fbddf58136b7d67eb7156403a79de4d1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -2473,12 +2473,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
|
this.setRot(this.getYRot(), this.getXRot());
|
||||||
|
if (nbt.contains("CustomName", 8)) {
|
||||||
|
String s = nbt.getString("CustomName");
|
||||||
|
-
|
||||||
|
- try {
|
||||||
|
- this.setCustomName(Component.Serializer.fromJson(s));
|
||||||
|
- } catch (Exception 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.setCustomNameVisible(nbt.getBoolean("CustomNameVisible"));
|
||||||
|
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 59246e24558569f7f50b4d4d508616798091c888..5005a0ad5f703727ea9c618ae4b769a77d5655b5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
@@ -410,7 +410,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
|
this.levels = nbt.getInt("Levels"); // SPIGOT-5053, use where available
|
||||||
|
// CraftBukkit end
|
||||||
|
if (nbt.contains("CustomName", 8)) {
|
||||||
|
- this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException
|
||||||
|
+ this.name = Component.Serializer.fromJsonSafe(nbt.getString("CustomName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lockKey = LockCode.fromTag(nbt);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||||
|
index 65e1381bb2d10bd212463feb602c60f8fdb9ade1..3e23451066894ebd88cad7022970cb2c0e9b75db 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||||
|
@@ -42,7 +42,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
||||||
|
public void load(CompoundTag nbt) {
|
||||||
|
super.load(nbt);
|
||||||
|
if (nbt.contains("CustomName", 8)) {
|
||||||
|
- this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException
|
||||||
|
+ this.name = Component.Serializer.fromJsonSafe(nbt.getString("CustomName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
|
index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1a2417616 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
|
@@ -35,7 +35,7 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
|
CompoundTag compoundTag = nbt.getCompound(i);
|
||||||
|
String string = compoundTag.getString("Name");
|
||||||
|
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
||||||
|
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
||||||
|
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
if (component != null) {
|
||||||
|
playerTeam.setDisplayName(component);
|
||||||
|
}
|
||||||
|
@@ -53,14 +53,14 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
||||||
|
- Component component2 = Component.Serializer.fromJson(compoundTag.getString("MemberNamePrefix"));
|
||||||
|
+ Component component2 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNamePrefix")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
if (component2 != null) {
|
||||||
|
playerTeam.setPlayerPrefix(component2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (compoundTag.contains("MemberNameSuffix", 8)) {
|
||||||
|
- Component component3 = Component.Serializer.fromJson(compoundTag.getString("MemberNameSuffix"));
|
||||||
|
+ Component component3 = Component.Serializer.fromJsonSafe(compoundTag.getString("MemberNameSuffix")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
if (component3 != null) {
|
||||||
|
playerTeam.setPlayerSuffix(component3);
|
||||||
|
}
|
||||||
|
@@ -115,7 +115,7 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
|
CompoundTag compoundTag = nbt.getCompound(i);
|
||||||
|
ObjectiveCriteria.byName(compoundTag.getString("CriteriaName")).ifPresent((criterion) -> {
|
||||||
|
String string = compoundTag.getString("Name");
|
||||||
|
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
||||||
|
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
|
||||||
|
this.scoreboard.addObjective(string, criterion, component, renderType);
|
||||||
|
});
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:07:11 -0500
|
|
||||||
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
|
|
||||||
index 6ee2d11e4f3fbc8424a2ffbe6a7ebd1832a25503..6bfe06748df9e36c20dc276471f209c1072ad3e4 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -4812,7 +4812,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
||||||
|
|
||||||
public void setXRot(float pitch) {
|
|
||||||
if (!Float.isFinite(pitch)) {
|
|
||||||
- Util.logAndPauseIfInIde("Invalid entity rotation: " + pitch + ", discarding.");
|
|
||||||
+ // Scissors - Patch invalid entity rotation log spam
|
|
||||||
} else {
|
|
||||||
this.xRot = pitch;
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:12:12 -0500
|
|
||||||
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
|
|
||||||
index c87b708c368713a23a10ad97704575ee4df27891..72b22821165efaecf9e2fa243d0ce3e45931d00c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.network.chat;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
|
|
||||||
public interface OutgoingChatMessage {
|
|
||||||
@@ -46,9 +47,19 @@ public interface OutgoingChatMessage {
|
|
||||||
// Paper end
|
|
||||||
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
|
||||||
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
|
||||||
- if (!playerChatMessage.isFullyFiltered()) {
|
|
||||||
+ // Scissors start
|
|
||||||
+ if (!playerChatMessage.isFullyFiltered() && ScissorsConfig.chatSignaturesEnabled) {
|
|
||||||
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
|
|
||||||
+ return;
|
|
||||||
}
|
|
||||||
+ sender.connection.sendPlayerChatMessage(new PlayerChatMessage(
|
|
||||||
+ SignedMessageLink.unsigned(playerChatMessage.sender()),
|
|
||||||
+ null,
|
|
||||||
+ SignedMessageBody.unsigned(playerChatMessage.signedContent()),
|
|
||||||
+ unsigned,
|
|
||||||
+ playerChatMessage.filterMask()
|
|
||||||
+ ), params);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
|
||||||
index 300929a406905f5ff1ede664d5b99fb0938d4d2e..769da86c130354f8c31642f5d87196b68ccd2dd5 100644
|
|
||||||
--- a/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;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.BooleanSupplier;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.util.SignatureValidator;
|
|
||||||
import net.minecraft.util.Signer;
|
|
||||||
import net.minecraft.world.entity.player.ProfilePublicKey;
|
|
||||||
@@ -55,7 +57,7 @@ public class SignedMessageChain {
|
|
||||||
this.setChainBroken();
|
|
||||||
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.INVALID_SIGNATURE);
|
|
||||||
} else {
|
|
||||||
- if (playerChatMessage.hasExpiredServer(Instant.now())) {
|
|
||||||
+ if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors
|
|
||||||
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
|
|
||||||
index 703a4ea4c303b28d9cebb0bec86777529ef970da..779d44f878e3ae48f1808d1f48bf2b3120cc97ed 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
@@ -2268,6 +2269,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
}
|
|
||||||
|
|
||||||
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());
|
|
||||||
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
|
|
||||||
}
|
|
||||||
@@ -2364,6 +2366,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
|
|
||||||
|
|
||||||
if (optional.isEmpty()) {
|
|
||||||
+ if (!ScissorsConfig.chatSignaturesEnabled) return optional; // Scissors
|
|
||||||
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
|
|
||||||
}
|
|
||||||
@@ -2549,6 +2552,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
|
|
||||||
synchronized (this.lastSeenMessages) {
|
|
||||||
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
|
|
||||||
+ if (!ScissorsConfig.chatSignaturesEnabled) return; // Scissors
|
|
||||||
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
|
|
||||||
}
|
|
||||||
@@ -3532,6 +3536,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
@Override
|
|
||||||
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
|
|
||||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
||||||
+ if (!ScissorsConfig.chatSignaturesEnabled) return; // Scissors
|
|
||||||
RemoteChatSession.Data remotechatsession_a = packet.chatSession();
|
|
||||||
ProfilePublicKey.Data profilepublickey_a = this.chatSession != null ? this.chatSession.profilePublicKey().data() : null;
|
|
||||||
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,40 +1,35 @@
|
|||||||
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: Wed, 8 May 2024 12:08:31 -0500
|
Date: Fri, 25 Nov 2022 22:25:24 -0600
|
||||||
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..5dea669ed5da073dcdfe4cbbf5521a622242563b 100644
|
index 584a58659fae6ba3d8b53858890bc6ec509ffb0e..0dcee5b53740126e0886058dacc43e447836b8d8 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
|
||||||
@@ -1,6 +1,7 @@
|
@@ -39,8 +39,10 @@ public class ComponentUtils {
|
||||||
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 {
|
||||||
+ MutableComponent result; // Scissors
|
+ // Scissors start - Reject oversized components
|
||||||
|
+ MutableComponent result;
|
||||||
if (depth > 100) {
|
if (depth > 100) {
|
||||||
- return text.copy();
|
- return text.copy();
|
||||||
+ result = text.copy(); // Scissors
|
+ result = text.copy();
|
||||||
} else {
|
} else {
|
||||||
// Paper start - adventure; pass actual vanilla component
|
// Paper start
|
||||||
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
||||||
@@ -52,8 +54,9 @@ public class ComponentUtils {
|
@@ -53,8 +55,11 @@ 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));
|
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||||
}
|
}
|
||||||
+ return JsonParser.parseString(result.toString()).toString().length() > 65535 ? Component.empty() : result; // Scissors
|
+ // Would the resulting component exceed 65535 bytes when encoded as a string?
|
||||||
|
+ return Component.Serializer.toJson(result).length() > 65535 ? Component.empty() : result;
|
||||||
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
||||||
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,36 +1,42 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Allink <arclicious@vivaldi.net>
|
||||||
Date: Sat, 11 May 2024 12:31:03 -0500
|
Date: Mon, 4 Jul 2022 22:12:19 +0100
|
||||||
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 ec1a8c60ccac50e5131f937c4262128fd2768331..385c73cc952caea21f6ebf5512fdf72bf121b953 100644
|
index 2e7c03b00bc941b86df6a7f1b2b188c9f0aede22..333f9bcccbe9ecd88c1fd13e2956f69414d6e295 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;
|
@@ -1,5 +1,6 @@
|
||||||
import com.mojang.serialization.Codec;
|
package net.minecraft.world.level.block;
|
||||||
import com.mojang.serialization.MapCodec;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.component.DataComponents;
|
@@ -25,10 +26,10 @@ 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;
|
||||||
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
+import org.bukkit.Location;
|
+import org.bukkit.Location;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
-import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
@@ -128,6 +130,13 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
-
|
||||||
|
public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
@@ -117,6 +118,15 @@ 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 - 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
|
||||||
@ -38,8 +44,20 @@ index ec1a8c60ccac50e5131f937c4262128fd2768331..385c73cc952caea21f6ebf5512fdf72b
|
|||||||
if (hasCommand) {
|
if (hasCommand) {
|
||||||
executor.performCommand(world);
|
executor.performCommand(world);
|
||||||
} else {
|
} else {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/StructureBlock.java b/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
index a3dac53b07618819b322b48339d850d80a1c55ba..4dd21b7ea247b3ced3d3ee6c67746cc6811d5bb8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
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 922592f2073eaea8ca361a3a1efcda8b18bea21c..7fec97a00f271eca29beca0ec0862de4036dd546 100644
|
index 182e16c1d968707a11329150d71b7d01df6c6e52..fa5cade3f5f2fecc37cc065b96403d0a1c1a2553 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;
|
||||||
@ -50,8 +68,8 @@ index 922592f2073eaea8ca361a3a1efcda8b18bea21c..7fec97a00f271eca29beca0ec0862de4
|
|||||||
+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.HolderLookup;
|
import net.minecraft.core.Registry;
|
||||||
@@ -18,6 +20,7 @@ import net.minecraft.world.level.block.JigsawBlock;
|
@@ -17,6 +19,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;
|
||||||
@ -59,14 +77,16 @@ index 922592f2073eaea8ca361a3a1efcda8b18bea21c..7fec97a00f271eca29beca0ec0862de4
|
|||||||
|
|
||||||
public class JigsawBlockEntity extends BlockEntity {
|
public class JigsawBlockEntity extends BlockEntity {
|
||||||
public static final String TARGET = "target";
|
public static final String TARGET = "target";
|
||||||
@@ -135,6 +138,14 @@ public class JigsawBlockEntity extends BlockEntity {
|
@@ -107,6 +110,16 @@ 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 - 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
|
||||||
@ -75,7 +95,7 @@ index 922592f2073eaea8ca361a3a1efcda8b18bea21c..7fec97a00f271eca29beca0ec0862de4
|
|||||||
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 ab3e35069a069040f72900a9581f41848e4c4653..d390b05486dcaa563269500b350aecd9dfa3bc28 100644
|
index 9792bf3ee083f571f1f4089d30beb586839f5f6b..e9d584b0ca984f9b7c70f99e1665cdedecb710e1 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;
|
||||||
@ -87,7 +107,7 @@ index ab3e35069a069040f72900a9581f41848e4c4653..d390b05486dcaa563269500b350aecd9
|
|||||||
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;
|
||||||
@@ -30,6 +32,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
@@ -29,6 +31,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;
|
||||||
@ -95,14 +115,24 @@ index ab3e35069a069040f72900a9581f41848e4c4653..d390b05486dcaa563269500b350aecd9
|
|||||||
|
|
||||||
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;
|
||||||
@@ -317,6 +320,14 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -264,7 +267,6 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
if (this.structureName == null) {
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
+ // Scissors start - Add master block fire event
|
BlockPos blockPos = this.getBlockPos();
|
||||||
|
- int i = 80;
|
||||||
|
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);
|
||||||
|
@@ -321,6 +323,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
public boolean saveStructure(boolean bl) {
|
||||||
|
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||||
|
+ // Scissors - 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
|
||||||
@ -110,32 +140,37 @@ index ab3e35069a069040f72900a9581f41848e4c4653..d390b05486dcaa563269500b350aecd9
|
|||||||
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();
|
||||||
@@ -368,6 +379,13 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -358,6 +370,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
if (structureTemplate == null) {
|
|
||||||
return false;
|
public boolean loadStructure(ServerLevel world, boolean bl) {
|
||||||
} else {
|
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - 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);
|
+
|
||||||
return true;
|
StructureTemplateManager structureTemplateManager = world.getStructureManager();
|
||||||
}
|
|
||||||
@@ -408,6 +426,14 @@ public class StructureBlockEntity extends BlockEntity {
|
Optional<StructureTemplate> optional;
|
||||||
|
@@ -403,6 +425,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unloadStructure() {
|
public void unloadStructure() {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - 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;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
|
+
|
||||||
if (this.structureName != null) {
|
if (this.structureName != null) {
|
||||||
ServerLevel serverLevel = (ServerLevel)this.level;
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
@ -1,19 +1,21 @@
|
|||||||
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 May 2024 12:24:26 -0500
|
Date: Thu, 8 Jun 2023 19:32:11 -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 8ff815b1bb77eab735c65fa9c6bf469dca8562c4..8768ab338836569d53e0a70cc5f097b5a6d721ec 100644
|
index 468f64afb7e9b3ef579205d3beea025deb31b460..71a32f8dfdf043f55f092225a13884ae8935e67c 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
|
||||||
@@ -901,7 +901,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -862,7 +862,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
boolean flag = scoreboardteam != null && this.level().getScoreboard().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);
|
||||||
+ // Scissors - Prevent log spam possible with this error message, easily provokable by players in creative.
|
+ // Scissors start - Prevent log spam possible with this error message, easily provokable by players in creative.
|
||||||
|
+ // LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
||||||
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
173
patches/server/0030-Block-server-side-chunkbans.patch
Normal file
173
patches/server/0030-Block-server-side-chunkbans.patch
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Thu, 8 Jun 2023 19:41:10 -0500
|
||||||
|
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 fbfadeb83719b81f42724e79c59e92ed88fdece7..bcb9d99359fb3e03c86d7429d9bcfe63b6c0f5d5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
@@ -6,9 +6,18 @@ import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
|
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||||
|
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.PacketFlow;
|
||||||
|
+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.flow = side;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ private static int tryWrite(Packet packet, FriendlyByteBuf friendlyByteBuf, ChannelHandlerContext channelHandlerContext, int i) {
|
||||||
|
+ friendlyByteBuf.writeVarInt(i);
|
||||||
|
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get();
|
||||||
|
+
|
||||||
|
+ int j = friendlyByteBuf.writerIndex();
|
||||||
|
+ packet.write(friendlyByteBuf);
|
||||||
|
+ int k = friendlyByteBuf.writerIndex() - j;
|
||||||
|
+ int packetLength = friendlyByteBuf.readableBytes();
|
||||||
|
+ if (k > 8388608 || packetLength > MAX_PACKET_SIZE) {
|
||||||
|
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big (is " + k + "): " + packet));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return k;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
|
||||||
|
ConnectionProtocol connectionProtocol = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get();
|
||||||
|
if (connectionProtocol == null) {
|
||||||
|
@@ -33,38 +59,66 @@ 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(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ int k;
|
||||||
|
try {
|
||||||
|
- int j = friendlyByteBuf.writerIndex();
|
||||||
|
- packet.write(friendlyByteBuf);
|
||||||
|
- int k = friendlyByteBuf.writerIndex() - j;
|
||||||
|
- if (false && k > 8388608) { // Paper - disable
|
||||||
|
- throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet);
|
||||||
|
- } else {
|
||||||
|
- int l = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get().getId();
|
||||||
|
- JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k);
|
||||||
|
- }
|
||||||
|
+ k = tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
|
||||||
|
} catch (Throwable var10) {
|
||||||
|
- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var10); // Paper - Give proper error message
|
||||||
|
- if (packet.isSkippable()) {
|
||||||
|
- throw new SkipPacketException(var10);
|
||||||
|
- } else {
|
||||||
|
- throw var10;
|
||||||
|
+ packet = capPacket(packet, i);
|
||||||
|
+ if (packet == null) {
|
||||||
|
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
|
||||||
|
}
|
||||||
|
+ friendlyByteBuf.clear();
|
||||||
|
+ k = tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
- // Paper start
|
||||||
|
- int packetLength = friendlyByteBuf.readableBytes();
|
||||||
|
- if (packetLength > MAX_PACKET_SIZE) {
|
||||||
|
- throw new PacketTooLargeException(packet, packetLength);
|
||||||
|
- }
|
||||||
|
- // Paper end
|
||||||
|
+ int l = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get().getId();
|
||||||
|
+ JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k);
|
||||||
|
+ // 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 ClientboundSetEntityDataPacket) {
|
||||||
|
+ return null; // Skip
|
||||||
|
+ } 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 ClientboundSystemChatPacket) {
|
||||||
|
+ return null;
|
||||||
|
+ } else if (packet instanceof ClientboundDisguisedChatPacket) {
|
||||||
|
+ return 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 {
|
||||||
|
+ LOGGER.error("Packet with ID {} was too large and was not caught. Please report this to the Scissors developers.", i);
|
||||||
|
+ 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 39b879f21f958dbd91ab0f74e5d4f3c74928fc33..c5d568ce15879be812207f4cd7819f2f6e7d0f7e 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
|
||||||
|
|
||||||
|
+ // 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) {
|
@ -1,32 +1,32 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Allink <arclicious@vivaldi.net>
|
||||||
Date: Sat, 11 May 2024 13:02:20 -0500
|
Date: Tue, 5 Jul 2022 04:12:31 +0100
|
||||||
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 5e9202bc7fc649764568b55d66ba0d684118c00c..31a6be18075723eb53fd1cbb664429e49909cf66 100644
|
index 61f6b51b9d868ae6bd79185cc066976a094da8ce..2807dbb730974ca4d3a7c7fd1358e2438628bc50 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,8 @@ import java.util.function.Consumer;
|
@@ -1,5 +1,6 @@
|
||||||
import java.util.stream.Collectors;
|
package net.minecraft.server.network;
|
||||||
import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
import net.minecraft.ChatFormatting;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.Util;
|
import com.google.common.primitives.Floats;
|
||||||
import net.minecraft.advancements.AdvancementHolder;
|
import com.mojang.brigadier.ParseResults;
|
||||||
@@ -2033,6 +2035,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -2066,6 +2067,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
Entity entity = packet.getEntity(worldserver);
|
Entity entity = packet.getEntity(worldserver);
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
+ // Scissors start - Add spectator teleport event
|
+ // Scissors start - Add spectator teleport event
|
||||||
+ final SpectatorTeleportEvent event = new SpectatorTeleportEvent(this.player.getBukkitEntity(), entity.getBukkitEntity());
|
+ final SpectatorTeleportEvent event = new SpectatorTeleportEvent(this.player.getBukkitEntity(), entity.getBukkitEntity());
|
||||||
+ if (!event.callEvent()) {
|
+
|
||||||
|
+ if(!event.callEvent()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
|
+
|
||||||
this.player.teleportTo(worldserver, entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit
|
this.player.teleportTo(worldserver, entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit
|
||||||
return;
|
return;
|
||||||
}
|
}
|
@ -1,18 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:24:35 -0500
|
|
||||||
Subject: [PATCH] Improve validation of ResourceLocations
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java
|
|
||||||
index 5014192edb9616ce725fc1592832034789527b6f..64da1b0afd51720803aba0d9e86d0b1743bdb0da 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java
|
|
||||||
@@ -21,6 +21,7 @@ public final class CraftNamespacedKey {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NamespacedKey fromMinecraft(ResourceLocation minecraft) {
|
|
||||||
+ if (minecraft == null) throw new IllegalArgumentException("Null ResourceLocation provided"); // Scissors
|
|
||||||
return new NamespacedKey(minecraft.getNamespace(), minecraft.getPath());
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +1,31 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Allink <arclicious@vivaldi.net>
|
||||||
Date: Sat, 11 May 2024 13:04:21 -0500
|
Date: Sun, 10 Jul 2022 02:55:01 +0100
|
||||||
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 2b93d90da92559da021bac81bb3bc0a4e556ffb6..f8c6d5e2e384e3cf549c68b71c77b0f376cf32f0 100644
|
index 2807dbb730974ca4d3a7c7fd1358e2438628bc50..37fcbdcddaa6cbfd6ae37d70cffab957c90f4e07 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
|
||||||
@@ -31,6 +31,7 @@ import java.util.stream.Stream;
|
@@ -30,6 +30,8 @@ import java.util.function.UnaryOperator;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
|
||||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.CrashReport;
|
||||||
import net.minecraft.advancements.AdvancementHolder;
|
import net.minecraft.CrashReportCategory;
|
||||||
@@ -2964,6 +2965,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -2985,6 +2987,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
public void handleContainerClick(ServerboundContainerClickPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
if (this.player.isImmobile()) return; // CraftBukkit
|
||||||
|
+
|
||||||
|
this.player.resetLastActionTime();
|
||||||
|
if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit
|
||||||
|
boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
|
||||||
|
@@ -3006,6 +3009,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:25:43 -0500
|
|
||||||
Subject: [PATCH] Don't log on too many chained updates
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
||||||
index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..ecdcf4cf8650270ce7595905ce9d498eee520dcd 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
||||||
@@ -58,7 +58,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
|
||||||
this.stack.push(entry);
|
|
||||||
}
|
|
||||||
} else if (this.count - 1 == this.maxChainedNeighborUpdates) {
|
|
||||||
- LOGGER.error("Too many chained neighbor updates. Skipping the rest. First skipped position: " + pos.toShortString());
|
|
||||||
+ // Scissors - don't log
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bl) {
|
|
@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 11 Jul 2022 17:29:12 -0300
|
||||||
|
Subject: [PATCH] Validate block 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
|
||||||
|
index 37fcbdcddaa6cbfd6ae37d70cffab957c90f4e07..01f88bf2f4872884a9c4c2d1d5f1369c61fb0ebf 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1375,7 +1375,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
- if (this.player.hasPermissions(2)) {
|
||||||
|
+ if (this.player.hasPermissions(2) && Level.isInSpawnableBounds(packet.getPos())) { // Scissors - Validate block entity tag query positions
|
||||||
|
BlockEntity tileentity = this.player.level().getBlockEntity(packet.getPos());
|
||||||
|
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
||||||
|
|
@ -1,85 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:34:17 -0500
|
|
||||||
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
|
|
||||||
index 5cee02970241caafd151cadf08fc8d7092ec13d9..81e16e36b1950d4ae81cb09c39b36d7d4ba91d31 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
|
||||||
@@ -14,7 +14,7 @@ public class ServerboundSetCommandMinecartPacket implements Packet<ServerGamePac
|
|
||||||
public static final StreamCodec<FriendlyByteBuf, ServerboundSetCommandMinecartPacket> STREAM_CODEC = Packet.codec(
|
|
||||||
ServerboundSetCommandMinecartPacket::write, ServerboundSetCommandMinecartPacket::new
|
|
||||||
);
|
|
||||||
- private final int entity;
|
|
||||||
+ public final int entity; // Scissors - private -> public
|
|
||||||
private final String command;
|
|
||||||
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
|
|
||||||
index 779d44f878e3ae48f1808d1f48bf2b3120cc97ed..87d0dc96d8592612cefa25c378805aeea131b99e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -31,6 +31,9 @@ import java.util.stream.Stream;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
|
||||||
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
|
||||||
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
|
||||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
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.projectile.AbstractArrow;
|
|
||||||
import net.minecraft.world.entity.vehicle.Boat;
|
|
||||||
+import net.minecraft.world.entity.vehicle.MinecartCommandBlock;
|
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
||||||
import net.minecraft.world.inventory.AnvilMenu;
|
|
||||||
import net.minecraft.world.inventory.BeaconMenu;
|
|
||||||
@@ -197,6 +201,8 @@ import net.minecraft.world.phys.Vec3;
|
|
||||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
||||||
+import org.bukkit.craftbukkit.block.CraftCommandBlock;
|
|
||||||
+import org.bukkit.craftbukkit.entity.CraftMinecartCommand;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
@@ -931,6 +937,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), s, new CraftCommandBlock(this.player.level().getWorld(), tileentitycommand));
|
|
||||||
+ if (!event.callEvent()) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ s = event.getNewCommand();
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
commandblocklistenerabstract.setCommand(s);
|
|
||||||
commandblocklistenerabstract.setTrackOutput(flag);
|
|
||||||
if (!flag) {
|
|
||||||
@@ -962,7 +977,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
||||||
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
|
|
||||||
|
|
||||||
if (commandblocklistenerabstract != null) {
|
|
||||||
- commandblocklistenerabstract.setCommand(packet.getCommand());
|
|
||||||
+ // Scissors start - Implement command block events
|
|
||||||
+ String command = packet.getCommand();
|
|
||||||
+ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), commandblocklistenerabstract.getCommand(), command, new CraftMinecartCommand(this.cserver, (MinecartCommandBlock) this.player.level().getEntity(packet.entity)));
|
|
||||||
+
|
|
||||||
+ if (!event.callEvent()) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ command = event.getNewCommand();
|
|
||||||
+ commandblocklistenerabstract.setCommand(command);
|
|
||||||
+ // Scissors end
|
|
||||||
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
|
|
||||||
if (!packet.isTrackOutput()) {
|
|
||||||
commandblocklistenerabstract.setLastOutput((Component) null);
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 16 Aug 2022 17:13:02 +0100
|
||||||
|
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
|
||||||
|
index 0f70be614f8f5350ad558d0ae645cdf0027e1e76..6f036df37609daf33db3884174406e1ccd339735 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
@@ -3,12 +3,14 @@ package org.bukkit.craftbukkit.util;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.ImmutableMap.Builder;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
+
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
+
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.network.chat.ClickEvent;
|
||||||
|
import net.minecraft.network.chat.ClickEvent.Action;
|
||||||
|
@@ -199,6 +201,11 @@ public final class CraftChatMessage {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
||||||
|
+ // Scissors start - Refuse to convert legacy messages over 1k characters
|
||||||
|
+ if (message.length() > 1_000) {
|
||||||
|
+ return new Component[]{Component.empty()};
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return new StringMessage(message, keepNewlines, plain).getOutput();
|
||||||
|
}
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
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: Fri, 19 Aug 2022 00:49:38 -0600
|
Date: Mon, 22 Aug 2022 21:33:37 -0500
|
||||||
Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
|
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 bf2d91bbb4bf401696f5f5d14a67e3920a179084..e31102bb56fac4ffc1e114cc8ea2075af0f92e7f 100644
|
index 66cf0a6cd1525ecf2615809210a26d55f445d07d..74fb79d4ea11f88f2c0de65b492a5fecc49684f1 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
|
||||||
@@ -279,6 +279,13 @@ public abstract class HangingEntity extends Entity {
|
@@ -270,6 +270,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,41 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:39:39 -0500
|
|
||||||
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
|
|
||||||
index 0dfb8109fd8c022b079da00f6a0e3fc85b57bf7a..fdfe3ca7c2a1d34567651e64933392c4a17bd751 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
|
||||||
@@ -231,7 +231,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
||||||
- this.hivePos = (BlockPos) NbtUtils.readBlockPos(nbt, "hive_pos").orElse(null); // CraftBukkit - decompile error
|
|
||||||
+ // Scissors start - limit hive_pos
|
|
||||||
+ if (nbt.contains("hive_pos"))
|
|
||||||
+ {
|
|
||||||
+ final BlockPos savedHivePos = NbtUtils.readBlockPos(nbt, "hive_pos").orElse(null); // CraftBukkit - decompile error
|
|
||||||
+ this.hivePos = this.level().isLoadedAndInBounds(savedHivePos) ? savedHivePos : null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
this.savedFlowerPos = (BlockPos) NbtUtils.readBlockPos(nbt, "flower_pos").orElse(null); // CraftBukkit - decompile error
|
|
||||||
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
|
|
||||||
index fd3b37dde54623ba38186efb2a64d364c86b81d2..ae1051a7ebc2b2bf6d5bf5582443fedeb307ee01 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
|
||||||
@@ -111,7 +111,10 @@ public class Vex extends Monster implements TraceableEntity {
|
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
||||||
super.readAdditionalSaveData(nbt);
|
|
||||||
if (nbt.contains("BoundX")) {
|
|
||||||
- this.boundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
|
||||||
+ // Scissors start - Limit Vex bound origin
|
|
||||||
+ final BlockPos savedBoundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
|
||||||
+ this.boundOrigin = this.level().isLoadedAndInBounds(savedBoundOrigin) ? savedBoundOrigin : null;
|
|
||||||
+ // Scissors end - Limit Vex bound origin
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nbt.contains("LifeTicks")) {
|
|
@ -1,32 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:49:11 -0500
|
|
||||||
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
|
|
||||||
index 1b1a210a86121049e507a497649727a99452c0a2..5501d94f3b39665a94062ae97b3739ae197dadb1 100644
|
|
||||||
--- 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
|
|
||||||
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
|
|
||||||
@Override
|
|
||||||
public void doServerTick() {
|
|
||||||
if (this.targetLocation == null) {
|
|
||||||
- LOGGER.warn("Aborting charge player as no target was set.");
|
|
||||||
+ // Scissors - Mute invalid Enderdragon phases
|
|
||||||
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
|
||||||
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
|
|
||||||
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
|
|
||||||
index c5269c3117901b8521720d1b32689d7f600f20a3..02dd6f72aa16e6b3edec700b7bc82a84b5ca8dd9 100644
|
|
||||||
--- 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
|
|
||||||
@@ -31,7 +31,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
|
|
||||||
@Override
|
|
||||||
public void doServerTick() {
|
|
||||||
if (this.attackTarget == null) {
|
|
||||||
- LOGGER.warn("Skipping player strafe phase because no player was found");
|
|
||||||
+ // Scissors - Mute invalid Enderdragon phases
|
|
||||||
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
|
||||||
} else {
|
|
||||||
if (this.currentPath != null && this.currentPath.isDone()) {
|
|
93
patches/server/0036-Prevent-velocity-freeze.patch
Normal file
93
patches/server/0036-Prevent-velocity-freeze.patch
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 27 Nov 2022 05:14:18 +0000
|
||||||
|
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 2096e8a0bdbcfc865f175f3a01ab688542481531..15d375221c253dc4ca1b598eb80b4638eba6f8d0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.entity.projectile;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.MathUtility;
|
||||||
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@@ -41,9 +42,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
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;
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = d3 / d6 * 0.1D;
|
||||||
|
+ //this.yPower = d4 / d6 * 0.1D;
|
||||||
|
+ //this.zPower = d5 / d6 * 0.1D;
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -141,6 +146,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);
|
||||||
|
@@ -148,9 +172,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);
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -184,9 +212,12 @@ 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,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: Allink <arclicious@vivaldi.net>
|
||||||
Date: Fri, 14 Jun 2024 17:56:03 -0500
|
Date: Wed, 15 Mar 2023 23:13:56 -0500
|
||||||
Subject: [PATCH] Add Scissors configuration file & command
|
Subject: [PATCH] Add Scissors configuration file & command
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
index 7620c72a4c243cbeea245203ce03a97cbfa7d922..a05a348c299a68a61fabcbdcc689a89a81d1301f 100644
|
index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..f83b2c4298bd1a5f65487f64bd6a11fb190a622d 100644
|
||||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
@@ -25,6 +25,7 @@ package co.aikar.timings;
|
@@ -25,6 +25,7 @@ package co.aikar.timings;
|
||||||
@ -16,7 +16,7 @@ index 7620c72a4c243cbeea245203ce03a97cbfa7d922..a05a348c299a68a61fabcbdcc689a89a
|
|||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
@@ -240,7 +241,8 @@ public class TimingsExport extends Thread {
|
@@ -242,7 +243,8 @@ public class TimingsExport extends Thread {
|
||||||
parent.put("config", createObject(
|
parent.put("config", createObject(
|
||||||
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
||||||
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
||||||
@ -26,6 +26,28 @@ index 7620c72a4c243cbeea245203ce03a97cbfa7d922..a05a348c299a68a61fabcbdcc689a89a
|
|||||||
));
|
));
|
||||||
|
|
||||||
new TimingsExport(listeners, parent, history).start();
|
new TimingsExport(listeners, parent, history).start();
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/PositionUtility.java b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
|
index c54535042a7ac12fe46b3b37db8d7b116e9469d5..62bb706e6a11749f588b3f0c3ffb1fbd70f15d64 100644
|
||||||
|
--- a/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
|
@@ -8,7 +8,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
|
public class PositionUtility
|
||||||
|
{
|
||||||
|
- public static Vec3 getValidVec3(double x, double y, double z, Entity entity)
|
||||||
|
+ /*public static Vec3 getValidVec3(double x, double y, double z, Entity entity)
|
||||||
|
{
|
||||||
|
final Level level = entity.level;
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ public class PositionUtility
|
||||||
|
{ // If we throw some sort of exception due to the position being crazy, catch it
|
||||||
|
return new Vec3(0, 0, 0);
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ }*/
|
||||||
|
|
||||||
|
public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
||||||
|
{
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsCommand.java b/src/main/java/me/totalfreedom/scissors/ScissorsCommand.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsCommand.java b/src/main/java/me/totalfreedom/scissors/ScissorsCommand.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..797677d892d83cf54d9a60af1e277b67ed3d6e95
|
index 0000000000000000000000000000000000000000..797677d892d83cf54d9a60af1e277b67ed3d6e95
|
||||||
@ -184,10 +206,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..1ada5b7778f03815455cac1a4aad4411d0cae053
|
index 0000000000000000000000000000000000000000..8ac0e938ccc83c2e71da419b33556090d5083d9e
|
||||||
--- /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,224 @@
|
@@ -0,0 +1,213 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
@ -226,7 +248,7 @@ index 0000000000000000000000000000000000000000..1ada5b7778f03815455cac1a4aad4411
|
|||||||
+
|
+
|
||||||
+ Discord: https://discord.com/invite/mtVQcHn58h
|
+ Discord: https://discord.com/invite/mtVQcHn58h
|
||||||
+ Website: https://scissors.gg/\s
|
+ Website: https://scissors.gg/\s
|
||||||
+ Docs: https://javadoc.scissors.gg/1.20.1/\s
|
+ Docs: https://javadoc.scissors.gg/1.20/\s
|
||||||
+ """;
|
+ """;
|
||||||
+ private static final Pattern SPACE = Pattern.compile(" ");
|
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||||
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||||
@ -277,8 +299,8 @@ index 0000000000000000000000000000000000000000..1ada5b7778f03815455cac1a4aad4411
|
|||||||
+ config.options().header(HEADER);
|
+ config.options().header(HEADER);
|
||||||
+ config.options().copyDefaults(true);
|
+ config.options().copyDefaults(true);
|
||||||
+
|
+
|
||||||
+ version = getInt("config-version", 5);
|
+ version = getInt("config-version", 3);
|
||||||
+ set("config-version", 5);
|
+ set("config-version", 3);
|
||||||
+ readConfig(ScissorsConfig.class, null);
|
+ readConfig(ScissorsConfig.class, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -359,18 +381,6 @@ index 0000000000000000000000000000000000000000..1ada5b7778f03815455cac1a4aad4411
|
|||||||
+ chatSignaturesEnabled = getBoolean("chatSignaturesEnabled", true);
|
+ chatSignaturesEnabled = getBoolean("chatSignaturesEnabled", true);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static boolean excludePlayersFromNbtComponents = false;
|
|
||||||
+ private static void excludePlayersFromNbtComponents()
|
|
||||||
+ {
|
|
||||||
+ excludePlayersFromNbtComponents = getBoolean("excludePlayersFromNbtComponents", false);
|
|
||||||
+ }
|
|
||||||
+ public static int componentDepthLimit = 128;
|
|
||||||
+ private static void componentDepthLimit()
|
|
||||||
+ {
|
|
||||||
+ componentDepthLimit = getInt("componentDepthLimit", 128);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ private static void set(String path, Object val)
|
+ private static void set(String path, Object val)
|
||||||
+ {
|
+ {
|
||||||
+ config.set(path, val);
|
+ config.set(path, val);
|
||||||
@ -412,25 +422,55 @@ index 0000000000000000000000000000000000000000..1ada5b7778f03815455cac1a4aad4411
|
|||||||
+ return config.getString(path, config.getString(path));
|
+ return config.getString(path, config.getString(path));
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
+
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
|
index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..182f68359a7a8c0b331acd103ed3952ea3c33b93 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.network.chat;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public interface OutgoingChatMessage {
|
||||||
|
@@ -42,12 +43,16 @@ public interface OutgoingChatMessage {
|
||||||
|
}
|
||||||
|
public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) {
|
||||||
|
// Paper end
|
||||||
|
+ // Scissors start - Add configuration option to disable chat signatures
|
||||||
|
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
||||||
|
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
||||||
|
- if (!playerChatMessage.isFullyFiltered()) {
|
||||||
|
+ if (!playerChatMessage.isFullyFiltered() && /* Scissors */ ScissorsConfig.chatSignaturesEnabled) {
|
||||||
|
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ sender.connection.sendDisguisedChatMessage(playerChatMessage.decoratedContent(), params);
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
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 244a19ecd0234fa1d7a6ecfea20751595688605d..fdc76373fd458884a45312c6edf2915a811910eb 100644
|
index dae36c6452ccd57a436dd918547b64d59957ab0a..d450cf3cf8ab5cbb5d32a28ee2e4a6717941adef 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
|
||||||
@@ -133,6 +133,7 @@ public class Main {
|
@@ -136,6 +136,7 @@ public class Main {
|
||||||
// Paper start - load config files early for access below if needed
|
// Paper start - load config files 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"));
|
||||||
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors - TODO Change this
|
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors - TODO Change this
|
||||||
// Paper end - load config files early for access below if needed
|
// Paper end
|
||||||
|
|
||||||
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 ad967cc2283f902c76e48a59d59cf0dbdacbb5e3..0342ea47cb313e28027cb76e632a4d5b1565fc8d 100644
|
index 9f422cbeaa52b3e6a0a27af4f8ad4ddb7808483f..bbfb536ddec7f44d2a75d35ab495be26104678a1 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
|
||||||
@@ -234,6 +234,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
// Paper end
|
||||||
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ try {
|
+ try {
|
||||||
@ -445,19 +485,203 @@ index ad967cc2283f902c76e48a59d59cf0dbdacbb5e3..0342ea47cb313e28027cb76e632a4d5b
|
|||||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||||
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/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 5db08432b6afd3639688830e717f40ceaf599248..f2497d08157d3007d20be7ab333ab7c4f282c414 100644
|
index 4946d476a26e1441cea5904cde7c433da4e60717..182291e66717b7e42a500856e99b599daeeae926 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1055,6 +1055,7 @@ public final class CraftServer implements Server {
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.server.network;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
@@ -2375,6 +2376,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
|
||||||
|
|
||||||
|
if (optional.isEmpty()) {
|
||||||
|
+ // Scissors start - Add configuration option to disable chat signatures
|
||||||
|
+ if (!ScissorsConfig.chatSignaturesEnabled)
|
||||||
|
+ {
|
||||||
|
+ return optional;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
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
|
||||||
|
}
|
||||||
|
@@ -2607,11 +2614,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleChatAck(ServerboundChatAckPacket packet) {
|
||||||
|
LastSeenMessagesValidator lastseenmessagesvalidator = this.lastSeenMessages;
|
||||||
|
-
|
||||||
|
- synchronized (this.lastSeenMessages) {
|
||||||
|
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
|
||||||
|
- 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
|
||||||
|
+ synchronized (this.lastSeenMessages) {
|
||||||
|
+ // Scissors start - Add configuration option to disable chat signatures
|
||||||
|
+ if (!ScissorsConfig.chatSignaturesEnabled)
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+ 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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
index 31911c09fe15753ae32fa39417bdc9e9de552a88..97ce45c6e44b1400b8d60b52397617038f8fe911 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
@@ -2,6 +2,8 @@ package net.minecraft.world.item;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -9,8 +11,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.*;
|
||||||
|
import net.minecraft.stats.Stats;
|
||||||
|
import net.minecraft.util.StringUtil;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
@@ -111,8 +112,7 @@ public class WrittenBookItem extends Item {
|
||||||
|
|
||||||
|
public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) {
|
||||||
|
CompoundTag compoundTag = book.getTag();
|
||||||
|
- if (io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper
|
||||||
|
- compoundTag.putBoolean("resolved", true);
|
||||||
|
+ if (compoundTag != null) { // Paper
|
||||||
|
if (!makeSureTagIsValid(compoundTag)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
@@ -161,8 +161,42 @@ public class WrittenBookItem extends Item {
|
||||||
|
component2 = Component.literal(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
- 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) {
|
||||||
|
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 ba6f0ba00cd2635bcd19889dca0349b363b079fe..59fe6f9aba094f8e5393de44d8977e5e48ed76d8 100644
|
||||||
|
--- a/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,11 @@ import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.UnaryOperator;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
+import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.NbtOps;
|
||||||
|
@@ -19,6 +22,7 @@ import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.ComponentUtils;
|
||||||
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.FilteredText;
|
||||||
|
@@ -30,13 +34,14 @@ import net.minecraft.world.level.block.SignBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.phys.Vec2;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.bukkit.block.sign.Side;
|
||||||
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
|
-import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
// CraftBukkit end
|
||||||
|
+import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
|
||||||
|
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
|
||||||
|
|
||||||
|
@@ -285,6 +290,21 @@ 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());
|
||||||
|
// Paper end
|
||||||
|
+ // Scissors start - Add optional permissions to command signs
|
||||||
|
+ final MinecraftServer vanillaServer = player.getServer();
|
||||||
|
+ final CraftServer craftServer = vanillaServer.server;
|
||||||
|
+ final CraftHumanEntity craftPlayer = player.getBukkitEntity();
|
||||||
|
+ final Commands commands = vanillaServer.getCommands();
|
||||||
|
+
|
||||||
|
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||||
|
+ {
|
||||||
|
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
flag1 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
index 717bd02837ac33180ceca92e2f45a8c2e6ad4694..1d904254eaa1be68ca51a2f43c5058ad48a6c05c 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -978,6 +978,7 @@ public final class CraftServer implements Server {
|
||||||
|
}
|
||||||
|
|
||||||
|
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||||
+ me.totalfreedom.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors
|
+ me.totalfreedom.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors
|
||||||
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
|
||||||
@@ -1087,6 +1088,7 @@ public final class CraftServer implements Server {
|
@@ -1009,6 +1010,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
|
||||||
@ -465,42 +689,48 @@ index 5db08432b6afd3639688830e717f40ceaf599248..f2497d08157d3007d20be7ab333ab7c4
|
|||||||
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");
|
||||||
|
|
||||||
@@ -3053,6 +3055,14 @@ public final class CraftServer implements Server {
|
@@ -2759,6 +2761,12 @@ public final class CraftServer implements Server {
|
||||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public YamlConfiguration getScissorsConfig()
|
+ public YamlConfiguration getScissorsConfig()
|
||||||
+ {
|
+ {
|
||||||
+ return me.totalfreedom.scissors.ScissorsConfig.config;
|
+ return me.totalfreedom.scissors.ScissorsConfig.config;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
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 b86ba59158964f73abd6622341a9acb98a33fa44..6101ff98022e7c1ad253edb112a0bf87b139e62b 100644
|
index 0fb3a648ee6bd6cb88515770bcfc70e368313527..5bbfcfe68dace755fe6ec4bc94965d216d998382 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
|
||||||
@@ -169,6 +169,19 @@ public class Main {
|
@@ -180,9 +180,27 @@ public class Main {
|
||||||
.defaultsTo(new File("paper.yml"))
|
.defaultsTo("Unknown Server")
|
||||||
.describedAs("Yml file");
|
.describedAs("Name");
|
||||||
|
// 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");
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
+ // Scissors start
|
||||||
+ 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()
|
OptionSet options = null;
|
||||||
.ofType(File.class)
|
|
||||||
|
// Paper start - preload logger classes to avoid plugins mixing versions
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 18:50:32 -0500
|
|
||||||
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
|
|
||||||
index e79b1ccbdf12006d72401b5be1ac25187033ec59..a7b1a44de0689f7d07bd3e69048b04c28c272159 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
||||||
@@ -147,7 +147,7 @@ public class SkullBlockEntity extends BlockEntity {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nbt.contains("note_block_sound", 8)) {
|
|
||||||
- this.noteBlockSound = ResourceLocation.tryParse(nbt.getString("note_block_sound"));
|
|
||||||
+ this.noteBlockSound = ResourceLocation.tryParse(StringUtil.truncateStringIfNecessary(nbt.getString("note_block_sound"), 32767, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nbt.contains("custom_name", 8)) {
|
|
@ -1,76 +0,0 @@
|
|||||||
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
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 20 Mar 2023 07:04:50 +0000
|
||||||
|
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
|
||||||
|
index 38c027c0fbddf58136b7d67eb7156403a79de4d1..ff3940a0d552140cae820fbed16bfb5e69507822 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -4615,7 +4615,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
|
|
||||||
|
public void setYRot(float yaw) {
|
||||||
|
if (!Float.isFinite(yaw)) {
|
||||||
|
- Util.logAndPauseIfInIde("Invalid entity rotation: " + yaw + ", discarding.");
|
||||||
|
+ // Scissors start - Patch invalid entity rotation log spam
|
||||||
|
+ //Util.logAndPauseIfInIde("Invalid entity rotation: " + yaw + ", discarding.");
|
||||||
|
+ // Scissors end
|
||||||
|
} else {
|
||||||
|
this.yRot = yaw;
|
||||||
|
}
|
||||||
|
@@ -4627,7 +4629,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
|
|
||||||
|
public void setXRot(float pitch) {
|
||||||
|
if (!Float.isFinite(pitch)) {
|
||||||
|
- Util.logAndPauseIfInIde("Invalid entity rotation: " + pitch + ", discarding.");
|
||||||
|
+ // Scissors start - Patch invalid entity rotation log spam
|
||||||
|
+ //Util.logAndPauseIfInIde("Invalid entity rotation: " + pitch + ", discarding.");
|
||||||
|
+ // Scissors end
|
||||||
|
} else {
|
||||||
|
this.xRot = pitch;
|
||||||
|
}
|
@ -1,117 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 19:01:14 -0500
|
|
||||||
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
|
|
||||||
index 3b075dcb6bda40b278296fc8750f2af90c13acc4..a0c3c4faa8c80c880340e0150e16223ac0b5e5a0 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
@@ -1,15 +1,7 @@
|
|
||||||
package net.minecraft.network.chat;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
-import com.google.gson.Gson;
|
|
||||||
-import com.google.gson.GsonBuilder;
|
|
||||||
-import com.google.gson.JsonDeserializationContext;
|
|
||||||
-import com.google.gson.JsonDeserializer;
|
|
||||||
-import com.google.gson.JsonElement;
|
|
||||||
-import com.google.gson.JsonParseException;
|
|
||||||
-import com.google.gson.JsonParser;
|
|
||||||
-import com.google.gson.JsonSerializationContext;
|
|
||||||
-import com.google.gson.JsonSerializer;
|
|
||||||
+import com.google.gson.*;
|
|
||||||
import com.google.gson.stream.JsonReader;
|
|
||||||
import com.mojang.brigadier.Message;
|
|
||||||
import com.mojang.serialization.JsonOps;
|
|
||||||
@@ -24,6 +16,7 @@ import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.core.HolderLookup;
|
|
||||||
import net.minecraft.network.chat.contents.DataSource;
|
|
||||||
@@ -35,8 +28,10 @@ import net.minecraft.network.chat.contents.SelectorContents;
|
|
||||||
import net.minecraft.network.chat.contents.TranslatableContents;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
|
||||||
+import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.level.ChunkPos;
|
|
||||||
// CraftBukkit start
|
|
||||||
+import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
@@ -286,10 +281,70 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
public static class Serializer {
|
|
||||||
|
|
||||||
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
|
|
||||||
+ private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s"); // Scissors
|
|
||||||
|
|
||||||
private Serializer() {}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ static int depthChecker(int depth) {
|
|
||||||
+ depth = depth + 1;
|
|
||||||
+ if (depth > ScissorsConfig.componentDepthLimit) {
|
|
||||||
+ throw new JsonParseException("Depth limit exceeded");
|
|
||||||
+ }
|
|
||||||
+ return depth;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ static int getPenalty(String string) {
|
|
||||||
+ if (PLACEHOLDER_PATTERN.matcher(string).find()) {
|
|
||||||
+ long translate_placeholders = PLACEHOLDER_PATTERN.matcher(string).results().count();
|
|
||||||
+ return (int) translate_placeholders * 12;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
static MutableComponent deserialize(JsonElement json, HolderLookup.Provider registries) {
|
|
||||||
+ int depth = 1;
|
|
||||||
+ if (!json.isJsonPrimitive()) {
|
|
||||||
+ if (!json.isJsonObject()) {
|
|
||||||
+ if (json.isJsonArray()) {
|
|
||||||
+ JsonArray jsonArray = json.getAsJsonArray();
|
|
||||||
+ if (jsonArray.size() <= 0) {
|
|
||||||
+ throw new JsonParseException("Unexpected empty array of components");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (JsonElement ignored : jsonArray) {
|
|
||||||
+ depth = depthChecker(depth);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ JsonObject jsonObject = json.getAsJsonObject();
|
|
||||||
+ if (jsonObject.has("translate")) {
|
|
||||||
+ String s = GsonHelper.getAsString(jsonObject, "translate");
|
|
||||||
+ int penalty = getPenalty(s);
|
|
||||||
+ depth = depthChecker(depth + penalty);
|
|
||||||
+
|
|
||||||
+ if (jsonObject.has("with")) {
|
|
||||||
+ String s1 = GsonHelper.getAsJsonArray(jsonObject, "with").toString();
|
|
||||||
+ penalty = getPenalty(s1);
|
|
||||||
+ depth = depthChecker(depth + penalty);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (jsonObject.has("extra")) {
|
|
||||||
+ JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "extra");
|
|
||||||
+ if (jsonArray.size() <= 0) {
|
|
||||||
+ throw new JsonParseException("Unexpected empty array of components");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (JsonElement ignored : jsonArray) {
|
|
||||||
+ depth = depthChecker(depth);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
return (MutableComponent) ComponentSerialization.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Sun, 2 Apr 2023 16:29:51 -0300
|
||||||
|
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
|
||||||
|
index 60d32afe2eecdfebdc91531ca3672f8f130ac30e..73b0f516f80ef810379860ea74697a3429c646e5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
|
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
|
@@ -177,7 +177,7 @@ public abstract class MinMaxBounds<T extends Number> {
|
||||||
|
return value == null ? null : value * value;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private Doubles(@Nullable Double min, @Nullable Double max) {
|
||||||
|
+ public Doubles(@Nullable Double min, @Nullable Double max) { // Scissors - private -> public
|
||||||
|
super(min, max);
|
||||||
|
this.minSq = squareOpt(min);
|
||||||
|
this.maxSq = squareOpt(max);
|
||||||
|
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
index f25b9330e068c7d9e12cb57a7761cfef9ebaf7bc..ba549e6e5da75413ae3b4083f8b7a5527672de4e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
@@ -10,6 +10,7 @@ import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.MathUtility;
|
||||||
|
import net.minecraft.advancements.critereon.MinMaxBounds;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.arguments.EntityArgument;
|
||||||
|
@@ -60,9 +61,27 @@ public class EntitySelector {
|
||||||
|
this.includesEntities = includesNonPlayers;
|
||||||
|
this.worldLimited = localWorldOnly;
|
||||||
|
this.predicate = basePredicate;
|
||||||
|
- this.range = distance;
|
||||||
|
+
|
||||||
|
+ // Scissors start - Patch large selector distance crash
|
||||||
|
+ this.range = new MinMaxBounds.Doubles(
|
||||||
|
+ distance.getMin() != null ? Math.min(distance.getMin(), 1024) : null,
|
||||||
|
+ distance.getMax() != null ? Math.min(distance.getMax(), 1024) : null
|
||||||
|
+ );
|
||||||
|
this.position = positionOffset;
|
||||||
|
- this.aabb = box;
|
||||||
|
+ if (box != null) {
|
||||||
|
+ this.aabb = new AABB(
|
||||||
|
+ MathUtility.clampDouble(box.minX, -1024, 1025),
|
||||||
|
+ MathUtility.clampDouble(box.minY, -1024, 1025),
|
||||||
|
+ MathUtility.clampDouble(box.minZ, -1024, 1025),
|
||||||
|
+ MathUtility.clampDouble(box.maxX, -1024, 1025),
|
||||||
|
+ MathUtility.clampDouble(box.maxY, -1024, 1025),
|
||||||
|
+ MathUtility.clampDouble(box.maxZ, -1024, 1025),
|
||||||
|
+ false
|
||||||
|
+ );
|
||||||
|
+ } else {
|
||||||
|
+ this.aabb = null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
this.order = sorter;
|
||||||
|
this.currentEntity = senderOnly;
|
||||||
|
this.playerName = playerName;
|
@ -1,65 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Fri, 14 Jun 2024 19:05:44 -0500
|
|
||||||
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
|
|
||||||
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..b27a5f2251012f256652bcb50caf317c31378b63 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
||||||
@@ -2,12 +2,18 @@ package net.minecraft.world.item;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
+import java.util.regex.Matcher;
|
|
||||||
+import java.util.regex.Pattern;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
|
||||||
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.ListTag;
|
|
||||||
+import net.minecraft.nbt.Tag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
@@ -217,6 +223,35 @@ public class BlockItem extends Item {
|
|
||||||
if (!customdata.isEmpty()) {
|
|
||||||
BlockEntity tileentity = world.getBlockEntity(pos);
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ if (customdata.contains("CustomName")) {
|
|
||||||
+ String customName = customdata.getUnsafe().getString("CustomName");
|
|
||||||
+ Pattern EXTRA_PATTERN = Pattern.compile("\"extra\":(\\[(.*?)\\{|\\[\\{)");
|
|
||||||
+ Matcher matcher = EXTRA_PATTERN.matcher(customName);
|
|
||||||
+ if (matcher.find()) {
|
|
||||||
+ String matcherString = matcher.group();
|
|
||||||
+ int penalty = (matcherString.startsWith("\"extra\":[{") ? (int) matcher.results().count() : matcher.group().replace("\"extra\":", "").replace("{", "").length()) * 12;
|
|
||||||
+ if (penalty > ScissorsConfig.componentDepthLimit) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (Tag tag : customdata.getUnsafe().tags.values()) {
|
|
||||||
+ if (tag instanceof CompoundTag compoundTag && compoundTag.contains("messages")) {
|
|
||||||
+ ListTag messagesList = compoundTag.getList("messages", 8);
|
|
||||||
+ Pattern TRANSLATE_PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s");
|
|
||||||
+ Matcher matcher = TRANSLATE_PLACEHOLDER_PATTERN.matcher(messagesList.toString());
|
|
||||||
+ if (matcher.find()) {
|
|
||||||
+ int penalty = (int) matcher.results().count() * 12;
|
|
||||||
+ if (penalty > ScissorsConfig.componentDepthLimit) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
if (tileentity != null) {
|
|
||||||
if (!world.isClientSide && tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission
|
|
||||||
return false;
|
|
@ -0,0 +1,24 @@
|
|||||||
|
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 ab732f0e52ef3c3d3be6ddc827d693fe294e4167..761c8cfb98e05a3c500599520e26e4323725fc85 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
||||||
|
@@ -141,6 +141,13 @@ public class SculkSpreader {
|
||||||
|
Object2IntMap<BlockPos> object2IntMap = new Object2IntOpenHashMap<>();
|
||||||
|
|
||||||
|
for(SculkSpreader.ChargeCursor chargeCursor : this.cursors) {
|
||||||
|
+ // Scissors start
|
||||||
|
+ if (!world.getMinecraftWorld().isLoadedAndInBounds(chargeCursor.getPos()))
|
||||||
|
+ {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
chargeCursor.update(world, pos, random, this, shouldConvertToBlock);
|
||||||
|
if (chargeCursor.charge <= 0) {
|
||||||
|
world.levelEvent(3006, chargeCursor.getPos(), 0);
|
@ -1,157 +0,0 @@
|
|||||||
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();
|
|
31
patches/server/0041-Limit-map-decoration-text-length.patch
Normal file
31
patches/server/0041-Limit-map-decoration-text-length.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
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 decoration text length
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||||
|
index 347d2914f9560a3ee8cea59444bc0dfbb7cf3456..b225f770869832775c9a8a79ffaf89e98245cc2e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||||
|
@@ -2,6 +2,7 @@ package net.minecraft.world.level.saveddata.maps;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
|
||||||
|
@@ -14,6 +15,12 @@ public class MapDecoration {
|
||||||
|
private final Component name;
|
||||||
|
|
||||||
|
public MapDecoration(MapDecoration.Type type, byte x, byte z, byte rotation, @Nullable Component text) {
|
||||||
|
+ // Scissors start - Limit decoration text length
|
||||||
|
+ if (text != null && text.getString().length() > 32) {
|
||||||
|
+ text = null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
this.type = type;
|
||||||
|
this.x = x;
|
||||||
|
this.y = z;
|
@ -1,22 +1,23 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
Date: Fri, 14 Jun 2024 18:20:01 -0500
|
Date: Fri, 28 Apr 2023 16:34:15 -0300
|
||||||
Subject: [PATCH] Limit map decorations
|
Subject: [PATCH] Limit map decoration count
|
||||||
|
|
||||||
|
|
||||||
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
|
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
|
index 3b12030b49b1c539684d75ca3896eb498400ef99..a1f042e5329343489cf30e436a8f553d39e5a6e4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
+++ b/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 {
|
@@ -354,6 +354,12 @@ 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) {
|
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
|
+ // Scissors start - Limit decoration count
|
||||||
+ if (this.decorations.size() > 32) {
|
+ if (this.decorations.size() > 32) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
|
+
|
||||||
int i = 1 << this.scale;
|
int i = 1 << this.scale;
|
||||||
float f = (float) (x - (double) this.centerX) / (float) i;
|
float f = (float) (x - (double) this.centerX) / (float) i;
|
||||||
float f1 = (float) (z - (double) this.centerZ) / (float) i;
|
float f1 = (float) (z - (double) this.centerZ) / (float) i;
|
@ -1,23 +1,24 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
Date: Fri, 14 Jun 2024 18:21:25 -0500
|
Date: Fri, 28 Apr 2023 16:44:50 -0300
|
||||||
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 ca56a0b596976448da6bb2a0e82b3d5cd4133e12..f8198f99244b4a635fa6fc68757acb38008c4564 100644
|
index 2ac23779222369ace69f1e3f7fb12184865b7a43..05c8e4e30b2dce565e84f4c09b3f27244f8c0451 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
|
||||||
@@ -1673,7 +1673,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
@@ -1610,7 +1610,14 @@ 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().toString());
|
||||||
entity.unRide();
|
entity.unRide();
|
||||||
- this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
|
- this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
|
||||||
|
+
|
||||||
+ // Scissors start - Prevent player banning using duplicate UUIDs
|
+ // Scissors start - Prevent player banning using duplicate UUIDs
|
||||||
+ if (entity instanceof ServerPlayer serverPlayer) {
|
+ if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
+ this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED);
|
+ this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ entity.discard(null);
|
+ entity.discard();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
@ -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: Luna <lunahatesgogle@gmail.com>
|
||||||
Date: Fri, 14 Jun 2024 18:22:22 -0500
|
Date: Fri, 28 Apr 2023 16:46:00 -0300
|
||||||
Subject: [PATCH] Don't warn on duplicate entity UUIDs
|
Subject: [PATCH] Don't warn on duplicate entity UUIDs
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||||
index 15ee41452992714108efe53b708b5a4e1da7c1ff..5054dce35127cb0132431021578c345fcbb1f92a 100644
|
index 82ccaf612548a7dbab7e5aeffb6eb8db84367477..5147c5860f0b485ecb82fa06336939d5bb54057d 100644
|
||||||
--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||||
+++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
+++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||||
@@ -415,7 +415,7 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
|
@@ -367,7 +367,7 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.entityByUUID.containsKey(entity.getUUID())) {
|
if (this.entityByUUID.containsKey(entity.getUUID())) {
|
@ -0,0 +1,58 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chipmunk <65827213+ChipmunkMC@users.noreply.github.com>
|
||||||
|
Date: Mon, 1 May 2023 09:13:50 -0400
|
||||||
|
Subject: [PATCH] Make excluding players from nbt components configurable
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
index 9f2a51fddb692f5152c32dcbe1f5a6ba150634e4..39b56ca496ed7369ead21805d476c2b813fcdd1d 100644
|
||||||
|
--- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
@@ -87,8 +87,8 @@ public class ScissorsConfig
|
||||||
|
config.options().header(HEADER);
|
||||||
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
|
- version = getInt("config-version", 3);
|
||||||
|
- set("config-version", 3);
|
||||||
|
+ version = getInt("config-version", 4);
|
||||||
|
+ set("config-version", 4);
|
||||||
|
readConfig(ScissorsConfig.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -169,6 +169,12 @@ public class ScissorsConfig
|
||||||
|
chatSignaturesEnabled = getBoolean("chatSignaturesEnabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static boolean excludePlayersFromNbtComponents = false;
|
||||||
|
+ private static void excludePlayersFromNbtComponents()
|
||||||
|
+ {
|
||||||
|
+ excludePlayersFromNbtComponents = getBoolean("excludePlayersFromNbtComponents", false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
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 e5a2bb129100f0f935c8f10682204e7cb6277142..1ebc6107bbbf18dd9ede1196769e43ee7cb9d448 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.network.chat.contents;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import java.util.List;
|
||||||
|
@@ -32,7 +33,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
||||||
|
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
||||||
|
if (this.compiledSelector != null) {
|
||||||
|
List<? extends Entity> list = this.compiledSelector.findEntities(source);
|
||||||
|
- return list.stream().filter((entity) -> !(entity instanceof Player)).map(NbtPredicate::getEntityTagToCompare); // Scissors - Don't query NBT from players
|
||||||
|
+ // Scissors start
|
||||||
|
+ Stream<? extends Entity> stream = list.stream();
|
||||||
|
+ if (ScissorsConfig.excludePlayersFromNbtComponents) stream = stream.filter((entity) -> !(entity instanceof Player));
|
||||||
|
+ return stream.map(NbtPredicate::getEntityTagToCompare);
|
||||||
|
+ // Scissors end
|
||||||
|
} else {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 29 May 2023 19:34:50 -0300
|
||||||
|
Subject: [PATCH] Fix component extra empty array exploit
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
index 3c0ee4e1f42f6056ca86a6f9f129d467e29a2fbc..9c2c22ee548ad77f0912698f33de5f467f32fb7f 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
@@ -266,6 +266,11 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
if (!jsonelement.isJsonObject()) {
|
||||||
|
if (jsonelement.isJsonArray()) {
|
||||||
|
JsonArray jsonarray = jsonelement.getAsJsonArray();
|
||||||
|
+ // Scissors start
|
||||||
|
+ if (jsonarray.size() <= 0) {
|
||||||
|
+ throw new JsonParseException("Unexpected empty array of components");
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
|
||||||
|
ichatmutablecomponent = null;
|
||||||
|
Iterator iterator = jsonarray.iterator();
|
@ -0,0 +1,163 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Wed, 31 May 2023 18:14:00 -0300
|
||||||
|
Subject: [PATCH] Add depth limit to Component deserializer
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
index 39b56ca496ed7369ead21805d476c2b813fcdd1d..9659cff6412584190ff0c32e01f602de4ff7d3b3 100644
|
||||||
|
--- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
@@ -87,8 +87,8 @@ public class ScissorsConfig
|
||||||
|
config.options().header(HEADER);
|
||||||
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
|
- version = getInt("config-version", 4);
|
||||||
|
- set("config-version", 4);
|
||||||
|
+ version = getInt("config-version", 5);
|
||||||
|
+ set("config-version", 5);
|
||||||
|
readConfig(ScissorsConfig.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -175,6 +175,12 @@ public class ScissorsConfig
|
||||||
|
excludePlayersFromNbtComponents = getBoolean("excludePlayersFromNbtComponents", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static int componentDepthLimit = 128;
|
||||||
|
+ private static void componentDepthLimit()
|
||||||
|
+ {
|
||||||
|
+ componentDepthLimit = getInt("componentDepthLimit", 128);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
index 9c2c22ee548ad77f0912698f33de5f467f32fb7f..ba2879b25e59290ab81501458414a417c121ed03 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
@@ -26,6 +26,7 @@ import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.network.chat.contents.BlockDataSource;
|
||||||
|
@@ -44,6 +45,7 @@ import net.minecraft.util.GsonHelper;
|
||||||
|
import net.minecraft.util.LowerCaseEnumTypeAdapterFactory;
|
||||||
|
// CraftBukkit start
|
||||||
|
import com.google.common.collect.Streams;
|
||||||
|
+import java.util.regex.Pattern; // Scissors
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@@ -254,10 +256,16 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
throw new IllegalStateException("Couldn't get field 'lineStart' for JsonReader", nosuchfieldexception);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
+ private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s"); // Scissors
|
||||||
|
|
||||||
|
public Serializer() {}
|
||||||
|
|
||||||
|
- public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
||||||
|
+ // Scissors start
|
||||||
|
+ private MutableComponent deserialize(JsonElement jsonelement, JsonDeserializationContext jsondeserializationcontext, int depth) throws JsonParseException {
|
||||||
|
+ if (depth > ScissorsConfig.componentDepthLimit) {
|
||||||
|
+ throw new JsonParseException("Depth limit exceeded");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (jsonelement.isJsonPrimitive()) {
|
||||||
|
return Component.literal(jsonelement.getAsString());
|
||||||
|
} else {
|
||||||
|
@@ -266,18 +274,16 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
if (!jsonelement.isJsonObject()) {
|
||||||
|
if (jsonelement.isJsonArray()) {
|
||||||
|
JsonArray jsonarray = jsonelement.getAsJsonArray();
|
||||||
|
- // Scissors start
|
||||||
|
if (jsonarray.size() <= 0) {
|
||||||
|
throw new JsonParseException("Unexpected empty array of components");
|
||||||
|
}
|
||||||
|
- // Scissors end
|
||||||
|
|
||||||
|
ichatmutablecomponent = null;
|
||||||
|
Iterator iterator = jsonarray.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
JsonElement jsonelement1 = (JsonElement) iterator.next();
|
||||||
|
- MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext);
|
||||||
|
+ MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsondeserializationcontext, depth + 1);
|
||||||
|
|
||||||
|
if (ichatmutablecomponent == null) {
|
||||||
|
ichatmutablecomponent = ichatmutablecomponent1;
|
||||||
|
@@ -301,12 +307,17 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
s = GsonHelper.getAsString(jsonobject, "translate");
|
||||||
|
String s1 = GsonHelper.getAsString(jsonobject, "fallback", (String) null);
|
||||||
|
|
||||||
|
+ // Penalize depth for placeholders in translate & fallback
|
||||||
|
+ long translate_placeholders = PLACEHOLDER_PATTERN.matcher(s).results().count();
|
||||||
|
+ long fallback_placeholders = s1 != null ? PLACEHOLDER_PATTERN.matcher(s1).results().count() : 0;
|
||||||
|
+ int penalty = (int)Math.max(translate_placeholders, fallback_placeholders) * 12;
|
||||||
|
+
|
||||||
|
if (jsonobject.has("with")) {
|
||||||
|
JsonArray jsonarray1 = GsonHelper.getAsJsonArray(jsonobject, "with");
|
||||||
|
Object[] aobject = new Object[jsonarray1.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < aobject.length; ++i) {
|
||||||
|
- aobject[i] = Serializer.unwrapTextArgument(this.deserialize(jsonarray1.get(i), type, jsondeserializationcontext));
|
||||||
|
+ aobject[i] = Serializer.unwrapTextArgument(this.deserialize(jsonarray1.get(i), jsondeserializationcontext, depth + 1 + penalty));
|
||||||
|
}
|
||||||
|
|
||||||
|
ichatmutablecomponent = Component.translatableWithFallback(s, s1, aobject);
|
||||||
|
@@ -322,7 +333,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
|
||||||
|
ichatmutablecomponent = Component.score(GsonHelper.getAsString(jsonobject1, "name"), GsonHelper.getAsString(jsonobject1, "objective"));
|
||||||
|
} else if (jsonobject.has("selector")) {
|
||||||
|
- Optional<Component> optional = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
|
||||||
|
+ Optional<Component> optional = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1);
|
||||||
|
|
||||||
|
ichatmutablecomponent = Component.selector(GsonHelper.getAsString(jsonobject, "selector"), optional);
|
||||||
|
} else if (jsonobject.has("keybind")) {
|
||||||
|
@@ -333,7 +344,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
}
|
||||||
|
|
||||||
|
s = GsonHelper.getAsString(jsonobject, "nbt");
|
||||||
|
- Optional<Component> optional1 = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
|
||||||
|
+ Optional<Component> optional1 = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1);
|
||||||
|
boolean flag = GsonHelper.getAsBoolean(jsonobject, "interpret", false);
|
||||||
|
Object object;
|
||||||
|
|
||||||
|
@@ -360,7 +371,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < jsonarray2.size(); ++j) {
|
||||||
|
- ichatmutablecomponent.append((Component) this.deserialize(jsonarray2.get(j), type, jsondeserializationcontext));
|
||||||
|
+ ichatmutablecomponent.append((Component) this.deserialize(jsonarray2.get(j), jsondeserializationcontext, depth + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -370,6 +381,11 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
||||||
|
+ return this.deserialize(jsonelement, jsondeserializationcontext, 1);
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
private static Object unwrapTextArgument(Object text) {
|
||||||
|
if (text instanceof Component) {
|
||||||
|
Component ichatbasecomponent = (Component) text;
|
||||||
|
@@ -388,8 +404,10 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private Optional<Component> parseSeparator(Type type, JsonDeserializationContext context, JsonObject json) {
|
||||||
|
- return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), type, context)) : Optional.empty();
|
||||||
|
+ // Scissors start
|
||||||
|
+ private Optional<Component> parseSeparator(JsonDeserializationContext context, JsonObject json, int depth) {
|
||||||
|
+ return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), context, depth + 1)) : Optional.empty();
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
private void serializeStyle(Style style, JsonObject json, JsonSerializationContext context) {
|
116
patches/server/0048-Add-depth-limit-to-SNBT.patch
Normal file
116
patches/server/0048-Add-depth-limit-to-SNBT.patch
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 22:13:54 +0100
|
||||||
|
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 fbfe810e8be6cb159742f7fd85e7491b9cefa4dc..82b1d851e310504e7373a967dfb5b0b096d36693 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
||||||
|
@@ -169,8 +169,58 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect('}');
|
||||||
|
- return compoundTag;
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add depth limit to SNBT
|
||||||
|
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag;
|
||||||
|
+ // Scissors end
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // 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('[');
|
||||||
|
@@ -203,7 +253,11 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect(']');
|
||||||
|
- return listTag;
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add depth limit to SNBT
|
||||||
|
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag;
|
||||||
|
+ // return listTag;
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -228,7 +282,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(true) {
|
||||||
|
if (this.reader.peek() != ']') {
|
||||||
|
@@ -241,11 +295,11 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeReader == ByteTag.TYPE) {
|
||||||
|
- list.add((T)((NumericTag)tag).getAsByte());
|
||||||
|
+ list.add(((NumericTag)tag).getAsByte()); // Scissors - Remove (T) cast
|
||||||
|
} else if (typeReader == LongTag.TYPE) {
|
||||||
|
- list.add((T)((NumericTag)tag).getAsLong());
|
||||||
|
+ list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast
|
||||||
|
} else {
|
||||||
|
- list.add((T)((NumericTag)tag).getAsInt());
|
||||||
|
+ list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasElementSeparator()) {
|
||||||
|
@@ -257,7 +311,7 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect(']');
|
||||||
|
- return list;
|
||||||
|
+ return (List<T>) list; // Scissors - Cast to List<T>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
86
patches/server/0049-Implement-command-block-events.patch
Normal file
86
patches/server/0049-Implement-command-block-events.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 20:55:18 +0100
|
||||||
|
Subject: [PATCH] Implement command block events
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index a2b96f7b1e98586017dbbf28a73446196738ee99..0227e2c7197c3684677f76ff7f0fe0acc21b6c14 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
package net.minecraft.server.network;
|
||||||
|
|
||||||
|
import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
||||||
|
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
||||||
|
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
@@ -160,6 +162,7 @@ import net.minecraft.world.entity.player.Inventory;
|
||||||
|
import net.minecraft.world.entity.player.ProfilePublicKey;
|
||||||
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
|
import net.minecraft.world.entity.vehicle.Boat;
|
||||||
|
+import net.minecraft.world.entity.vehicle.MinecartCommandBlock;
|
||||||
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
import net.minecraft.world.item.BucketItem;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
@@ -188,6 +191,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraft.world.phys.shapes.BooleanOp;
|
||||||
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
+import org.bukkit.entity.minecart.CommandMinecart;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
@@ -1001,6 +1005,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Implement command block events
|
||||||
|
+ if (commandblocklistenerabstract instanceof org.bukkit.block.CommandBlock commandBlock)
|
||||||
|
+ {
|
||||||
|
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), Objects.requireNonNullElse(commandblocklistenerabstract.getCommand(), ""), s, commandBlock);
|
||||||
|
+ event.callEvent();
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ s = event.getNewCommand();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
commandblocklistenerabstract.setCommand(s);
|
||||||
|
commandblocklistenerabstract.setTrackOutput(flag);
|
||||||
|
if (!flag) {
|
||||||
|
@@ -1032,7 +1051,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
|
||||||
|
|
||||||
|
if (commandblocklistenerabstract != null) {
|
||||||
|
- commandblocklistenerabstract.setCommand(packet.getCommand());
|
||||||
|
+ // Scissors start - Implement command block events
|
||||||
|
+ String command = packet.getCommand();
|
||||||
|
+
|
||||||
|
+ if (commandblocklistenerabstract instanceof CommandMinecart commandMinecart)
|
||||||
|
+ {
|
||||||
|
+ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), Objects.requireNonNullElse(commandblocklistenerabstract.getCommand(), ""), command, commandMinecart);
|
||||||
|
+ event.callEvent();
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ command = event.getNewCommand();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ commandblocklistenerabstract.setCommand(command);
|
||||||
|
+
|
||||||
|
+ // commandblocklistenerabstract.setCommand(packet.getCommand());
|
||||||
|
+
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
|
||||||
|
if (!packet.isTrackOutput()) {
|
||||||
|
commandblocklistenerabstract.setLastOutput((Component) null);
|
@ -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: Luna <lunahatesgogle@gmail.com>
|
||||||
Date: Fri, 14 Jun 2024 18:23:46 -0500
|
Date: Wed, 7 Jun 2023 16:50:35 -0300
|
||||||
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 a6ffbbc1b5021564864e42c0756342352c2b8290..724edea5d4399fef2ddadbe631adef3d22513894 100644
|
index f2325c0c475bb465f5275f78c71949648a860d0c..4ec228ce026ee39eebd17d180fb5caea1b74e6e2 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
|
||||||
@@ -91,7 +91,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
@@ -83,7 +83,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
private double effectRange = -1;
|
private double effectRange = -1;
|
||||||
|
|
||||||
public double getEffectRange() {
|
public double getEffectRange() {
|
||||||
@ -17,10 +17,10 @@ index a6ffbbc1b5021564864e42c0756342352c2b8290..724edea5d4399fef2ddadbe631adef3d
|
|||||||
return this.levels * 10 + 10;
|
return this.levels * 10 + 10;
|
||||||
} else {
|
} else {
|
||||||
return effectRange;
|
return effectRange;
|
||||||
@@ -458,6 +458,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
@@ -415,6 +415,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
|
||||||
+ if (this.effectRange > 256) this.effectRange = 256; // Scissors
|
+ if (this.effectRange > 256) this.effectRange = 256; // Scissors
|
||||||
}
|
}
|
||||||
|
|
19
patches/server/0051-Fix-invalid-armor-trim-exploit.patch
Normal file
19
patches/server/0051-Fix-invalid-armor-trim-exploit.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 12 Jun 2023 17:32:04 -0300
|
||||||
|
Subject: [PATCH] Fix invalid armor trim exploit
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||||
|
index c92981aedebe934cefa1c96a0328fb91fe17acbc..a1e1a94f0eb46b7eb3fe19e416e21e29b33f3e9f 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||||
|
@@ -71,7 +71,7 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta {
|
||||||
|
TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(TRIM_MATERIAL.NBT)));
|
||||||
|
TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(TRIM_PATTERN.NBT)));
|
||||||
|
|
||||||
|
- this.trim = new ArmorTrim(trimMaterial, trimPattern);
|
||||||
|
+ if (trimMaterial != null && trimPattern != null) this.trim = new ArmorTrim(trimMaterial, trimPattern); // Scissors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user