mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 09:58:34 +00:00
Compare commits
215 Commits
Author | SHA1 | Date | |
---|---|---|---|
9323d687ee | |||
8584e392c9 | |||
1db9558e93 | |||
2d640aacf8 | |||
5360df819c | |||
65d7993679 | |||
a5ad3ecedf | |||
11278cf85b | |||
6135a1b975 | |||
66e3a709fd | |||
ab53c6814b | |||
3405fa3232 | |||
59f6462025 | |||
a1fe3d1750 | |||
00033dcc39 | |||
b81bae46e1 | |||
5ea4ed902f | |||
31486dfa18 | |||
f64bb8faef | |||
15efff8ce2 | |||
e7763fa7ea | |||
cbfc1beb6a | |||
ae17467c1b | |||
08930195bb | |||
57d7a75327 | |||
d984c7c69d | |||
8137fc3be6 | |||
904899cebf | |||
af86fbc465 | |||
3bf9c85578 | |||
a58e246027 | |||
e405542287 | |||
a9bfcf6807 | |||
cc7bc46050 | |||
f18b6dae45 | |||
da48bc9763 | |||
db22a6b194 | |||
205e742c56 | |||
9342bc1cbc | |||
8f9ead55be | |||
345a876a96 | |||
2bcc072b4d | |||
29bbdee52a | |||
4216384a4e | |||
218ce6b4f6 | |||
8cc375fae2 | |||
ea97a96485 | |||
a082025718 | |||
b6bdd08731 | |||
45d0803b60 | |||
c4a62cdd67 | |||
70b8aecf57 | |||
344357d4c9 | |||
20b899d08c | |||
4c619e5bf6 | |||
abe80e859a | |||
0f3cbe912a | |||
f8e15546d6 | |||
c6da2c38d2 | |||
9c6fa332cc | |||
dcd2e77668 | |||
d327333931 | |||
3cc85072ce | |||
c0a8f2c8de | |||
785a0df912 | |||
ec540fe8cf | |||
888600908c | |||
06a169e968 | |||
95982e53d4 | |||
a7cf65f55f | |||
a3a2b2e3ef | |||
3740b5b839 | |||
0a52c58984 | |||
52198351ee | |||
aceb6d07db | |||
7f0ce69109 | |||
c69c8303df | |||
1dddffad0d | |||
23ac49a449 | |||
4dc42ffd77 | |||
be8709b6aa | |||
cfa0f1315a | |||
39b51c9c98 | |||
b1d55dd712 | |||
fb0f7a0e6e | |||
d61ec8e005 | |||
24df678717 | |||
30649288d2 | |||
9b774083a1 | |||
6e4690bc33 | |||
1fbdb2897b | |||
c6ebc3f940 | |||
840ea83089 | |||
2b7e841786 | |||
0a8af0044c | |||
5e3b6a6cf9 | |||
2edf8fa89b | |||
5edc7febfe | |||
fcbea8dbf2 | |||
6b23f8bc8f | |||
690ddc47e4 | |||
63388769fa | |||
5f01adf7df | |||
bc03e4c346 | |||
6bc7d62442 | |||
4dd3fb4231 | |||
1ea217f446 | |||
6a4e753d93 | |||
86480faff1 | |||
666fb0285d | |||
b3693eebb8 | |||
b967d20421 | |||
58aafacb0a | |||
4a70956116 | |||
15012da3ac | |||
4644e58727 | |||
ffe270f7e3 | |||
7d9d2d1b19 | |||
586fbef4a0 | |||
b97ad351c5 | |||
8b85104178 | |||
f6f17d3367 | |||
cbe46d2861 | |||
0215674820 | |||
153867c212 | |||
8d04bad165 | |||
a5de04ba78 | |||
830820dfbc | |||
7b46352204 | |||
7b6bb1bd74 | |||
afe71a6ba3 | |||
fa4a8298ed | |||
a2f43a7ab4 | |||
4a96d6865f | |||
efa11ae31f | |||
a2356397db | |||
9139d8537a | |||
1530ddabf9 | |||
442a0e1e2d | |||
966df15c7a | |||
46de5deb9c | |||
95d23dbac5 | |||
1306a6c873 | |||
bde00fb532 | |||
a2200193be | |||
e03a64585c | |||
c3c3691092 | |||
275f305109 | |||
253787181e | |||
97cdd47afa | |||
183f609960 | |||
1db95f6694 | |||
6512c37e24 | |||
765255d611 | |||
ce5f721017 | |||
f203e5630b | |||
4e394aa041 | |||
e92f6946e3 | |||
aa0bc01f7b | |||
6731e603e9 | |||
bc4782d2d0 | |||
df406d6f6d | |||
62fa0e6c6a | |||
e017c84af6 | |||
6c8de52589 | |||
0c6410e8a9 | |||
c59f492237 | |||
45669c2172 | |||
d981e274f1 | |||
8a3dc6c302 | |||
3a60b3ab37 | |||
8074a8306b | |||
b00feaf91a | |||
0e1cc122c3 | |||
40af013bbb | |||
8b0e9c3871 | |||
dd249b8583 | |||
79afac5492 | |||
9877024fa5 | |||
2aec7e25da | |||
dbf90cec2a | |||
7cbe6427cd | |||
9f0cddbcef | |||
f1e08dcc42 | |||
483a476d6b | |||
07bf264e8e | |||
b4b765c036 | |||
31e9accdad | |||
1722cee0e5 | |||
69c3ff7ce7 | |||
3460823829 | |||
49d65f1c1c | |||
5e9e4b6f2b | |||
5ca9ce2099 | |||
4ecd7e939c | |||
22c1ac0796 | |||
64c2270dc4 | |||
b73be0a454 | |||
625be35102 | |||
b9c09dbfcb | |||
cf944e7f5a | |||
7f7c19808f | |||
0d6eb6daef | |||
400436d77a | |||
19ad81accd | |||
f0dc9c94c1 | |||
15d8cdc7b3 | |||
c00bd362d6 | |||
6725d50dcf | |||
aa48ad0b21 | |||
f8d4eb9eaa | |||
08bd23459f | |||
d6ac0443f0 | |||
bd12abe800 | |||
38914f1604 |
3
Jenkinsfile
vendored
3
Jenkinsfile
vendored
@ -18,7 +18,8 @@ pipeline {
|
||||
}
|
||||
sh """
|
||||
#!/bin/sh
|
||||
mv \${WORKSPACE}/build/libs/Scissors-paperclip-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH_NAME}-\${BUILD_NUMBER}.jar
|
||||
BRANCH=\$(echo "\${BRANCH_NAME}" | sed 's/\\//_/g')
|
||||
mv \${WORKSPACE}/build/libs/Scissors-paperclip-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH}-\${BUILD_NUMBER}.jar
|
||||
rm \${WORKSPACE}/build/libs/Scissors-bundler-*.jar
|
||||
"""
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.18.2/)
|
||||
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.19.4/)
|
||||
|
||||
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.
|
||||
|
||||
## Links
|
||||
### [Scissors Download](https://ci.plex.us.org/job/Scissors)
|
||||
### [Scissors Javadoc](https://javadoc.scissors.gg/1.18.2)
|
||||
### [Scissors Download](https://ci.plex.us.org/job/Scissors/)
|
||||
### [Scissors Javadoc](https://javadoc.scissors.gg/1.19.4)
|
||||
### [Scissors Announcements](https://totalfreedom.me/forum/board/139)
|
||||
### [Scissors General Discussion](https://totalfreedom.me/forum/board/140)
|
||||
|
||||
|
@ -8,3 +8,9 @@
|
||||
# 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/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
|
@ -1,11 +1,11 @@
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.3.6"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.5"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://papermc.io/repo/repository/maven-public/"
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -15,9 +15,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:1.5.498.29")
|
||||
paperclip("io.papermc:paperclip:3.0.2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@ -42,7 +42,10 @@ subprojects {
|
||||
tasks.withType<ProcessResources> {
|
||||
filteringCharset = Charsets.UTF_8.name()
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
minHeapSize = "2g"
|
||||
maxHeapSize = "4g"
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven(paperMavenPublicUrl)
|
||||
|
@ -1,8 +1,8 @@
|
||||
group=me.totalfreedom.scissors
|
||||
version=1.18.2-R0.1-SNAPSHOT
|
||||
version=1.19.4-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.18.2
|
||||
paperRef=fc9ee65a32622d03a91db39364b6f106cf88335b
|
||||
mcVersion=1.19.4
|
||||
paperRef=483368e480eb2ec060d8e68b30e14ec96aba6c4e
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
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,5 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
18
gradlew
vendored
18
gradlew
vendored
@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -80,10 +80,10 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && 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"'
|
||||
@ -143,12 +143,16 @@ fi
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@ -205,6 +209,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
15
gradlew.bat
vendored
15
gradlew.bat
vendored
@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
@ -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
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..812e6ae9f1c8eb9558e5109c522d3ce3a7deb35c
|
||||
index 0000000000000000000000000000000000000000..a24cb52a5af62012c5d5acc29e4c3558e92ae572
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||
@@ -0,0 +1,51 @@
|
||||
|
@ -1,12 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Tue, 5 Jul 2022 03:59:18 +0100
|
||||
Date: Tue, 5 Jul 2022 04:10:29 +0100
|
||||
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
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e4c9256c78f8b395aea86e9ea1a112f8e7426c1f
|
||||
index 0000000000000000000000000000000000000000..d7efa63c316ed99c3eccfeadc1b0873b2ccb5d8a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sun, 10 Jul 2022 09:56:34 +0100
|
||||
Date: Sun, 10 Jul 2022 10:12:04 +0100
|
||||
Subject: [PATCH] Add Scissors configuration file
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 79b26045a68ebb9b01e5bd06abbccaaef5489777..eb66a2cf4785c9f8ef4bdebee59f29777bf9fa50 100644
|
||||
index 1d1a1d087dabc9794e0062a064da2cced4062309..1770de3705aa14232b133bce9fac56dfe89faa37 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1897,6 +1897,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
|
||||
|
||||
|
@ -89,12 +89,13 @@ index 0000000000000000000000000000000000000000..722f5839600954998cbbf799e68477d4
|
||||
+}
|
||||
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4248563a590c76dc0d211fec99f6c98becf42b57
|
||||
index 0000000000000000000000000000000000000000..4282f24deb87e52ee19a13b172ec80c6a6017e28
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||
@@ -0,0 +1,77 @@
|
||||
@@ -0,0 +1,78 @@
|
||||
+package me.totalfreedom.scissors.event.block;
|
||||
+
|
||||
+import org.bukkit.block.CommandBlock;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.entity.minecart.CommandMinecart;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
|
@ -1,29 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Telesphoreo <me@telesphoreo.me>
|
||||
Date: Tue, 19 Apr 2022 18:17:43 -0500
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Sat, 12 Mar 2022 22:22:22 -0300
|
||||
Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 0282e3b75470e1a68ea1fc228082483514ba432e..9e78384fdd5727143d3be5f189478ed701fbd0bd 100644
|
||||
index 4f2fa65ade89c5703451dad4f80eeef162b277d1..c3f3cbaf924fc6324cab8d503b92c69f0de5cd42 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -9,8 +9,8 @@ plugins {
|
||||
@@ -7,8 +7,12 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // Scissors start
|
||||
+ implementation(project(":Scissors-API"))
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.18.2-R0.1-SNAPSHOT") // Scissors
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") {
|
||||
+ exclude("io.papermc.paper", "paper-api")
|
||||
+ }
|
||||
+ // Scissors end
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -56,11 +56,17 @@ tasks.jar {
|
||||
@@ -58,11 +62,19 @@ tasks.jar {
|
||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
||||
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
||||
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
+ // Scissors start
|
||||
+ var gitBranch: String;
|
||||
+ if (System.getenv("JENKINS_URL") == null)
|
||||
+ {
|
||||
@ -31,25 +36,26 @@ index 0282e3b75470e1a68ea1fc228082483514ba432e..9e78384fdd5727143d3be5f189478ed7
|
||||
+ } else {
|
||||
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
||||
+ }
|
||||
+ // Scissors end
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Scissors-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Scissors-$implementationVersion", // Scissors
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -148,7 +154,7 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -134,7 +146,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "paperweight"
|
||||
+ group = "paperweight" // Scissors
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 218f5bafeed8551b55b91c7fccaf6935c8b631ca..1434060d64bca5931749278d72c3eca6b0cd5189 100644
|
||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..a46d3f40642bbf249c2d24e689f474d07175ca09 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -593,7 +593,7 @@ public class Metrics {
|
||||
@ -57,24 +63,42 @@ index 218f5bafeed8551b55b91c7fccaf6935c8b631ca..1434060d64bca5931749278d72c3eca6
|
||||
// Only start Metrics, if it's enabled in the config
|
||||
if (config.getBoolean("enabled", true)) {
|
||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger()); // Scissors
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
String minecraftVersion = Bukkit.getVersion();
|
||||
@@ -603,7 +603,7 @@ public class Metrics {
|
||||
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline"));
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"));
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"));
|
||||
@@ -607,11 +607,11 @@ public class Metrics {
|
||||
final String implVersion = org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion();
|
||||
if (implVersion != null) {
|
||||
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
||||
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
||||
+ paperVersion = "git-Scissors-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Scissors
|
||||
} else {
|
||||
paperVersion = "unknown";
|
||||
}
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> paperVersion)); // Scissors
|
||||
|
||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..21ded7c14c56a40feaa7741131be5166947f7169 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||
@Override
|
||||
protected LineReader buildReader(LineReaderBuilder builder) {
|
||||
builder
|
||||
- .appName("Paper")
|
||||
+ .appName("Scissors") // Scissors
|
||||
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
||||
.completer(new ConsoleCommandCompleter(this.server))
|
||||
.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 da15a224b8b974e78b9d8d5f514229b3b2a5a63e..8ca2e2e3d2564ec0cc081ff52334484dd5561e5c 100644
|
||||
index 9f15d9dbdfa74a0640b1a2b4ff695609d4758a4c..c048169628a53462baf2e418136459719b2ac709 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1696,7 +1696,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1682,7 +1682,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@ -84,10 +108,10 @@ index da15a224b8b974e78b9d8d5f514229b3b2a5a63e..8ca2e2e3d2564ec0cc081ff52334484d
|
||||
|
||||
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 8a248e34fce1e04de4460f98b7627df495c66af1..ebd5aeceb4ac1a6300bbfa70218421f0d91b7614 100644
|
||||
index 9f2536d9a73bdb15b5b3004d4da79ca32cee205b..247db707879b53c6ff7259efd76b9e8ff18a9d09 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -249,7 +249,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
@ -97,7 +121,7 @@ index 8a248e34fce1e04de4460f98b7627df495c66af1..ebd5aeceb4ac1a6300bbfa70218421f0
|
||||
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
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..5e6cce78e7987b4aa1c0052262ab8c4563905372 100644
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..741c76c4dfa0bb34cc23bd795c194bdea10418cc 100644
|
||||
--- a/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 {
|
||||
@ -105,7 +129,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..5e6cce78e7987b4aa1c0052262ab8c45
|
||||
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/me.totalfreedom.scissors/Scissors-API/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/me.totalfreedom.scissors/Scissors-API/pom.properties"); // Scissors
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
|
@ -1,17 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sat, 12 Mar 2022 19:34:59 -0700
|
||||
Subject: [PATCH] Return null when a show_entity hover event's UUID isn't valid
|
||||
Subject: [PATCH] UUID validation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
index 6dac24354192bea79a4b9eb721543110826790b2..a9c3c55eb622b18c74d8a9bd472e4e871d11b2aa 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -78,7 +78,11 @@ 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
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||
index b31ff9d237f593e58b42b453632aa2c2af74f986..67feb4e688d049e9f74f0deabb1ec583336a29be 100644
|
||||
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 = Registry.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
|
||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
|
||||
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
||||
+ // Scissors start
|
||||
+ UUID uUID;
|
||||
@ -27,7 +44,7 @@ index b31ff9d237f593e58b42b453632aa2c2af74f986..67feb4e688d049e9f74f0deabb1ec583
|
||||
@@ -186,7 +193,14 @@ public class HoverEvent {
|
||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
||||
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
||||
EntityType<?> entityType = Registry.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
||||
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
||||
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
||||
+ // Scissors start
|
||||
+ UUID uUID;
|
@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 07:39:26 -0600
|
||||
Subject: [PATCH] Fixes invalid LootTables causing problems when applied to
|
||||
Minecart entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
|
||||
index 83dd3c254fd10e4596e454cc75c8e5e976b73ac0..1b2533bbbc62bcb0d00789312ba72a49f8f49f42 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java
|
||||
@@ -16,7 +16,7 @@ public class PaperMinecartLootableInventory implements PaperLootableEntityInvent
|
||||
|
||||
@Override
|
||||
public org.bukkit.loot.LootTable getLootTable() {
|
||||
- return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : null;
|
||||
+ return entity.lootTable != null && !entity.lootTable.getPath().isEmpty() && entity.lootTable.toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.lootTable)) : 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 94dc68182ec5f6dc1294ad15523427836228086a..07075cea760562c901d4469a7f88271c3ffa30bb 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||
@@ -15,7 +15,7 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
|
||||
|
||||
@Override
|
||||
public org.bukkit.loot.LootTable getLootTable() {
|
||||
- return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null;
|
||||
+ return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() && tileEntityLootable.lootTable.toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; // Scissors - Validate length of loot tables before even trying
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
index 8a07d5d25086d7544757bb86181fbe2b5e743d29..ef50d9747f2a027e356b05ad8d94ffb2fd4a423e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -219,7 +219,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
this.lootableData.loadNbt(nbt); // Paper
|
||||
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
||||
if (nbt.contains("LootTable", 8)) {
|
||||
- this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
||||
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors - Validate loot tables
|
||||
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
||||
} if (true) { // Paper - always load the items, table may still remain
|
||||
ContainerHelper.loadAllItems(nbt, this.itemStacks);
|
183
patches/server/0003-ResourceLocation-validation.patch
Normal file
183
patches/server/0003-ResourceLocation-validation.patch
Normal file
@ -0,0 +1,183 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 07:39:26 -0600
|
||||
Subject: [PATCH] ResourceLocation validation
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||
index 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/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
index fa724cd34a7c469ca12068e64295cd00ad215a3c..9f01b0f18bf656a7ab62f07cc98aaded96432665 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
|
||||
|
||||
@@ -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/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index ceacc0d383e2ee674783d3c0a7df0a951595faca..edd79cdca33abfc59dbc5dbf072e8b481f4c1156 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"));
|
||||
+ // 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"))); // Scissors
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..3f4788b7efec73929e1326f0e54a94f8a09a427f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -615,7 +615,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")); // Scissors
|
||||
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
|
||||
}
|
||||
|
||||
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 a3f073066f6e2eea8964461ad2b0409ade202f35..6eecd2e609532bbdde69c0ddc5d6bc2e2e01d1ff 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
|
||||
@@ -289,7 +289,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
|
||||
- this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
|
||||
+ // Scissors start
|
||||
+ final ResourceLocation rl = ResourceLocation.tryParse(s);
|
||||
+ if (rl != null) {
|
||||
+ this.recipesUsed.put(rl, nbttagcompound1.getInt(s));
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
// Paper start - cook speed API
|
||||
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 79b01e32f89defb6b78f4764600d33d4945af592..af6ae368e6871d9db23bd1f13cf7a915005adf6c 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
|
||||
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 18b9b0dc70f6872a9d71c120bcd2edca531b0ac4..4732fff6d1198e5fc4875b4d4523aa2d152817ea 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
@@ -80,8 +80,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||
|
||||
@Override
|
||||
public LootTable getLootTable() {
|
||||
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
||||
- return Bukkit.getLootTable(key);
|
||||
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
||||
+ try {
|
||||
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
||||
+ return Bukkit.getLootTable(key);
|
||||
+ } catch (Exception ex) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
@Override
|
@ -1,31 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 22 Apr 2022 00:59:00 -0500
|
||||
Date: Sun, 13 Mar 2022 03:01:29 -0600
|
||||
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 292ae4a68093b7d939a755e1062cee57da186ab1..4ae030580131252b849fd356717d0323c29cf773 100644
|
||||
index deed77a3d44bc55681483d7f47f148b5220135f2..f927156d6d7b75ff9a1c437478ae3e200962398c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -7,6 +7,9 @@ import java.util.UUID;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -11,6 +11,7 @@ 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.apache.commons.lang3.StringUtils; // Scissors
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -45,7 +48,9 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
import org.bukkit.NamespacedKey;
|
||||
@@ -73,7 +74,7 @@ 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
|
||||
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) { // Scissors
|
||||
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,18 @@ 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 483dc52c793d9f90a35b1d091dd8ce71115e4640..61097643950b1182e3751c6a4629cf5661dcf3b8 100644
|
||||
index 41c9f074203915c31c1ae7a160ce509c13383f84..8b4989593da43fc2fd661ac66bfe5ae1eb5e2780 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.resources.ResourceLocation; // Scissors
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -367,6 +368,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -370,6 +371,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
||||
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
|
||||
@ -25,7 +25,7 @@ index 483dc52c793d9f90a35b1d091dd8ce71115e4640..61097643950b1182e3751c6a4629cf56
|
||||
+ if (!nbttagcompound1.contains("id") || !ResourceLocation.isValidResourceLocation(nbttagcompound1.getString("id")) || EntityType.byString(nbttagcompound1.getString("id")).isEmpty()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Scissor end
|
||||
+ // Scissors end
|
||||
+
|
||||
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
||||
|
@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 11:07:34 -0300
|
||||
Subject: [PATCH] Ignore null/air bundle items in CraftMetaBundle
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java
|
||||
index 8fd1e392258eba9dbe2194c024ad7e0ca3e43cf8..28be42594857f2d8320a035c1f8b95cdc300ddd5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBundle.java
|
||||
@@ -49,7 +49,11 @@ public class CraftMetaBundle extends CraftMetaItem implements BundleMeta {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CompoundTag nbttagcompound1 = list.getCompound(i);
|
||||
|
||||
- this.addItem(CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of(nbttagcompound1)));
|
||||
+ // Scissors start
|
||||
+ CraftItemStack item = CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.of(nbttagcompound1));
|
||||
+ if(item == null || item.getType().isAir()) continue;
|
||||
+ this.addItem(item);
|
||||
+ // Scissors end
|
||||
}
|
||||
}
|
||||
}
|
@ -5,18 +5,10 @@ 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 5607dc10dc1c9d2dbf4e3007890e5e89a175605e..bc30df2009cf0d8edf0040f6fe16587d109cebdb 100644
|
||||
index 936f8babf74b2be6240e5dbc2d0a84f8badada2e..e3d5ded703be73343d821f329175710609dc388f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -1769,6 +1769,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
try {
|
||||
blockParser = blockParser.parse(false);
|
||||
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
|
||||
+ // Scissors - Don't log errors thrown by Brigadier when an error is thrown
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1794,8 +1795,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -1799,8 +1799,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
resource = CraftNamespacedKey.fromMinecraft(key);
|
||||
}
|
||||
} catch (IllegalArgumentException ex) {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
|
||||
|
||||
|
||||
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 ef50d9747f2a027e356b05ad8d94ffb2fd4a423e..cd8ede69be1f728663a670085113d842ec0209af 100644
|
||||
index 08f027cdcaeeca7b545483cb8c5eb8d13e4933b9..d651acb328b52ac252a6a48c1ceccdca8cfb612a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -192,7 +192,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@@ -139,7 +139,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
if (!this.level.isClientSide && reason.shouldDestroy()) {
|
||||
@ -17,8 +17,7 @@ index ef50d9747f2a027e356b05ad8d94ffb2fd4a423e..cd8ede69be1f728663a670085113d842
|
||||
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
||||
+ try {
|
||||
+ Containers.dropContents(this.level, (Entity) this, (Container) this);
|
||||
+ } catch (Exception ignored) {
|
||||
+ }
|
||||
+ } catch (Exception ignored) {}
|
||||
+ // Scissors end
|
||||
}
|
||||
|
@ -5,21 +5,23 @@ 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 9ca37cbf829ff4240ae79fc283bcf9e7f2c728d2..bc71ca6e082a137d17ee0bf43de72095bd19ab3d 100644
|
||||
index d47b3ac633e7936d30abfda6fc46c2c7412d76fe..1b4d21b5960ef09bada7c707fc5ba4e5cc39630c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -379,11 +379,14 @@ public class ItemEntity extends Entity {
|
||||
@@ -416,11 +416,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||
|
||||
- this.setItem(ItemStack.of(nbttagcompound1));
|
||||
- if (this.getItem().isEmpty()) {
|
||||
+ // Scissors start
|
||||
if (this.getItem().isEmpty()) {
|
||||
+ ItemStack item = ItemStack.of(nbttagcompound1);
|
||||
+ if (item.isEmpty()) {
|
||||
this.discard();
|
||||
+ return;
|
||||
}
|
||||
|
||||
+ this.setItem(ItemStack.of(nbttagcompound1));
|
||||
+ this.setItem(item);
|
||||
+ // Scissors end
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ index b79f4ce38a42e4dba8ebdfc97dadc531b7245c7a..9c49be7c53a1f2a8c203341b8ded9cd2
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||
index e816e505cd292d6c5138dff0aeae0e9592c09de0..0f6438dfe0a6620eb87233b9eefbe2340dfc347b 100644
|
||||
index 50fdb086ffec84edc5138737c95f08ed4757a6f3..da312b4670fc0ac07e4ab798d4793025e362783e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||
@@ -42,7 +42,12 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
||||
@@ -41,7 +41,11 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
||||
for (int i = 0; i < pages.size(); i++) {
|
||||
String recipe = pages.getString(i);
|
||||
|
||||
@ -42,8 +42,7 @@ index e816e505cd292d6c5138dff0aeae0e9592c09de0..0f6438dfe0a6620eb87233b9eefbe234
|
||||
+ // Scissors start - Don't add recipes with invalid namespaces
|
||||
+ try {
|
||||
+ this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
||||
+ } catch (Exception ignored) {
|
||||
+ }
|
||||
+ } catch (Exception ignored) {}
|
||||
+ // Scissors end
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 21:56:29 -0600
|
||||
Subject: [PATCH] Validate BlockState and SoundEvent values
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
index a9c3c55eb622b18c74d8a9bd472e4e871d11b2aa..a78595e91cbb6a815c9ef6b4596cdb0e560f9e42 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -235,7 +235,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"));
|
@ -5,7 +5,7 @@ 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 67feb4e688d049e9f74f0deabb1ec583336a29be..63dbbc0f027ab66d183f81d6a8e0f9e0b85ea562 100644
|
||||
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 {
|
||||
@ -27,10 +27,10 @@ index 67feb4e688d049e9f74f0deabb1ec583336a29be..63dbbc0f027ab66d183f81d6a8e0f9e0
|
||||
}
|
||||
}
|
||||
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 f134a2e68d50fba021b19fac4c75fb35d0e252c6..5e79ce09bf8ba48eb7f5dfdcf1511a2964c3281d 100644
|
||||
index 30aec9dff249ae629b22318e52902361a9fa4099..f87a58097889720cbc6510345696e03722b4f0a8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
@@ -396,7 +396,7 @@ public class ItemFrame extends HangingEntity {
|
||||
@@ -432,7 +432,7 @@ public class ItemFrame extends HangingEntity {
|
||||
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
||||
|
||||
if (itemstack.isEmpty()) {
|
@ -1,32 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 21:56:29 -0600
|
||||
Subject: [PATCH] Validate BlockState and SoundEvent values
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
index 050ee055b9a2a0767f58d6677ad7f2d927fbaa54..9ec5bc2c29fc98ac2fbf9ff6231e8c3215ff11a1 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -229,7 +229,7 @@ public final class NbtUtils {
|
||||
if (!compound.contains("Name", 8)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
} else {
|
||||
- Block block = Registry.BLOCK.get(new ResourceLocation(compound.getString("Name")));
|
||||
+ Block block = Registry.BLOCK.get(ResourceLocation.tryParse(compound.getString("Name"))); // Scissors - Validate BlockState
|
||||
BlockState blockState = block.defaultBlockState();
|
||||
if (compound.contains("Properties", 10)) {
|
||||
CompoundTag compoundTag = compound.getCompound("Properties");
|
||||
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 53d0024daf6963ac4dab575666b0d6a74a39a958..ce13ba13c30428558391defbb09a49429dd10422 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -549,7 +549,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) Registry.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
|
||||
+ this.soundEvent = (SoundEvent) Registry.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Scissors - Validate SoundEvents before trying to play them
|
||||
}
|
||||
|
||||
this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow"));
|
@ -5,26 +5,31 @@ 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 bf42969859545a8a520923ef1836ffa4a5cc24a0..2ee707e109f146c83cdea162c119ea96c0ff4f8f 100644
|
||||
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..bc5ed619e05f24f3ad50a6a81306d120869f57a1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -4,6 +4,8 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
||||
@@ -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 java.util.Map;
|
||||
+import io.papermc.paper.util.JarManifests; // Scissors
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
+import org.bukkit.Bukkit; // Scissors
|
||||
|
||||
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";
|
||||
+ 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 final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
|
||||
+ private static final String GITHUB_BRANCH_NAME = getBranch(); // Scissors
|
||||
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME; // Scissors
|
||||
private static @Nullable String mcVer;
|
||||
|
||||
@Override
|
||||
@ -34,8 +39,8 @@ index bf42969859545a8a520923ef1836ffa4a5cc24a0..2ee707e109f146c83cdea162c119ea96
|
||||
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]);
|
||||
+ String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]"); // Scissors
|
||||
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]); // Scissors
|
||||
final Component history = getHistory();
|
||||
|
||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||
@ -45,13 +50,13 @@ index bf42969859545a8a520923ef1836ffa4a5cc24a0..2ee707e109f146c83cdea162c119ea96
|
||||
|
||||
+ // Scissors start - Allow getting git information
|
||||
+ public static String getCommit() {
|
||||
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||
+ return attributes.get("Git-Commit");
|
||||
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
||||
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit");
|
||||
+ }
|
||||
+
|
||||
+ public static String getBranch() {
|
||||
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||
+ return attributes.get("Git-Branch");
|
||||
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
||||
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch");
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
@ -72,14 +77,14 @@ index bf42969859545a8a520923ef1836ffa4a5cc24a0..2ee707e109f146c83cdea162c119ea96
|
||||
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 fbe68bd4739d9a0e7d9bc4c3d5ba8ecfd2d13954..40313b014b4ed5f7e9505bde2827383c19d4377a 100644
|
||||
index bfa091f72d6f477bcaf63d364639a1b4df9b1987..1fe26cb620e8b550790c3e110e2a1180cf0838fd 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -265,7 +265,7 @@ public class Main {
|
||||
@@ -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
|
||||
- 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));
|
@ -1,86 +0,0 @@
|
||||
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 7e1885d9cc568a544e934cede32bff05c20b567a..2481c50d8eb58a003e30e2d957b877bce5123a3a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
@@ -420,7 +420,7 @@ public class AreaEffectCloud extends Entity {
|
||||
try {
|
||||
this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle"))));
|
||||
} 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 d775e19402188e35f79affb4ed636b6533f90ab5..29f5ab80ffbc421da911046678427755c6156894 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
@@ -63,8 +63,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
|
@ -1,24 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 22 Apr 2022 01:26:55 -0500
|
||||
Date: Mon, 28 Mar 2022 13:19:43 -0600
|
||||
Subject: [PATCH] Better handling of invalid JSON components
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index 6efb8b10f17c70b05128039376d254e6beda3841..d280d5b34614442710d64443d03a5bdee86294a9 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -542,13 +542,7 @@ public final class MCUtil {
|
||||
return null;
|
||||
}
|
||||
String string = compound.getString(key);
|
||||
- try {
|
||||
- return Component.Serializer.fromJson(string);
|
||||
- } catch (com.google.gson.JsonParseException e) {
|
||||
- org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage());
|
||||
- }
|
||||
-
|
||||
- return null;
|
||||
+ return Component.Serializer.fromJsonSafe(string);
|
||||
}
|
||||
|
||||
public static ChunkStatus getChunkStatus(ChunkHolder chunk) {
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||
index 984105c226f16746b43bb2d2932e0b87f3a6a70c..faa41d102c06b52bc758ebe3484820376c482093 100644
|
||||
index 37fc353c3e59dd5af2fd6c58ac084fb0e6e155d7..2873ed7c443ed8c8c57a8b1d3e444d229f10f07b 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||
@@ -24,6 +24,8 @@ import java.util.List;
|
||||
@@ -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.ChatFormatting; // Scissors
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
@@ -427,6 +429,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
return Component.Serializer.GSON.toJsonTree(text);
|
||||
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
|
||||
@ -27,7 +45,7 @@ index 984105c226f16746b43bb2d2932e0b87f3a6a70c..faa41d102c06b52bc758ebe348482037
|
||||
+ try {
|
||||
+ return fromJson(json);
|
||||
+ } catch (Exception ex) {
|
||||
+ return new TextComponent("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -36,16 +54,16 @@ index 984105c226f16746b43bb2d2932e0b87f3a6a70c..faa41d102c06b52bc758ebe348482037
|
||||
+ try {
|
||||
+ return fromJson(json);
|
||||
+ } catch (Exception ex) {
|
||||
+ return new TextComponent("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||
+ }
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
@Nullable
|
||||
public static MutableComponent fromJson(String json) {
|
||||
return (MutableComponent) GsonHelper.fromJson(Component.Serializer.GSON, json, MutableComponent.class, false);
|
||||
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 63dbbc0f027ab66d183f81d6a8e0f9e0b85ea562..21ee39172b3efb6414d1cf8fbf36cd463194abab 100644
|
||||
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 {
|
||||
@ -81,44 +99,39 @@ index 63dbbc0f027ab66d183f81d6a8e0f9e0b85ea562..21ee39172b3efb6414d1cf8fbf36cd46
|
||||
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 = Registry.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
||||
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/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
index e3dc56de3f91e03b1543257f72448a734d914ed7..f518e47818a47be0dfd7cccc4845ba9736c6cd8b 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
@@ -78,13 +78,14 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
|
||||
if (this.interpreting) {
|
||||
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..9d20f3f1af8e663a8c13714c8928d4a91653daa4 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; // Scissors
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.arguments.NbtPathArgument;
|
||||
import net.minecraft.nbt.Tag;
|
||||
@@ -107,10 +108,10 @@ 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) -> {
|
||||
+ // Scissors start - Use safer method for getting Components from JSON
|
||||
try {
|
||||
- MutableComponent mutableComponent = Component.Serializer.fromJson(text);
|
||||
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(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
|
||||
return Stream.of();
|
||||
}
|
||||
+ // Scissors end
|
||||
}).reduce((accumulator, current) -> {
|
||||
return accumulator.append(component).append(current);
|
||||
}).orElseGet(() -> {
|
||||
@@ -95,7 +96,7 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
|
||||
return stream.map((string) -> {
|
||||
return new TextComponent(string);
|
||||
}).reduce((accumulator, current) -> {
|
||||
- return accumulator.append(text).append(current);
|
||||
+ return (TextComponent) accumulator.append(text).append(current);
|
||||
}).orElseGet(() -> {
|
||||
return new TextComponent("");
|
||||
});
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index dfd1f37757af1bd808cc2e2d8bf97123adf638bb..876e8f83fab4e255959948e59cabf05478446e4d 100644
|
||||
index 280ee1838106201f5e3ba7753caced6d030f7e55..ade4ed2f219d32050a372283eaebe75f9014ec78 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2215,12 +2215,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2354,12 +2354,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");
|
||||
@ -132,34 +145,8 @@ index dfd1f37757af1bd808cc2e2d8bf97123adf638bb..876e8f83fab4e255959948e59cabf054
|
||||
}
|
||||
|
||||
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 8d5c9813010a0256bd2712a1eabbc91f0f473a41..6ec48f834f5fef8678c690fd5d1ea530ebd2720f 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
|
||||
@@ -402,7 +402,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||
this.levels = nbt.getInt("Levels"); // SPIGOT-5053, use where available
|
||||
// CraftBukkit end
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.name = net.minecraft.server.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 1eccf9424bd8a4bcbeed4ebb1795fd113fe5af18..fcc3d2fbc679fdb70da27d20d19380fa238ba7ea 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
|
||||
@@ -43,7 +43,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
||||
public void load(CompoundTag nbt) {
|
||||
super.load(nbt);
|
||||
if (nbt.contains("CustomName", 8)) {
|
||||
- this.name = net.minecraft.server.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 0efb63d1a4cefede25712daf9cea0f5c3256980f..07fe4043184eda6fa11e0680930100eb914f64c1 100644
|
||||
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 {
|
180
patches/server/0014-Block-server-side-chunkbans.patch
Normal file
180
patches/server/0014-Block-server-side-chunkbans.patch
Normal file
@ -0,0 +1,180 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: ayunami2000 <spwilliamsiam@gmail.com>
|
||||
Date: Mon, 28 Mar 2022 17:02:21 -0400
|
||||
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..c9c0652a22760716f9dbb5fc73bc6fce5148b800 100644
|
||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||
@@ -6,9 +6,17 @@ 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; // Scissors
|
||||
+import net.minecraft.ChatFormatting; // Scissors
|
||||
+import net.minecraft.core.NonNullList; // Scissors
|
||||
+import net.minecraft.nbt.CompoundTag; // Scissors
|
||||
+import net.minecraft.network.chat.Component; // Scissors
|
||||
+import net.minecraft.network.chat.SignedMessageBody; // Scissors
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
+import net.minecraft.network.protocol.game.*; // Scissors
|
||||
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
||||
+import net.minecraft.world.item.ItemStack; // Scissors
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
||||
@@ -19,6 +27,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 +58,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 f3fa2678796c33f3a408a02a1995ad117eac9169..2d912c6e332706371d0e8431685fe038a567e86e 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) {
|
||||
@@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData {
|
||||
int totalTileEntities = 0; // Paper
|
||||
|
||||
for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
||||
+ if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size
|
||||
// Paper start
|
||||
if (++totalTileEntities > TE_LIMIT) {
|
||||
var packet = entry2.getValue().getUpdatePacket();
|
@ -1,54 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 22 Apr 2022 01:19:49 -0500
|
||||
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 2481c50d8eb58a003e30e2d957b877bce5123a3a..6b284666eae8b7e0ef8f54dfe9311a0979b420fe 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||
@@ -143,7 +143,7 @@ public class AreaEffectCloud extends Entity {
|
||||
}
|
||||
|
||||
public void setPotionType(String string) {
|
||||
- this.setPotion(Registry.POTION.get(new ResourceLocation(string)));
|
||||
+ this.setPotion(Registry.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 79abd84696ef099f6b12ddeaa6e398f18c53316a..7070b64c0c66b5c9d09bf7764ce506f4461dbac5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -514,7 +514,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
}), (entity) -> {
|
||||
entity.load(nbt);
|
||||
}, () -> {
|
||||
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||
+ // Scissors - Don't log invalid entities
|
||||
});
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
}
|
||||
|
||||
public static Optional<EntityType<?>> by(CompoundTag nbt) {
|
||||
- return Registry.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
|
||||
+ return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); // Scissors - Validate resource locations
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index e3227a806d9e19923783122ea94ae19e7dbe71da..473dba5213f6aed7573e970119f4b6ad0e4f6367 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -572,7 +572,7 @@ public abstract class Mob extends LivingEntity {
|
||||
|
||||
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
|
||||
if (nbt.contains("DeathLootTable", 8)) {
|
||||
- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable"));
|
||||
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); // Scissors - Validate resource locations
|
||||
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
|
||||
}
|
||||
|
@ -5,33 +5,28 @@ 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
|
||||
index 8f4c83837d0b01a3dbca2607ea718c371db48ef4..fe2717679f84fbef1b8ff1f9a3c3bf0fba8965f1 100644
|
||||
index 584a58659fae6ba3d8b53858890bc6ec509ffb0e..54a7dae26854d320d9e53f63eb411a85a2d78159 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||
@@ -37,8 +37,11 @@ public class ComponentUtils {
|
||||
@@ -39,8 +39,9 @@ public class ComponentUtils {
|
||||
}
|
||||
|
||||
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
||||
+ // Scissors start - Reject oversized components
|
||||
+ MutableComponent result;
|
||||
+
|
||||
+ MutableComponent result; // Scissors
|
||||
if (depth > 100) {
|
||||
- return text.copy();
|
||||
+ result = text.copy();
|
||||
+ result = text.copy(); // Scissors
|
||||
} else {
|
||||
MutableComponent mutableComponent = text instanceof ContextAwareComponent ? ((ContextAwareComponent)text).resolve(source, sender, depth + 1) : text.plainCopy();
|
||||
|
||||
@@ -46,8 +49,12 @@ public class ComponentUtils {
|
||||
// Paper start
|
||||
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
||||
@@ -53,8 +54,9 @@ public class ComponentUtils {
|
||||
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
||||
}
|
||||
|
||||
- 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)); // Scissors
|
||||
}
|
||||
+
|
||||
+ // Would the resulting component exceed 65535 bytes when encoded as a string?
|
||||
+ return Component.Serializer.toJson(result).length() > 65535 ? new TextComponent("") : result;
|
||||
+ // Scissors end
|
||||
+ return Component.Serializer.toJson(result).length() > 65535 ? Component.empty() : result; // Scissors
|
||||
}
|
||||
|
||||
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
@ -1,22 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sun, 10 Jul 2022 09:57:10 +0100
|
||||
Date: Sun, 10 Jul 2022 10:12:04 +0100
|
||||
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
|
||||
index 06bff37e4c1fddd3be6343049a66787c63fb420c..c7f93f7b8531c0783eba0c77e319d9a08588c184 100644
|
||||
index c07eb451a576811a39021f6f97103c77488fd001..b91d3ddf586a103770d63cdcf7ec590f95ee388f 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
package co.aikar.timings;
|
||||
@@ -25,6 +25,7 @@ package co.aikar.timings;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||
import com.google.common.collect.Sets;
|
||||
import io.papermc.paper.adventure.PaperAdventure;
|
||||
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
@@ -241,7 +242,8 @@ public class TimingsExport extends Thread {
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
@@ -242,7 +243,8 @@ public class TimingsExport extends Thread {
|
||||
parent.put("config", createObject(
|
||||
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
||||
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
||||
@ -26,28 +26,19 @@ index 06bff37e4c1fddd3be6343049a66787c63fb420c..c7f93f7b8531c0783eba0c77e319d9a0
|
||||
));
|
||||
|
||||
new TimingsExport(listeners, parent, history).start();
|
||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsCommand.java b/src/main/java/com/github/atlasmediagroup/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
|
||||
index 0000000000000000000000000000000000000000..2085c48fa4dda81bf275aee0b92c9e8206dba8e2
|
||||
index 0000000000000000000000000000000000000000..797677d892d83cf54d9a60af1e277b67ed3d6e95
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsCommand.java
|
||||
@@ -0,0 +1,156 @@
|
||||
+package com.github.atlasmediagroup.scissors;
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsCommand.java
|
||||
@@ -0,0 +1,150 @@
|
||||
+package me.totalfreedom.scissors;
|
||||
+
|
||||
+import com.google.common.base.Functions;
|
||||
+import com.google.common.base.Joiner;
|
||||
+import com.google.common.collect.ImmutableSet;
|
||||
+import com.google.common.collect.Iterables;
|
||||
+import com.google.common.collect.Lists;
|
||||
+import java.io.File;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.Collection;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.Locale;
|
||||
+import java.util.stream.Collectors;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
@ -56,6 +47,10 @@ index 0000000000000000000000000000000000000000..2085c48fa4dda81bf275aee0b92c9e82
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.util.*;
|
||||
+import java.util.stream.Collectors;
|
||||
+
|
||||
+public class ScissorsCommand extends Command
|
||||
+{
|
||||
+
|
||||
@ -67,8 +62,7 @@ index 0000000000000000000000000000000000000000..2085c48fa4dda81bf275aee0b92c9e82
|
||||
+ super(name);
|
||||
+ this.description = "Scissors related commands";
|
||||
+ this.usageMessage = "/scissors [" + Joiner.on(" | ").join(SUBCOMMANDS) + "]";
|
||||
+ this.setPermission("bukkit.command.scissors;" + Joiner.on(';').join(SUBCOMMANDS.stream().map(s -> BASE_PERM + s).collect(
|
||||
+ Collectors.toSet())));
|
||||
+ this.setPermission("bukkit.command.scissors;" + Joiner.on(';').join(SUBCOMMANDS.stream().map(s -> BASE_PERM + s).collect(Collectors.toSet())));
|
||||
+ }
|
||||
+
|
||||
+ private static boolean testPermission(CommandSender commandSender, String permission)
|
||||
@ -188,31 +182,37 @@ index 0000000000000000000000000000000000000000..2085c48fa4dda81bf275aee0b92c9e82
|
||||
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Scissors config reload complete.");
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/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
|
||||
index 0000000000000000000000000000000000000000..9612d02814d6ae45d7087c34e0c8549e6c9aecf9
|
||||
index 0000000000000000000000000000000000000000..38179a93c2b04421a14dfcd53d399152e593a4b4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
@@ -0,0 +1,175 @@
|
||||
+package com.github.atlasmediagroup.scissors;
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||
@@ -0,0 +1,225 @@
|
||||
+package me.totalfreedom.scissors;
|
||||
+
|
||||
+
|
||||
+import com.google.common.base.Throwables;
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
+import java.util.regex.Pattern;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.IOException;
|
||||
+import java.lang.reflect.InvocationTargetException;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.nio.file.Files;
|
||||
+import java.nio.file.Path;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.logging.Level;
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+// TODO - Migrate to new format
|
||||
+public class ScissorsConfig
|
||||
+{
|
||||
+
|
||||
@ -226,7 +226,7 @@ index 0000000000000000000000000000000000000000..9612d02814d6ae45d7087c34e0c8549e
|
||||
+
|
||||
+ Discord: https://discord.com/invite/mtVQcHn58h
|
||||
+ Website: https://scissors.gg/\s
|
||||
+ Docs: https://scissors.gg/javadoc/1.18.2/\s
|
||||
+ Docs: https://javadoc.scissors.gg/1.19.4/\s
|
||||
+ """;
|
||||
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||
@ -239,7 +239,24 @@ index 0000000000000000000000000000000000000000..9612d02814d6ae45d7087c34e0c8549e
|
||||
+
|
||||
+ public static void init(File configFile)
|
||||
+ {
|
||||
+ CONFIG_FILE = configFile;
|
||||
+ final File configFolder = (File) DedicatedServer.getServer().options.valueOf("scissors-settings" + "-directory");
|
||||
+ final Path configFolderPath = configFolder.toPath();
|
||||
+ final Path oldConfigFilePath = configFile.toPath();
|
||||
+ final Path newConfigFilePath = configFolderPath.resolve(configFile.toPath());
|
||||
+
|
||||
+ if (configFile.exists())
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ Files.move(oldConfigFilePath, newConfigFilePath);
|
||||
+ }
|
||||
+ catch (IOException e)
|
||||
+ {
|
||||
+ throw new RuntimeException("Error migrating configuration file to new directory!", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ CONFIG_FILE = newConfigFilePath.toFile();
|
||||
+ config = new YamlConfiguration();
|
||||
+ try
|
||||
+ {
|
||||
@ -260,8 +277,8 @@ index 0000000000000000000000000000000000000000..9612d02814d6ae45d7087c34e0c8549e
|
||||
+ config.options().header(HEADER);
|
||||
+ config.options().copyDefaults(true);
|
||||
+
|
||||
+ version = getInt("config-version", 1);
|
||||
+ set("config-version", 1);
|
||||
+ version = getInt("config-version", 5);
|
||||
+ set("config-version", 5);
|
||||
+ readConfig(ScissorsConfig.class, null);
|
||||
+ }
|
||||
+
|
||||
@ -324,10 +341,36 @@ index 0000000000000000000000000000000000000000..9612d02814d6ae45d7087c34e0c8549e
|
||||
+
|
||||
+ public static boolean runCommandsInBooks = false;
|
||||
+
|
||||
+ private static void runCommandsInBooks() {
|
||||
+ private static void runCommandsInBooks()
|
||||
+ {
|
||||
+ runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
||||
+ }
|
||||
+
|
||||
+ // people still may want them to bypass permissions for warps
|
||||
+ public static boolean commandSignsBypassPermissions = false;
|
||||
+ private static void commandSignsBypassPermissions()
|
||||
+ {
|
||||
+ commandSignsBypassPermissions = getBoolean("commandSignsBypassPermissions", false);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean chatSignaturesEnabled = true;
|
||||
+ private static void chatSignaturesEnabled()
|
||||
+ {
|
||||
+ 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)
|
||||
+ {
|
||||
+ config.set(path, val);
|
||||
@ -369,87 +412,96 @@ index 0000000000000000000000000000000000000000..9612d02814d6ae45d7087c34e0c8549e
|
||||
+ return config.getString(path, config.getString(path));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 1e0d261439255091a6f61485c0747231fbd5b1db..63861ff0c0e942dfafad7ceedfa17864c100b301 100644
|
||||
index cdbf10339a8e8846a8c364de483a0ccd95cd225a..3863684cdf3d613c39935e9f46fd4e7066f95eab 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -114,6 +114,7 @@ public class Main {
|
||||
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = loadConfigFile((File) optionset.valueOf("bukkit-settings"));
|
||||
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = loadConfigFile((File) optionset.valueOf("spigot-settings"));
|
||||
org.bukkit.configuration.file.YamlConfiguration paperConfiguration = loadConfigFile((File) optionset.valueOf("paper-settings"));
|
||||
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = loadConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors
|
||||
@@ -136,6 +136,7 @@ public class Main {
|
||||
// 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 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
|
||||
// Paper end
|
||||
|
||||
Path path1 = Paths.get("eula.txt");
|
||||
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
|
||||
index 257c94f7c1cb00c9a91ab82e311dfd8eca29c538..605602ca03bd0d974b559881ab0ad4da66640002 100644
|
||||
index a7e133f3495e9132a5fdae2c24f225e7b026295a..16f0daad2456ce23f8d73389f62aac9f10235100 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -235,7 +235,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
||||
@@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||
// Paper end
|
||||
-
|
||||
|
||||
+ // Scissors start
|
||||
+ try {
|
||||
+ com.github.atlasmediagroup.scissors.ScissorsConfig.init((java.io.File) options.valueOf("scissors-settings"));
|
||||
+ me.totalfreedom.scissors.ScissorsConfig.init((java.io.File) options.valueOf("scissors-settings"));
|
||||
+ } catch (Exception e) {
|
||||
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||
+ return false;
|
||||
+ }
|
||||
+ com.github.atlasmediagroup.scissors.ScissorsConfig.registerCommands();
|
||||
+ me.totalfreedom.scissors.ScissorsConfig.registerCommands();
|
||||
+ // Scissors end
|
||||
+
|
||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||
this.setResourcePack(dedicatedserverproperties.resourcePack, this.getPackHash());
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index ebd5aeceb4ac1a6300bbfa70218421f0d91b7614..b17f788c982a5c46e493edd447c07bedfcefd2fd 100644
|
||||
index 247db707879b53c6ff7259efd76b9e8ff18a9d09..9bddf6e8deb1e74c6076b5190c0b9b72e39fa2a7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -956,6 +956,7 @@ public final class CraftServer implements Server {
|
||||
@@ -978,6 +978,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||
+ com.github.atlasmediagroup.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);
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -987,6 +988,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1009,6 +1010,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
|
||||
+ com.github.atlasmediagroup.scissors.ScissorsConfig.registerCommands(); // Scissors
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
+ me.totalfreedom.scissors.ScissorsConfig.registerCommands(); // Scissors
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -2714,6 +2716,12 @@ public final class CraftServer implements Server {
|
||||
return com.destroystokyo.paper.PaperConfig.config;
|
||||
@@ -2763,6 +2765,14 @@ public final class CraftServer implements Server {
|
||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||
}
|
||||
|
||||
+ // Scissors start
|
||||
+ @Override
|
||||
+ public YamlConfiguration getScissorsConfig()
|
||||
+ {
|
||||
+ return com.github.atlasmediagroup.scissors.ScissorsConfig.config;
|
||||
+ return me.totalfreedom.scissors.ScissorsConfig.config;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
@Override
|
||||
public void 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
|
||||
index 40313b014b4ed5f7e9505bde2827383c19d4377a..d88a755e18c1da5e5a64ff88d96be33e3dd3dcc3 100644
|
||||
index 1fe26cb620e8b550790c3e110e2a1180cf0838fd..c3ecf912ce83810e07e95de1df4a565018429881 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -160,6 +160,14 @@ public class Main {
|
||||
@@ -180,6 +180,20 @@ public class Main {
|
||||
.defaultsTo("Unknown Server")
|
||||
.describedAs("Name");
|
||||
// Paper end
|
||||
+
|
||||
+ // Scissors start
|
||||
+ acceptsAll(asList("scissors", "scissors-settings"), "File for scissors settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("scissors.yml"))
|
||||
+ .describedAs("Yml file");
|
||||
+ acceptsAll(asList("scissors-dir", "scissors-settings-directory"), "Directory for Scissors settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR))
|
||||
+ .describedAs("Config directory");
|
||||
+
|
||||
+ acceptsAll(asList("scissors", "scissors-settings"), "File for Scissors settings")
|
||||
+ .withRequiredArg()
|
||||
+ .ofType(File.class)
|
||||
+ .defaultsTo(new File("scissors.yml"))
|
||||
+ .describedAs("YAML file");
|
||||
+ // Scissors end
|
||||
}
|
||||
};
|
@ -6,18 +6,18 @@ Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 65844bb02bd3d9ef566d4779106a1f9ef2a2b7bc..f856ac2dfe55a1f1f63725ec20e7b8dd3d394acf 100644
|
||||
index e3d5ded703be73343d821f329175710609dc388f..d1279c60cafa2ad888227996f45011f54d711e38 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.TextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
+import net.minecraft.resources.ResourceLocation; // Scissors
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
@@ -481,7 +482,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
@@ -484,7 +485,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
||||
|
||||
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
@ -1,25 +0,0 @@
|
||||
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 9ec5bc2c29fc98ac2fbf9ff6231e8c3215ff11a1..9ef6b0a861a2b0f6e6d54775c6b0496689d12d66 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||
@@ -76,7 +76,12 @@ public final class NbtUtils {
|
||||
}
|
||||
// Paper start - support string UUID's
|
||||
if (compound.contains("Id", 8)) {
|
||||
- uUID = UUID.fromString(compound.getString("Id"));
|
||||
+ // Scissors start - Validate String UUIDs in game profiles
|
||||
+ try {
|
||||
+ uUID = UUID.fromString(compound.getString("Id"));
|
||||
+ } catch (Exception ignored) {
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
// Paper end
|
||||
|
@ -4,24 +4,35 @@ 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/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
index 8e658eeb4edc83db72c187baa52b7ada7b848af8..e3dc56de3f91e03b1543257f72448a734d914ed7 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import org.slf4j.Logger;
|
||||
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..80e7b0889235288b60d813a569daecb7e08e108e 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;
|
||||
|
||||
@@ -217,7 +218,7 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
|
||||
protected 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();
|
||||
}
|
||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import java.util.List;
|
||||
@@ -11,6 +12,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; // Scissors
|
||||
|
||||
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
||||
public EntityDataSource(String rawPath) {
|
||||
@@ -31,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().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();
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
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 ea68b26e506e48d8238b7ee4266e61b211d52bd2..10d3a1b31233f884823ee9a4bb27d70eac3914df 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/ListTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||
@@ -33,6 +33,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,142 @@
|
||||
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 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 e07cc7970955ce240754cfe424d768c2bba0241a..a4f41bb4ec6cb20f782668c714229b61415cfdfb 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((int)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 a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a9940e327 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 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f74d5d1606 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
|
||||
@@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor {
|
||||
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((int)bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
|
||||
@@ -115,6 +116,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));
|
||||
@@ -132,6 +134,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);
|
||||
@@ -147,7 +150,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 (INLINE_ELEMENT_TYPES.contains(element.getElementType()) && element.size() <= 8) {
|
||||
String string = ELEMENT_SEPARATOR + " ";
|
||||
@@ -190,7 +193,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 {
|
||||
MutableComponent mutableComponent = Component.literal("{");
|
@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Raneri <kevin.raneri@gmail.com>
|
||||
Date: Sat, 2 Apr 2022 02:12:13 -0400
|
||||
Subject: [PATCH] Fix lectern quick move
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
||||
index ff79925bc6437222f9ceb133e21bbc0600cc74ed..e5498a5703f282160b8171a0b81711cfc24d323a 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
|
||||
@@ -120,6 +120,13 @@ public class LecternMenu extends AbstractContainerMenu {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public ItemStack quickMoveStack(net.minecraft.world.entity.player.Player player, int index) {
|
||||
+ return ItemStack.EMPTY;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void setData(int id, int value) {
|
||||
super.setData(id, value);
|
@ -6,10 +6,10 @@ Subject: [PATCH] Fixes creative-killing potion effects and certain potion
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||
index 8bbb9bdcf95989f1737714655f6f6a269d46d7f2..3f5df0a365ddafe4277988767f8366536b928dab 100644
|
||||
index 2cc714585fc3790b70a7ad1ab8034543462e2b3b..a791b9dc3e29d87bf3aa309e772aea43386da89d 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||
@@ -47,6 +47,7 @@ public class MobEffect {
|
||||
@@ -58,6 +58,7 @@ public class MobEffect {
|
||||
}
|
||||
|
||||
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
||||
@ -17,7 +17,7 @@ index 8bbb9bdcf95989f1737714655f6f6a269d46d7f2..3f5df0a365ddafe4277988767f836653
|
||||
if (this == MobEffects.REGENERATION) {
|
||||
if (entity.getHealth() < entity.getMaxHealth()) {
|
||||
entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
|
||||
@@ -75,17 +76,31 @@ public class MobEffect {
|
||||
@@ -86,17 +87,31 @@ public class MobEffect {
|
||||
// CraftBukkit end
|
||||
}
|
||||
} else if ((this != MobEffects.HEAL || entity.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entity.isInvertedHealAndHarm())) {
|
||||
@ -25,9 +25,9 @@ index 8bbb9bdcf95989f1737714655f6f6a269d46d7f2..3f5df0a365ddafe4277988767f836653
|
||||
+ // Scissors start
|
||||
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||
+ if (!god && (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm())) {
|
||||
entity.hurt(DamageSource.MAGIC, (float) (6 << amplifier));
|
||||
}
|
||||
+ // Scissors end
|
||||
entity.hurt(entity.damageSources().magic(), (float) (6 << amplifier));
|
||||
}
|
||||
} else {
|
||||
- entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
||||
+ // Scissors start
|
@ -1,19 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Business Goose <arclicious@vivaldi.net>
|
||||
Date: Fri, 3 Jun 2022 19:30:14 -0500
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Mon, 18 Apr 2022 16:55:19 +0100
|
||||
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
|
||||
index d6ef140bcc35b10f78f2ec2f10c8a153395fc9df..d8393887cc98930815864eca28b07ef89b26f39e 100644
|
||||
index 95a27d28f73039693ca64601954af62028413634..c62552b37d9dd8f0a50ab454af6090d876e0879f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -620,7 +620,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -612,7 +612,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
protected void tickDeath() {
|
||||
++this.deathTime;
|
||||
- if (this.deathTime == 20 && !this.level.isClientSide()) {
|
||||
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level.isClientSide()) {
|
||||
- if (this.deathTime >= 20 && !this.level.isClientSide() && !this.isRemoved()) {
|
||||
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level.isClientSide() && !this.isRemoved()) { // Scissors
|
||||
this.level.broadcastEntityEvent(this, (byte) 60);
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
}
|
@ -1,19 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Business Goose <arclicious@vivaldi.net>
|
||||
Date: Sun, 1 May 2022 14:23:35 -0500
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Thu, 21 Apr 2022 13:52:32 +0100
|
||||
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
||||
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
|
||||
index 96a7bfd921e59f298f0ee502d356cc3552c30ce8..6c1a489f03ecd7dfef161822cf6910f6119c082b 100644
|
||||
index ee4f924afe15c9a4d96af7a55b357076c7b28501..602337661d96a21d13c4da66622b7d845613c5de 100644
|
||||
--- a/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;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+import java.util.concurrent.TimeUnit; // Scissors
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.BlockUtil;
|
||||
import net.minecraft.Util;
|
||||
@ -25,49 +25,47 @@ index 96a7bfd921e59f298f0ee502d356cc3552c30ce8..6c1a489f03ecd7dfef161822cf6910f6
|
||||
public double maxSpeed = 0.4D;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -422,8 +424,10 @@ public abstract class AbstractMinecart extends Entity {
|
||||
@@ -432,8 +434,10 @@ public abstract class AbstractMinecart extends Entity {
|
||||
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));
|
||||
|
||||
- if (!list.isEmpty()) {
|
||||
- for (int l = 0; l < list.size(); ++l) {
|
||||
+ // Scissors - Add a collision debounce
|
||||
+ // Scissors start
|
||||
+ 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) {
|
||||
+ // Scissors end
|
||||
Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) {
|
||||
@@ -450,6 +454,16 @@ public abstract class AbstractMinecart extends Entity {
|
||||
@@ -460,6 +464,14 @@ public abstract class AbstractMinecart extends Entity {
|
||||
entity.push(this);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Scissors - Add a collision debounce
|
||||
+ if (list.size() > 3) {
|
||||
+ lastLargeCollision = System.currentTimeMillis();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors - Delete entity if the collision amount is over 15
|
||||
+ // Scissors start - Add a collision debounce
|
||||
+ if (list.size() > 15) {
|
||||
+ this.discard();
|
||||
+ } else if (list.size() > 3) {
|
||||
+ lastLargeCollision = System.currentTimeMillis();
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
} else {
|
||||
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
|
||||
index 0dbc85c450797d7384e641f80e1b1f8c56fd14fc..99e9867dfc0b3ba8b11dd95c264794f2f0079994 100644
|
||||
index 12e3209c5246ede89daaf8455fe70b4a517e12f6..c5bc5e38ea6b856b1cc3e9c3907f697235b32c50 100644
|
||||
--- a/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;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.IntFunction;
|
||||
+import java.util.concurrent.TimeUnit; // Scissors
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.BlockUtil;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -106,6 +107,7 @@ public class Boat extends Entity {
|
||||
@@ -109,6 +110,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
public double unoccupiedDeceleration = -1;
|
||||
public boolean landBoats = false;
|
||||
// CraftBukkit end
|
||||
@ -75,35 +73,31 @@ index 0dbc85c450797d7384e641f80e1b1f8c56fd14fc..99e9867dfc0b3ba8b11dd95c264794f2
|
||||
|
||||
public Boat(EntityType<? extends Boat> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -398,10 +400,12 @@ public class Boat extends Entity {
|
||||
@@ -421,10 +423,10 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
this.checkInsideBlocks();
|
||||
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||
|
||||
- if (!list.isEmpty()) {
|
||||
+ // Scissors - Add collision debounce
|
||||
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Scissors - add collision debounce, using TimeUnit for better code readability
|
||||
boolean flag = !this.level.isClientSide && !(this.getControllingPassenger() instanceof Player);
|
||||
|
||||
- for (int j = 0; j < list.size(); ++j) {
|
||||
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||
+ for (int j = 0; j < Math.min(3, list.size()); ++j) {
|
||||
+ for (int j = 0; j < Math.min(3, list.size()); ++j) { // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||
Entity entity = (Entity) list.get(j);
|
||||
|
||||
if (!entity.hasPassenger((Entity) this)) {
|
||||
@@ -412,6 +416,16 @@ public class Boat extends Entity {
|
||||
@@ -435,6 +437,14 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Scissors - Add collision debounce
|
||||
+ if (list.size() > 3) {
|
||||
+ lastLargeCollision = System.currentTimeMillis();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors - Delete entity if the collision amount is over 15
|
||||
+ // Scissors start - Add collision debounce
|
||||
+ if (list.size() > 15) {
|
||||
+ this.discard();
|
||||
+ } else if (list.size() > 3) {
|
||||
+ lastLargeCollision = System.currentTimeMillis();
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 22 Apr 2022 01:24:05 -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 901fa17d0f0a3f66923f68f13f183bc4c17f7748..dc9199c0b1fa9b8779afc51d7af4c516d217ddb3 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2991,20 +2991,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
if (this.player.gameMode.isCreative()) {
|
||||
boolean flag = packet.getSlotNum() < 0;
|
||||
ItemStack itemstack = packet.getItem();
|
||||
- CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);
|
||||
|
||||
+ CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);
|
||||
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);
|
||||
// Paper start
|
||||
- BlockEntity tileentity = null;
|
||||
+ // Scissors start - Validate coordinates and whether or not 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.getLevel().isLoadedAndInBounds(blockposition)) {
|
||||
tileentity = this.player.level.getBlockEntity(blockposition);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- if (tileentity != null) {
|
||||
- tileentity.saveToItem(itemstack);
|
||||
+ if (tileentity != null) {
|
||||
+ tileentity.saveToItem(
|
||||
+ itemstack);
|
||||
+ }
|
||||
}
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
|
179
patches/server/0023-Add-custom-classes-used-by-Scissors.patch
Normal file
179
patches/server/0023-Add-custom-classes-used-by-Scissors.patch
Normal file
@ -0,0 +1,179 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Telesphoreo <me@telesphoreo.me>
|
||||
Date: Sat, 11 Jun 2022 22:56:59 -0500
|
||||
Subject: [PATCH] Add custom classes used by Scissors
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/totalfreedom/scissors/MathUtility.java b/src/main/java/me/totalfreedom/scissors/MathUtility.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..754b578b575137a9c48cb20dee965a9388fedb3c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/MathUtility.java
|
||||
@@ -0,0 +1,29 @@
|
||||
+package me.totalfreedom.scissors;
|
||||
+
|
||||
+public class MathUtility
|
||||
+{
|
||||
+ public static int clampInt(int number, int minimum, int maximum)
|
||||
+ {
|
||||
+ return Math.min(Math.max(number, minimum), maximum);
|
||||
+ }
|
||||
+
|
||||
+ public static long clampLong(long number, long minimum, long maximum)
|
||||
+ {
|
||||
+ return Math.min(Math.max(number, minimum), maximum);
|
||||
+ }
|
||||
+
|
||||
+ public static double clampDouble(double number, double minimum, double maximum)
|
||||
+ {
|
||||
+ return Math.min(Math.max(number, minimum), maximum);
|
||||
+ }
|
||||
+
|
||||
+ public static int safeDoubleToInt(double number)
|
||||
+ {
|
||||
+ return (int) clampDouble(number, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ public static int safeLongToInt(long number)
|
||||
+ {
|
||||
+ return (int) clampLong(number, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/totalfreedom/scissors/NbtUtility.java b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b724baaef8d565e41db1af6393d0890e919a5aa8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||
@@ -0,0 +1,74 @@
|
||||
+package me.totalfreedom.scissors;
|
||||
+
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+import javax.annotation.Nullable;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+import net.minecraft.nbt.ListTag;
|
||||
+import net.minecraft.nbt.Tag;
|
||||
+
|
||||
+public class NbtUtility
|
||||
+{
|
||||
+ public static final long MAXIMUM_SIZE = (256 * 1024);
|
||||
+
|
||||
+ public static long getTagSize(@Nullable Tag tag, int depth)
|
||||
+ {
|
||||
+ if (depth > 512)
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (tag == null)
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ long size = 0;
|
||||
+
|
||||
+ if (tag.getType() == CompoundTag.TYPE)
|
||||
+ {
|
||||
+ CompoundTag compoundTag = (CompoundTag) tag;
|
||||
+ for (String key : compoundTag.getAllKeys())
|
||||
+ {
|
||||
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
||||
+ }
|
||||
+ }
|
||||
+ else if (tag.getType() == ListTag.TYPE)
|
||||
+ {
|
||||
+ ListTag listTag = (ListTag) tag;
|
||||
+ for (Tag tag1 : listTag)
|
||||
+ {
|
||||
+ size += getTagSize(tag1, depth + 1);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ size += tag.getAsString().getBytes(StandardCharsets.UTF_8).length;
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ public static long getTagSize(@Nullable CompoundTag tag)
|
||||
+ {
|
||||
+ return getTagSize(tag, 0);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTooLarge(@Nullable CompoundTag tag)
|
||||
+ {
|
||||
+ if (tag == null)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return getTagSize(tag) > MAXIMUM_SIZE;
|
||||
+ }
|
||||
+
|
||||
+ public static class Item
|
||||
+ {
|
||||
+ public static CompoundTag removeItemData(CompoundTag tag)
|
||||
+ {
|
||||
+ CompoundTag cleaned = new CompoundTag();
|
||||
+ cleaned.putString("id", tag.getString("id"));
|
||||
+ cleaned.putByte("Count", tag.getByte("Count"));
|
||||
+ return cleaned;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/me/totalfreedom/scissors/PositionUtility.java b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7c7e39ea96449f8eb5472cd9eca0f45f690b1861
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package me.totalfreedom.scissors;
|
||||
+
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.border.WorldBorder;
|
||||
+import net.minecraft.world.phys.Vec3;
|
||||
+
|
||||
+public class PositionUtility
|
||||
+{
|
||||
+ public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
||||
+ {
|
||||
+ final BlockPos validBlockPos = getValidBlockPos(blockPos, entity);
|
||||
+
|
||||
+ return new Vec3(validBlockPos.getX(), validBlockPos.getY(), validBlockPos.getZ());
|
||||
+ }
|
||||
+
|
||||
+ public static BlockPos getValidBlockPos(BlockPos blockPos, Entity entity)
|
||||
+ {
|
||||
+ final Level level = entity.level;
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ if (level.isInWorldBounds(blockPos))
|
||||
+ {
|
||||
+ return blockPos;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ final int x = blockPos.getX();
|
||||
+ final int y = blockPos.getY();
|
||||
+ final int z = blockPos.getZ();
|
||||
+
|
||||
+ final WorldBorder worldBorder = level.getWorldBorder();
|
||||
+
|
||||
+ final int maxX = MathUtility.safeDoubleToInt(worldBorder.getMaxX());
|
||||
+ final int maxY = level.getMaxBuildHeight();
|
||||
+ final int maxZ = MathUtility.safeDoubleToInt(worldBorder.getMaxZ());
|
||||
+
|
||||
+ final int minX = MathUtility.safeDoubleToInt(worldBorder.getMinX());
|
||||
+ final int minY = level.getMinBuildHeight();
|
||||
+ final int minZ = MathUtility.safeDoubleToInt(worldBorder.getMinZ());
|
||||
+
|
||||
+ return new BlockPos(MathUtility.clampInt(x, minX, maxX), MathUtility.clampInt(y, minY, maxY), MathUtility.clampInt(z, minZ, maxZ));
|
||||
+ }
|
||||
+ }
|
||||
+ catch (Exception e)
|
||||
+ { // If we throw some sort of exception due to the position being crazy, catch it
|
||||
+ return new BlockPos(0, 0, 0);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
@ -1,79 +1,126 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Business Goose <arclicious@vivaldi.net>
|
||||
Date: Sun, 1 May 2022 01:20:13 +0100
|
||||
Subject: [PATCH] Account for items inside containers
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Mon, 18 Apr 2022 03:56:09 +0100
|
||||
Subject: [PATCH] Reset large tags
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..ad3af6d90b68bc55c29243da8814516575299bf0 100644
|
||||
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee14f6dfb7 100644
|
||||
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world;
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -22,10 +23,14 @@ public class ContainerHelper {
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
@@ -22,10 +23,12 @@ 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;
|
||||
+ long total = 0; // Scissors
|
||||
|
||||
for(int i = 0; i < stacks.size(); ++i) {
|
||||
ItemStack itemStack = stacks.get(i);
|
||||
+
|
||||
if (!itemStack.isEmpty()) {
|
||||
+ total += NbtUtility.getTagSize(itemStack.getTag());
|
||||
+ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
compoundTag.putByte("Slot", (byte)i);
|
||||
itemStack.save(compoundTag);
|
||||
@@ -33,7 +38,7 @@ public class ContainerHelper {
|
||||
@@ -33,7 +36,7 @@ public class ContainerHelper {
|
||||
}
|
||||
}
|
||||
|
||||
- if (!listTag.isEmpty() || setIfEmpty) {
|
||||
+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) {
|
||||
+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) { // Scissors
|
||||
nbt.put("Items", listTag);
|
||||
}
|
||||
|
||||
@@ -42,11 +47,18 @@ public class ContainerHelper {
|
||||
@@ -42,11 +45,19 @@ 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;
|
||||
+ long total = 0; // Scissors - Account for items inside containers
|
||||
|
||||
for(int i = 0; i < listTag.size(); ++i) {
|
||||
CompoundTag compoundTag = listTag.getCompound(i);
|
||||
int j = compoundTag.getByte("Slot") & 255;
|
||||
if (j >= 0 && j < stacks.size()) {
|
||||
+ // Scissors start
|
||||
+ total += NbtUtility.getTagSize(compoundTag);
|
||||
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
||||
+ stacks.clear();
|
||||
+ break;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
stacks.set(j, ItemStack.of(compoundTag));
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index d81fcbadc5c0b3d4b54dde5d47a0f847d8ec6918..4c2f3f932654dec5dcbf2d8b0a61122905315e56 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -20,6 +20,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; // Scissors
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
@@ -258,6 +259,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)) {
|
||||
@@ -538,7 +545,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;
|
||||
@@ -874,6 +885,7 @@ public final class ItemStack {
|
||||
// Paper end
|
||||
|
||||
public void setTag(@Nullable CompoundTag nbt) {
|
||||
+ if (NbtUtility.isTooLarge(nbt)) return; // Scissors - Ignore large tags
|
||||
this.tag = nbt;
|
||||
this.processEnchantOrder(this.tag); // Paper
|
||||
if (this.getItem().canBeDepleted()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 888e1f2bc6ea4ddbbcc5466f177233f25b290459..0f19ef250a2f82e49730cb58ea43ee6bf407455a 100644
|
||||
index 6eecd2e609532bbdde69c0ddc5d6bc2e2e01d1ff..907e163e5377335aac828c137deed42af9d2ce38 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
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
||||
@@ -211,6 +212,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
@@ -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; // Scissors
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -212,6 +213,17 @@ 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
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.items) {
|
||||
@ -83,26 +130,26 @@ index 888e1f2bc6ea4ddbbcc5466f177233f25b290459..0f19ef250a2f82e49730cb58ea43ee6b
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.items.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.items;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
index 5a47d58071b83ea911e4cb5e1cc5468801ad0d55..c6f25cb62335fda65596ba3f4a55734a88b75bd4 100644
|
||||
index 416aa989ebb18a8741cc9d605a1180ab830f6643..a9a8c9e68e5b767dec2c26495685da88e0caa627 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 com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -35,6 +36,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -34,6 +35,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getContents() {
|
||||
+ // Scissors - Account for items inside containers
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.items) {
|
||||
@ -112,26 +159,27 @@ index 5a47d58071b83ea911e4cb5e1cc5468801ad0d55..c6f25cb62335fda65596ba3f4a55734a
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.items.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.items;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||
index 5c0f1488c8a8100cd39a03adeccded9984722249..d1e1b29298e1e074df1966498d7f3c94b20c77f4 100644
|
||||
index c57efcb9a79337ec791e4e8f6671612f0a82b441..2cbb8170953cb555411db8c171a3d1d91eb799bb 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
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -72,6 +73,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -73,6 +74,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||
}
|
||||
|
||||
public List<ItemStack> getContents() {
|
||||
+ // Scissors - Account for items inside containers
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.items) {
|
||||
@ -141,26 +189,26 @@ index 5c0f1488c8a8100cd39a03adeccded9984722249..d1e1b29298e1e074df1966498d7f3c94
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.items.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.items;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
index e56f7d76b501dab7d549efd2fafd514a9625c24e..153c70defdd6c25203764035c97ed3d20bc9c17e 100644
|
||||
index a71414397bd45ee7bcacfeef0041d80dfa25f114..f51abf1722e98d7ce9e616d84472d847e597eafb 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 com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -41,6 +42,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
@@ -40,6 +41,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
private int maxStack = MAX_STACK;
|
||||
|
||||
public List<ItemStack> getContents() {
|
||||
+ // Scissors - Account for items inside containers
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.items) {
|
||||
@ -170,26 +218,26 @@ index e56f7d76b501dab7d549efd2fafd514a9625c24e..153c70defdd6c25203764035c97ed3d2
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.items.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.items;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
index f74c5bb8e1ba42c77c59d481b871fd992483b128..10393d499fa6a5e36750ed9305d22454ef98e6cf 100644
|
||||
index 881379681c39230a00b3a1f11cd87498984396c7..d0513b72cdaec3b67b9341d251367b193bafa40c 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 com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
import java.util.Random;
|
||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -30,6 +31,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -28,6 +29,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||
private int maxStack = MAX_STACK;
|
||||
|
||||
public List<ItemStack> getContents() {
|
||||
+ // Scissors - Account for items inside containers
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.items) {
|
||||
@ -199,26 +247,27 @@ index f74c5bb8e1ba42c77c59d481b871fd992483b128..10393d499fa6a5e36750ed9305d22454
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.items.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.items;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index d241b25acc223982109495542fd17e0fbdf53437..ab952ef090ca5183340b014e0aae3aef553a4803 100644
|
||||
index aac5572c1d40a10cd1d17f89c9eb836718837577..e31ce92c8381ff2b1e5777f6f5351adcd137cdc5 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
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@@ -53,7 +54,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -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; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -56,6 +57,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
private int maxStack = MAX_STACK;
|
||||
|
||||
public List<ItemStack> getContents() {
|
||||
+ // Scissors - Account for items inside containers
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.items) {
|
||||
@ -228,28 +277,27 @@ index d241b25acc223982109495542fd17e0fbdf53437..ab952ef090ca5183340b014e0aae3aef
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.items.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.items;
|
||||
+
|
||||
}
|
||||
|
||||
public void onOpen(CraftHumanEntity who) {
|
||||
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 b4d38a9aa8792e979c99bedc20906679ba7991c6..5bdff2d3b13b3dbd0f3f83d9ece5a42173fb7e6c 100644
|
||||
index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..db3a4a8cd19da9775bb0884c33494f1e8591b1fa 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
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -252,7 +253,19 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@@ -60,6 +61,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
public boolean opened;
|
||||
|
||||
@Override
|
||||
protected NonNullList<ItemStack> getItems() {
|
||||
+ // Scissors - Account for items inside containers
|
||||
public List<ItemStack> getContents() {
|
||||
+ // Scissors start - Account for items inside containers
|
||||
+ long total = 0;
|
||||
+
|
||||
+ for (ItemStack item : this.itemStacks) {
|
||||
@ -259,9 +307,7 @@ index b4d38a9aa8792e979c99bedc20906679ba7991c6..5bdff2d3b13b3dbd0f3f83d9ece5a421
|
||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||
+ this.itemStacks.clear();
|
||||
+ }
|
||||
+
|
||||
+ // Scissors end
|
||||
return this.itemStacks;
|
||||
+
|
||||
}
|
||||
|
||||
@Override
|
@ -5,17 +5,15 @@ 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
|
||||
index d8393887cc98930815864eca28b07ef89b26f39e..3b5c48bfb7e7bcd0be9ad6d0357213c7adde08ad 100644
|
||||
index c62552b37d9dd8f0a50ab454af6090d876e0879f..2f4c606562c08189c817280a601a32632959614e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -813,7 +813,9 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -844,7 +844,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||
|
||||
if (!flag) {
|
||||
- LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
||||
+ // 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
|
||||
+ // Scissors - Prevent log spam possible with this error message, easily provokable by players in creative.
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Fri, 19 Aug 2022 00:49:38 -0600
|
||||
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
|
||||
index f7d031e9a5aa533d78a49ed6147dd47dd0f27f01..68bd4f64e85f26071640b219bb91b868f8e8aded 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
@@ -271,6 +271,13 @@ public abstract class HangingEntity extends Entity {
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||
|
||||
+ // Scissors start - Fixes exploit where bad TileX, TileY, and TileZ coordinates can crash servers
|
||||
+ if (level.isLoadedAndInBounds(blockposition))
|
||||
+ {
|
||||
+ this.pos = blockposition;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
if (!blockposition.closerThan(this.blockPosition(), 16.0D)) {
|
||||
HangingEntity.LOGGER.error("Hanging entity at invalid position: {}", blockposition);
|
||||
} else {
|
@ -1,53 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Telesphoreo <me@telesphoreo.me>
|
||||
Date: Fri, 22 Apr 2022 01:27:54 -0500
|
||||
Subject: [PATCH] Update for 1.18.2
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index f92610edcfb724374c69e66443eab60919ee955a..69cc277e4b737ff5a7424cd9afc5573e6eaec3d3 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -18,6 +18,7 @@ import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.stream.StreamSupport;
|
||||
+import org.bukkit.Bukkit;
|
||||
|
||||
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
|
||||
@@ -56,15 +57,14 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
return mcVer;
|
||||
}
|
||||
|
||||
- // Scissors start - Allow getting git information
|
||||
- public static String getCommit() {
|
||||
- Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||
- return attributes.get("Git-Commit");
|
||||
+ // Scissors start - Allow getting Git information
|
||||
+ private static String getCommit() {
|
||||
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
||||
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit");
|
||||
}
|
||||
-
|
||||
- public static String getBranch() {
|
||||
- Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
||||
- return attributes.get("Git-Branch");
|
||||
+ private static String getBranch() {
|
||||
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
||||
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch");
|
||||
}
|
||||
// Scissors end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
index f518e47818a47be0dfd7cccc4845ba9736c6cd8b..218525ba1742d68cde10f6caf09ee30eb2d01d50 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
||||
@@ -96,6 +96,7 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
|
||||
return stream.map((string) -> {
|
||||
return new TextComponent(string);
|
||||
}).reduce((accumulator, current) -> {
|
||||
+ // Scissors - untested, likely needs fixing
|
||||
return (TextComponent) accumulator.append(text).append(current);
|
||||
}).orElseGet(() -> {
|
||||
return new TextComponent("");
|
@ -1,40 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Mon, 4 Jul 2022 21:43:40 +0100
|
||||
Date: Mon, 4 Jul 2022 22:12:19 +0100
|
||||
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
|
||||
index 1a48c5ea1f2f755abfa85469e26f37ea5f02d6da..d6ed6b04792c4766ed5111fb83d52b76967d6856 100644
|
||||
index 2e7c03b00bc941b86df6a7f1b2b188c9f0aede22..0ae03d3934ad7b2b38afa45a65c7753dcbe796d2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||
@@ -1,7 +1,7 @@
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block;
|
||||
|
||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
||||
import com.mojang.logging.LogUtils;
|
||||
-import java.util.Random;
|
||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@@ -25,9 +25,11 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
@@ -25,6 +26,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.DirectionProperty;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.Location; // Scissors
|
||||
import org.slf4j.Logger;
|
||||
|
||||
-import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+import java.util.Random;
|
||||
|
||||
public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
@@ -117,6 +119,15 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||
}
|
||||
|
||||
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
||||
+ // Scissors - Add master block fire event
|
||||
+ // Scissors start - Add master block fire event
|
||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||
+
|
||||
+ if (!event.callEvent())
|
||||
@ -47,31 +40,32 @@ index 1a48c5ea1f2f755abfa85469e26f37ea5f02d6da..d6ed6b04792c4766ed5111fb83d52b76
|
||||
executor.performCommand(world);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||
index 4bed3a1f353ada478c93e3e6f94aa7ea9d228730..02a9c902a2ec8994ebc8c639864aa0d231aab61a 100644
|
||||
index 182e16c1d968707a11329150d71b7d01df6c6e52..8582a9369cffe0eebeb82a81fc413d0bf4ad28ed 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -27,6 +28,7 @@ import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement;
|
||||
import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
+import org.bukkit.Location;
|
||||
import java.util.Optional;
|
||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -17,6 +18,7 @@ import net.minecraft.world.level.block.JigsawBlock;
|
||||
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.StructureTemplatePool;
|
||||
+import org.bukkit.Location; // Scissors
|
||||
|
||||
public class JigsawBlockEntity extends BlockEntity {
|
||||
public static final String TARGET = "target";
|
||||
@@ -117,11 +119,21 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||
@@ -107,6 +109,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||
+ // Scissors - Add master block fire event
|
||||
+ final BlockPos blockPos = this.getBlockPos();
|
||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||
+ // Scissors start - Add master block fire event
|
||||
+ final BlockPos pos = this.getBlockPos();
|
||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||
+
|
||||
+ if (!event.callEvent())
|
||||
+ {
|
||||
@ -79,41 +73,35 @@ index 4bed3a1f353ada478c93e3e6f94aa7ea9d228730..02a9c902a2ec8994ebc8c639864aa0d2
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
ChunkGenerator chunkGenerator = world.getChunkSource().getGenerator();
|
||||
StructureManager structureManager = world.getStructureManager();
|
||||
StructureFeatureManager structureFeatureManager = world.structureFeatureManager();
|
||||
Random random = world.getRandom();
|
||||
- BlockPos blockPos = this.getBlockPos();
|
||||
+ // BlockPos blockPos = this.getBlockPos(); // Scissors - We've already defined this in the scope
|
||||
List<PoolElementStructurePiece> list = Lists.newArrayList();
|
||||
StructureTemplate structureTemplate = new StructureTemplate();
|
||||
structureTemplate.fillFromWorld(world, blockPos, new Vec3i(1, 1, 1), false, (Block)null);
|
||||
BlockPos blockPos = this.getBlockPos().relative(this.getBlockState().getValue(JigsawBlock.ORIENTATION).front());
|
||||
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
||||
// 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
|
||||
index 9a65ed7e5ed76a320c8602b0a4edeff6615d9e0b..e46727ee13550d4ab5473dc5ac28abddf822c9ee 100644
|
||||
index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616fd3f73eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||
@@ -6,6 +6,8 @@ import java.util.Optional;
|
||||
import java.util.Random;
|
||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
||||
import net.minecraft.ResourceLocationException;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -29,6 +31,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
@@ -29,6 +30,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.StructureTemplate;
|
||||
+import org.bukkit.Location;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||
+import org.bukkit.Location; // Scissors
|
||||
|
||||
public class StructureBlockEntity extends BlockEntity {
|
||||
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
||||
@@ -264,7 +267,6 @@ public class StructureBlockEntity extends BlockEntity {
|
||||
@@ -264,7 +266,7 @@ public class StructureBlockEntity extends BlockEntity {
|
||||
return false;
|
||||
} else {
|
||||
BlockPos blockPos = this.getBlockPos();
|
||||
- int i = 80;
|
||||
+ // Scissors - Obfuscation fixes
|
||||
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
||||
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
||||
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
||||
@ -121,7 +109,7 @@ index 9a65ed7e5ed76a320c8602b0a4edeff6615d9e0b..e46727ee13550d4ab5473dc5ac28abdd
|
||||
|
||||
public boolean saveStructure(boolean bl) {
|
||||
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||
+ // Scissors - Add master block fire event
|
||||
+ // Scissors start - Add master block fire event
|
||||
+ final BlockPos pos = this.getBlockPos();
|
||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||
+
|
||||
@ -133,12 +121,12 @@ index 9a65ed7e5ed76a320c8602b0a4edeff6615d9e0b..e46727ee13550d4ab5473dc5ac28abdd
|
||||
+
|
||||
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
||||
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||
StructureManager structureManager = serverLevel.getStructureManager();
|
||||
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
||||
@@ -358,6 +370,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||
|
||||
public boolean loadStructure(ServerLevel world, boolean bl) {
|
||||
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
||||
+ // Scissors - Add master block fire event
|
||||
+ // Scissors start - Add master block fire event
|
||||
+ final BlockPos blockPos = this.getBlockPos();
|
||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||
+
|
||||
@ -148,14 +136,14 @@ index 9a65ed7e5ed76a320c8602b0a4edeff6615d9e0b..e46727ee13550d4ab5473dc5ac28abdd
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
StructureManager structureManager = world.getStructureManager();
|
||||
StructureTemplateManager structureTemplateManager = world.getStructureManager();
|
||||
|
||||
Optional<StructureTemplate> optional;
|
||||
@@ -403,6 +425,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public void unloadStructure() {
|
||||
+ // Scissors - Add master block fire event
|
||||
+ // Scissors start - Add master block fire event
|
||||
+ final BlockPos blockPos = this.getBlockPos();
|
||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||
+
|
||||
@ -167,4 +155,4 @@ index 9a65ed7e5ed76a320c8602b0a4edeff6615d9e0b..e46727ee13550d4ab5473dc5ac28abdd
|
||||
+
|
||||
if (this.structureName != null) {
|
||||
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||
StructureManager structureManager = serverLevel.getStructureManager();
|
||||
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
@ -1,158 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Business Goose <arclicious@vivaldi.net>
|
||||
Date: Fri, 22 Apr 2022 01:56:03 -0500
|
||||
Subject: [PATCH] Reset large tags
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..058203440fd071ce5edbe18391ea60f0a5fbee3a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||
@@ -0,0 +1,28 @@
|
||||
+package com.github.atlasmediagroup.scissors;
|
||||
+
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
+import java.nio.charset.StandardCharsets;
|
||||
+
|
||||
+public class NbtUtility
|
||||
+{
|
||||
+
|
||||
+ public static boolean isTooLarge(@Nullable CompoundTag tag)
|
||||
+ {
|
||||
+ if (tag == null) return false;
|
||||
+ return tag.toString().getBytes(StandardCharsets.UTF_8).length > (256 * 1024);
|
||||
+ }
|
||||
+
|
||||
+ public static class Item
|
||||
+ {
|
||||
+
|
||||
+ public static CompoundTag removeItemData(CompoundTag tag)
|
||||
+ {
|
||||
+ CompoundTag cleaned = new CompoundTag();
|
||||
+ cleaned.putString("id", tag.getString("id"));
|
||||
+ cleaned.putByte("Count", tag.getByte("Count"));
|
||||
+ return cleaned;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 6837c965592d4584cfc958a1008b98791a0fc780..0f7d7248be0aa99dd759d12ed956a98822a2749b 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.item;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
@@ -8,13 +9,13 @@ import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.mojang.serialization.Codec;
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
-import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
@@ -50,11 +51,7 @@ import net.minecraft.util.datafix.fixes.References;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
-import net.minecraft.world.entity.Entity;
|
||||
-import net.minecraft.world.entity.EquipmentSlot;
|
||||
-import net.minecraft.world.entity.LivingEntity;
|
||||
-import net.minecraft.world.entity.MobType;
|
||||
-import net.minecraft.world.entity.SlotAccess;
|
||||
+import net.minecraft.world.entity.*;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
@@ -75,8 +72,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
-import com.mojang.serialization.Dynamic;
|
||||
-import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -251,6 +246,13 @@ 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) Registry.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
|
||||
this.count = nbttagcompound.getByte("Count");
|
||||
if (nbttagcompound.contains("tag", 10)) {
|
||||
@@ -495,7 +497,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;
|
||||
@@ -827,6 +833,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()) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 226d9ac01c601fc8954a88bea93a521cdce79eda..9bfa2deca1258dd9c294422a0ea032142cd11789 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -1,16 +1,12 @@
|
||||
package org.bukkit.craftbukkit.inventory;
|
||||
|
||||
-import static org.bukkit.craftbukkit.inventory.CraftMetaItem.*;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
-import java.util.Map;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.world.item.Item;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
-import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
-import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
|
||||
import org.bukkit.craftbukkit.util.CraftLegacy;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
@@ -19,6 +15,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
+import java.util.Map;
|
||||
+
|
||||
+import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS_ID;
|
||||
+import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS_LVL;
|
||||
+
|
||||
@DelegateDeserialization(ItemStack.class)
|
||||
public final class CraftItemStack extends ItemStack {
|
||||
|
@ -1,21 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Tue, 5 Jul 2022 04:00:42 +0100
|
||||
Date: Tue, 5 Jul 2022 04:12:31 +0100
|
||||
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
|
||||
index 64c438459f150af1cabdd3cea29c2951d42d69a0..b0bd0412010320cc624535d6abffe417a135a4dc 100644
|
||||
index aa287d7f37f38d938d195114408cb6dbda59063d..e46febba49530c4c71a15bfc75d731c45fcb48f2 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.server.network;
|
||||
|
||||
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Floats;
|
||||
import com.mojang.brigadier.ParseResults;
|
||||
@@ -1948,6 +1949,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -2056,6 +2057,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
Entity entity = packet.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
@ -1,31 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sun, 10 Jul 2022 02:44:05 +0100
|
||||
Date: Sun, 10 Jul 2022 02:55:01 +0100
|
||||
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
|
||||
index b0bd0412010320cc624535d6abffe417a135a4dc..65e9791d7e613d039f93184cde717bff8e97000c 100644
|
||||
index e46febba49530c4c71a15bfc75d731c45fcb48f2..798ffda66ccbc98a073b276208e04d643b04e1b2 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -24,6 +24,8 @@ import java.util.function.UnaryOperator;
|
||||
@@ -30,6 +30,7 @@ import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor; // Scissors
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
@@ -2642,6 +2644,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
public void handleContainerClick(ServerboundContainerClickPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
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
|
||||
@@ -2661,6 +2664,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -2996,6 +2997,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
return;
|
||||
}
|
||||
|
@ -1,57 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sun, 10 Jul 2022 10:06:58 +0100
|
||||
Date: Sun, 10 Jul 2022 10:29:03 +0100
|
||||
Subject: [PATCH] Disable running commands in books by default
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||
index 26a9a15cc630113cd8d2c8287c6b0f1067ce53f0..15419727d37fc75bc18177cf3ea2daa54f97ec47 100644
|
||||
index 31911c09fe15753ae32fa39417bdc9e9de552a88..b810a5afcb2343174e37efb7dd8a36b968b07c3a 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||
@@ -1,7 +1,10 @@
|
||||
package net.minecraft.world.item;
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.item;
|
||||
|
||||
import java.util.List;
|
||||
+import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -9,10 +12,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
@@ -9,8 +10,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
-import net.minecraft.network.chat.Component;
|
||||
-import net.minecraft.network.chat.ComponentUtils;
|
||||
-import net.minecraft.network.chat.TextComponent;
|
||||
-import net.minecraft.network.chat.TranslatableComponent;
|
||||
+import net.minecraft.network.chat.*;
|
||||
+import net.minecraft.network.chat.*; // Scissors
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.util.StringUtil;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
@@ -113,8 +113,7 @@ public class WrittenBookItem extends Item {
|
||||
|
||||
public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) {
|
||||
CompoundTag compoundTag = book.getTag();
|
||||
- if (com.destroystokyo.paper.PaperConfig.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper
|
||||
- compoundTag.putBoolean("resolved", true);
|
||||
+ if (compoundTag != null) { // Paper
|
||||
if (!makeSureTagIsValid(compoundTag)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -165,8 +164,41 @@ public class WrittenBookItem extends Item {
|
||||
component2 = new TextComponent(text);
|
||||
@@ -161,9 +161,43 @@ public class WrittenBookItem extends Item {
|
||||
component2 = Component.literal(text);
|
||||
}
|
||||
|
||||
- return Component.Serializer.toJson(component2);
|
||||
+ return Component.Serializer.toJson(!ScissorsConfig.runCommandsInBooks ? sanitize(component2, 0) : component2); // Scissors - Allow server owners to disable run command in books
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // Scissors start - Allow server owners to disable run command in books
|
||||
+ public static Component sanitize(Component component, int depth) {
|
||||
+ if (depth > 128) {
|
||||
+ public static Component sanitize(Component component, int depth)
|
||||
+ {
|
||||
+ if (depth > 128)
|
||||
+ {
|
||||
+ return Component.nullToEmpty("Sanitization function depth limit exceeded");
|
||||
+ }
|
||||
+
|
||||
@ -60,27 +47,27 @@ index 26a9a15cc630113cd8d2c8287c6b0f1067ce53f0..15419727d37fc75bc18177cf3ea2daa5
|
||||
+ final Style style = component2.getStyle();
|
||||
+ final ClickEvent clickEvent = style.getClickEvent();
|
||||
+
|
||||
+ if(clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND))
|
||||
+ 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())))
|
||||
+ .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();
|
||||
+
|
||||
+ .stream()
|
||||
+ .map(comp -> sanitize(comp, depth + 1))
|
||||
+ .toList();
|
||||
+ component2.getSiblings().clear();
|
||||
+ component2.getSiblings().addAll(processedExtra);
|
||||
+
|
||||
+ return component2;
|
||||
}
|
||||
+ }
|
||||
+ // Scissors end
|
||||
|
||||
+
|
||||
@Override
|
||||
public boolean isFoil(ItemStack stack) {
|
||||
return true;
|
@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Business Goose <arclicious@vivaldi.net>
|
||||
Date: Sun, 1 May 2022 01:19:36 +0100
|
||||
Subject: [PATCH] Make the maximum tag size a constant & add a method for
|
||||
getting tag size
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||
index 058203440fd071ce5edbe18391ea60f0a5fbee3a..978cb98c81195640fb3704d2077148f2be0dca36 100644
|
||||
--- a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||
@@ -1,17 +1,49 @@
|
||||
package com.github.atlasmediagroup.scissors;
|
||||
|
||||
-import net.minecraft.nbt.CompoundTag;
|
||||
+import com.google.common.base.Strings;
|
||||
+import com.google.common.collect.Lists;
|
||||
+import net.minecraft.nbt.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
+import java.util.Collections;
|
||||
+import java.util.List;
|
||||
|
||||
public class NbtUtility
|
||||
{
|
||||
+ public static final long MAXIMUM_SIZE = (256 * 1024);
|
||||
+
|
||||
+ public static long getTagSize(@Nullable Tag tag, int depth) {
|
||||
+ if(depth > 512) return 0;
|
||||
+ if(tag == null) return 0;
|
||||
+
|
||||
+ long size = 0;
|
||||
+
|
||||
+ if(tag.getType() == CompoundTag.TYPE) {
|
||||
+ CompoundTag compoundTag = (CompoundTag) tag;
|
||||
+ for(String key : compoundTag.getAllKeys()) {
|
||||
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
||||
+ }
|
||||
+ } else if(tag.getType() == ListTag.TYPE) {
|
||||
+ ListTag listTag = (ListTag) tag;
|
||||
+ for (Tag tag1 : listTag) {
|
||||
+ size += getTagSize(tag1, depth + 1);
|
||||
+ }
|
||||
+ } else {
|
||||
+ size += tag.getAsString().getBytes(StandardCharsets.UTF_8).length;
|
||||
+ }
|
||||
+
|
||||
+ return size;
|
||||
+ }
|
||||
+
|
||||
+ public static long getTagSize(@Nullable CompoundTag tag) {
|
||||
+ return getTagSize(tag, 0);
|
||||
+ }
|
||||
|
||||
public static boolean isTooLarge(@Nullable CompoundTag tag)
|
||||
{
|
||||
if (tag == null) return false;
|
||||
- return tag.toString().getBytes(StandardCharsets.UTF_8).length > (256 * 1024);
|
||||
+ return getTagSize(tag) > MAXIMUM_SIZE;
|
||||
}
|
||||
|
||||
public static class Item
|
@ -0,0 +1,31 @@
|
||||
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 798ffda66ccbc98a073b276208e04d643b04e1b2..d428490171bb1c0209ca9a279c2b1e1e1dfcf914 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1359,7 +1359,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (this.player.hasPermissions(2)) {
|
||||
Entity entity = this.player.getLevel().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));
|
||||
@@ -1371,7 +1371,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
- if (this.player.hasPermissions(2)) {
|
||||
+ // Scissors start - Validate block entity tag query positions
|
||||
+ if (this.player.hasPermissions(2) && this.player.getLevel().isLoadedAndInBounds(packet.getPos())
|
||||
+ && this.player.distanceToSqr(packet.getPos().getX(), packet.getPos().getY(), packet.getPos().getZ()) < 32 * 32) {
|
||||
+ // Scissors end
|
||||
BlockEntity tileentity = this.player.getLevel().getBlockEntity(packet.getPos());
|
||||
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Wed, 13 Jul 2022 12:13:22 +0100
|
||||
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 4da4edae517a0efec6e03a719ec47b700509dab1..96e330e024384503496f834a9767122f6b4d86d6 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
|
||||
@@ -4,8 +4,10 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||
import net.minecraft.commands.CommandSource;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
+import net.minecraft.commands.Commands; // Scissors
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
@@ -15,6 +17,7 @@ import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
+import net.minecraft.server.MinecraftServer; // Scissors
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
@@ -24,6 +27,8 @@ import net.minecraft.world.item.DyeColor;
|
||||
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; // Scissors
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer; // Scissors
|
||||
|
||||
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
|
||||
private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper
|
||||
@@ -272,6 +277,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
}
|
||||
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||
// Paper end
|
||||
+ // Scissors start - Add optional permissions to command signs
|
||||
+ final MinecraftServer vanillaServer = player.getServer();
|
||||
+ final CraftServer craftServer = vanillaServer.server;
|
||||
+ final CraftPlayer craftPlayer = player.getBukkitEntity();
|
||||
+ final Commands commands = vanillaServer.getCommands();
|
||||
+
|
||||
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||
+ {
|
||||
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Tue, 16 Aug 2022 17:25:37 +0100
|
||||
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 26d43c229caf9f8504af7071c3a61ec6da7e27ec..ecceb3fc7f822d826b4a789fe72a8cd08e90d60e 100644
|
||||
index 0f70be614f8f5350ad558d0ae645cdf0027e1e76..c006ac8531cf2c029fd2fac449f96736a4afed0d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||
@@ -198,6 +198,11 @@ public final class CraftChatMessage {
|
||||
@@ -199,6 +199,7 @@ 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[]{TextComponent.EMPTY};
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+ 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();
|
||||
}
|
||||
|
@ -1,14 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sun, 27 Nov 2022 04:56:24 +0000
|
||||
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 fa4e930388baa2ee0a752873b2ec1a67cc020de6..8ba2433de1e079e2227b97a5a7b5f06a6f34984f 100644
|
||||
index 2096e8a0bdbcfc865f175f3a01ab688542481531..2ad58d4e4fd361d17803f57c3496a92bd233c857 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||
@@ -41,9 +41,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.world.entity.projectile;
|
||||
|
||||
+import me.totalfreedom.scissors.MathUtility; // Scissors
|
||||
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) {
|
||||
@ -19,13 +26,13 @@ index fa4e930388baa2ee0a752873b2ec1a67cc020de6..8ba2433de1e079e2227b97a5a7b5f06a
|
||||
+ //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);
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -150,6 +154,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
@@ -141,6 +146,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
||||
}
|
||||
|
||||
@ -42,16 +49,16 @@ index fa4e930388baa2ee0a752873b2ec1a67cc020de6..8ba2433de1e079e2227b97a5a7b5f06a
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ this.xPower = xPower;
|
||||
+ this.yPower = yPower;
|
||||
+ this.zPower = zPower;
|
||||
+ 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);
|
||||
@@ -157,9 +180,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
@@ -148,9 +172,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
ListTag nbttaglist = nbt.getList("power", 6);
|
||||
|
||||
if (nbttaglist.size() == 3) {
|
||||
@ -62,13 +69,13 @@ index fa4e930388baa2ee0a752873b2ec1a67cc020de6..8ba2433de1e079e2227b97a5a7b5f06a
|
||||
+ //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));
|
||||
+ // Scissors end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,9 +220,12 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
@@ -184,9 +212,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||
Vec3 vec3d = entity.getLookAngle();
|
||||
|
||||
this.setDeltaMovement(vec3d);
|
||||
@ -79,6 +86,7 @@ index fa4e930388baa2ee0a752873b2ec1a67cc020de6..8ba2433de1e079e2227b97a5a7b5f06a
|
||||
+ //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);
|
@ -0,0 +1,105 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Tue, 31 Jan 2023 23:16:52 +0000
|
||||
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 74cf1c043beef03cfd5adf481414a5ee78bef2a6..516c61cbb8299828b2f28d4564d08ae1829649b5 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; // Scissors
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
public interface OutgoingChatMessage {
|
||||
@@ -44,10 +45,21 @@ 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(),
|
||||
+ playerChatMessage.result()
|
||||
+ ), 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 c0a80824a0307ea673805015119cc834b268f0dc..9f28f86b1b56ea55ab39f6ac988c1f47c5312c6c 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils;
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||
import net.minecraft.util.SignatureUpdater;
|
||||
import net.minecraft.util.SignatureValidator;
|
||||
import net.minecraft.util.Signer;
|
||||
@@ -41,7 +42,7 @@ public class SignedMessageChain {
|
||||
if (!playerChatMessage.verify(signatureValidator)) {
|
||||
throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
|
||||
} else {
|
||||
- if (playerChatMessage.hasExpiredServer(Instant.now())) {
|
||||
+ if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors
|
||||
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", (Object)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 d428490171bb1c0209ca9a279c2b1e1e1dfcf914..9e9e299b491d9b3641a87c12f7a4ec74b17517fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.server.network;
|
||||
|
||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Floats;
|
||||
@@ -2311,7 +2312,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
|
||||
- if (exception.shouldDisconnect()) {
|
||||
+ if (exception.shouldDisconnect() && ScissorsConfig.chatSignaturesEnabled) { // Scissors - Do not kick when chat signatures are disabled
|
||||
this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes
|
||||
} else {
|
||||
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
|
||||
@@ -2367,6 +2368,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
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
|
||||
}
|
||||
@@ -2602,6 +2604,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
|
||||
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
|
||||
}
|
||||
@@ -3641,6 +3644,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
+ 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();
|
@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sun, 10 Jul 2022 02:45:15 +0100
|
||||
Subject: [PATCH] Do not attempt to cast items to recipes
|
||||
|
||||
|
||||
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 0f19ef250a2f82e49730cb58ea43ee6bf407455a..764b56c2d5cdf5a57fced106d196ef866f70e885 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
|
||||
@@ -634,6 +634,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
Entry<ResourceLocation> entry = (Entry) objectiterator.next();
|
||||
|
||||
worldserver.getRecipeManager().byKey((ResourceLocation) entry.getKey()).ifPresent((irecipe) -> {
|
||||
+ // Scissors start - Do not attempt to cast items to recipes
|
||||
+ if (!(irecipe instanceof AbstractCookingRecipe))
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
+
|
||||
list.add(irecipe);
|
||||
AbstractFurnaceBlockEntity.createExperience(worldserver, vec3d, entry.getIntValue(), ((AbstractCookingRecipe) irecipe).getExperience(), blockposition, entityplayer, itemstack, amount); // CraftBukkit
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
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 ade4ed2f219d32050a372283eaebe75f9014ec78..88d119605eba1b59fad431d94882f054f0074b80 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4482,7 +4482,7 @@ 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 - Patch invalid entity rotation log spam
|
||||
} else {
|
||||
this.yRot = yaw;
|
||||
}
|
||||
@@ -4494,7 +4494,7 @@ 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 - Patch invalid entity rotation log spam
|
||||
} else {
|
||||
this.xRot = pitch;
|
||||
}
|
@ -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..e8cf963f0190438bbf65f827d144775ab0b02b63 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; // Scissors
|
||||
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;
|
@ -0,0 +1,18 @@
|
||||
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..9785f2d8c94552b4a1139fa6d936fdaa61e5827c 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,7 @@ public class SculkSpreader {
|
||||
Object2IntMap<BlockPos> object2IntMap = new Object2IntOpenHashMap<>();
|
||||
|
||||
for(SculkSpreader.ChargeCursor chargeCursor : this.cursors) {
|
||||
+ if (!world.getMinecraftWorld().isLoadedAndInBounds(chargeCursor.getPos())) continue; // Scissors
|
||||
chargeCursor.update(world, pos, random, this, shouldConvertToBlock);
|
||||
if (chargeCursor.charge <= 0) {
|
||||
world.levelEvent(3006, chargeCursor.getPos(), 0);
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Mon, 11 Jul 2022 17:21:37 -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 65e9791d7e613d039f93184cde717bff8e97000c..2e6e1af5244202e0bc77b443f089b4f3016be8ac 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1273,7 +1273,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@Override
|
||||
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
- 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.getLevel().getBlockEntity(packet.getPos());
|
||||
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
||||
|
@ -1,93 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Wed, 13 Jul 2022 11:31:04 +0100
|
||||
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
index 9612d02814d6ae45d7087c34e0c8549e6c9aecf9..ad222b622979716efdb0ea14cbf2cbcb4acf2e74 100644
|
||||
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
@@ -64,8 +64,8 @@ public class ScissorsConfig
|
||||
config.options().header(HEADER);
|
||||
config.options().copyDefaults(true);
|
||||
|
||||
- version = getInt("config-version", 1);
|
||||
- set("config-version", 1);
|
||||
+ version = getInt("config-version", 2);
|
||||
+ set("config-version", 2);
|
||||
readConfig(ScissorsConfig.class, null);
|
||||
}
|
||||
|
||||
@@ -132,6 +132,13 @@ public class ScissorsConfig
|
||||
runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
||||
}
|
||||
|
||||
+ // people still may want them to bypass permissions for warps
|
||||
+ public static boolean commandSignsBypassPermissions = false;
|
||||
+ public static void commandSignsBypassPermissions()
|
||||
+ {
|
||||
+ commandSignsBypassPermissions = getBoolean("commandSignsBypassPermissions", false);
|
||||
+ }
|
||||
+
|
||||
private static void set(String path, Object val)
|
||||
{
|
||||
config.set(path, val);
|
||||
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 d5bcc81a809e3c733c6fc11309bcf0913860edf6..19e04b0b47c0e185b5e02e8a7c00bab551a0d45e 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
|
||||
@@ -1,11 +1,13 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
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.network.chat.ClickEvent;
|
||||
@@ -15,6 +17,7 @@ import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
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.util.FormattedCharSequence;
|
||||
@@ -23,6 +26,8 @@ import net.minecraft.world.item.DyeColor;
|
||||
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.CraftPlayer;
|
||||
|
||||
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
|
||||
private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper
|
||||
@@ -236,7 +241,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
if (!event.callEvent()) {
|
||||
return false;
|
||||
}
|
||||
- player.getServer().getCommands().performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||
+
|
||||
+ // Scissors start - Add optional permissions to command signs
|
||||
+ final MinecraftServer vanillaServer = player.getServer();
|
||||
+ final CraftServer craftServer = vanillaServer.server;
|
||||
+ final CraftPlayer craftPlayer = player.getBukkitEntity();
|
||||
+ final Commands commands = vanillaServer.getCommands();
|
||||
+
|
||||
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||
+ {
|
||||
+ commands.performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||
+ } else
|
||||
+ {
|
||||
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||
+ }
|
||||
+ // Scissors end
|
||||
// Paper end
|
||||
}
|
||||
}
|
46
patches/server/0039-Limit-map-decorations.patch
Normal file
46
patches/server/0039-Limit-map-decorations.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Fri, 28 Apr 2023 16:29:23 -0300
|
||||
Subject: [PATCH] Limit map decorations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||
index 347d2914f9560a3ee8cea59444bc0dfbb7cf3456..b6a38b1458957bd444fea439fa81d2976ffb86e0 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; // Scissors
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
@@ -14,6 +15,11 @@ 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;
|
||||
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 25a64250ce57fe4cd90f8b95d1e003d961662152..65c2b553711e9f9ded87a422c4a0aacd7de8d8c1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -356,6 +356,11 @@ public class MapItemSavedData extends SavedData {
|
||||
}
|
||||
|
||||
private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) {
|
||||
+ // Scissors start - Limit decoration count
|
||||
+ if (this.decorations.size() > 32) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
int i = 1 << this.scale;
|
||||
float f = (float) (x - (double) this.centerX) / (float) i;
|
||||
float f1 = (float) (z - (double) this.centerZ) / (float) i;
|
@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Fri, 28 Apr 2023 16:44:50 -0300
|
||||
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
|
||||
index 45804711255f04110e9509df8d60900314aa10b7..b1fd209b2893d2d6bfc2ae552c7919ab8abda695 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1468,7 +1468,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (entity != null) {
|
||||
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID().toString());
|
||||
entity.unRide();
|
||||
- this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
|
||||
+
|
||||
+ // Scissors start - Prevent player banning using duplicate UUIDs
|
||||
+ if (entity instanceof ServerPlayer serverPlayer) {
|
||||
+ this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED);
|
||||
+ } else {
|
||||
+ entity.discard();
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
this.entityLookup.addNewEntity(player); // Paper - rewite chunk system
|
@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Fri, 28 Apr 2023 16:46:00 -0300
|
||||
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
|
||||
index 61c170555c8854b102c640b0b6a615f9f732edbf..29f46a137584a5f52f3c30b4c352d58ca61488a3 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||
@@ -366,7 +366,7 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
return false;
|
||||
}
|
||||
if (this.entityByUUID.containsKey(entity.getUUID())) {
|
||||
- LOGGER.warn("Entity uuid already exists: " + entity.getUUID() + ", mapped to " + this.entityByUUID.get(entity.getUUID()) + ", can't add " + entity);
|
||||
+ // Scissors - Don't warn on duplicate entity UUIDs
|
||||
return false;
|
||||
}
|
||||
this.entityById.put(entity.getId(), entity);
|
@ -1,38 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Sat, 20 Aug 2022 03:01:56 +0100
|
||||
Subject: [PATCH] Fix exploit where paintings are able to spawn out of bounds
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
index ad222b622979716efdb0ea14cbf2cbcb4acf2e74..33b97f0738fbc4a54a174e9419275770e4513ca0 100644
|
||||
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||
@@ -30,7 +30,7 @@ public class ScissorsConfig
|
||||
|
||||
Discord: https://discord.com/invite/mtVQcHn58h
|
||||
Website: https://scissors.gg/\s
|
||||
- Docs: https://scissors.gg/javadoc/1.18.2/\s
|
||||
+ Docs: https://javadoc.scissors.gg/1.18.2/\s
|
||||
""";
|
||||
private static final Pattern SPACE = Pattern.compile(" ");
|
||||
private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||
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 2805ebfe4ffe769bcde778a1225b3101c91538d8..3c4bfad55e438c5e723ef58c9cc24908af9e0846 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||
@@ -265,7 +265,13 @@ public abstract class HangingEntity extends Entity {
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
- this.pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||
+ // Scissors start - Fix exploit where paintings are able to spawn out of bounds
|
||||
+ final BlockPos pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||
+ if (this.level.isLoadedAndInBounds(pos))
|
||||
+ {
|
||||
+ this.pos = pos;
|
||||
+ }
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
public abstract int getWidth();
|
@ -0,0 +1,18 @@
|
||||
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 2873ed7c443ed8c8c57a8b1d3e444d229f10f07b..a2149452ee461002ea74189c5aa49cddd943d0cf 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||
@@ -266,6 +266,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
if (!jsonelement.isJsonObject()) {
|
||||
if (jsonelement.isJsonArray()) {
|
||||
JsonArray jsonarray = jsonelement.getAsJsonArray();
|
||||
+ if (jsonarray.size() <= 0) throw new JsonParseException("Unexpected empty array of components"); // Scissors
|
||||
|
||||
ichatmutablecomponent = null;
|
||||
Iterator iterator = jsonarray.iterator();
|
@ -0,0 +1,125 @@
|
||||
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/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||
index a2149452ee461002ea74189c5aa49cddd943d0cf..f1d1501211a923c0ccab6b5982887c3a9262889b 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; // Scissors
|
||||
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");
|
||||
+ }
|
||||
+ // Scissors end
|
||||
if (jsonelement.isJsonPrimitive()) {
|
||||
return Component.literal(jsonelement.getAsString());
|
||||
} else {
|
||||
@@ -273,7 +281,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
JsonElement jsonelement1 = (JsonElement) iterator.next();
|
||||
- MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext);
|
||||
+ MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsondeserializationcontext, depth + 1); // Scissors
|
||||
|
||||
if (ichatmutablecomponent == null) {
|
||||
ichatmutablecomponent = ichatmutablecomponent1;
|
||||
@@ -297,12 +305,17 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
s = GsonHelper.getAsString(jsonobject, "translate");
|
||||
String s1 = GsonHelper.getAsString(jsonobject, "fallback", (String) null);
|
||||
|
||||
+ // Scissors start - 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;
|
||||
+ // Scissors end
|
||||
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)); // Scissors
|
||||
}
|
||||
|
||||
ichatmutablecomponent = Component.translatableWithFallback(s, s1, aobject);
|
||||
@@ -318,7 +331,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); // Scissors
|
||||
|
||||
ichatmutablecomponent = Component.selector(GsonHelper.getAsString(jsonobject, "selector"), optional);
|
||||
} else if (jsonobject.has("keybind")) {
|
||||
@@ -329,7 +342,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); // Scissors
|
||||
boolean flag = GsonHelper.getAsBoolean(jsonobject, "interpret", false);
|
||||
Object object;
|
||||
|
||||
@@ -356,7 +369,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)); // Scissors
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,6 +379,12 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Scissors start
|
||||
+ 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;
|
||||
@@ -384,8 +403,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) {
|
@ -1,74 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Telesphoreo <me@telesphoreo.me>
|
||||
Date: Sun, 11 Jun 2023 00:00:20 -0500
|
||||
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 2e6e1af5244202e0bc77b443f089b4f3016be8ac..f1f17e33cddf23fffae96d60bfd92934b6ab3c5a 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -25,6 +25,8 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
||||
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.CrashReport;
|
||||
@@ -156,6 +158,7 @@ import net.minecraft.world.phys.shapes.BooleanOp;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
+import org.bukkit.entity.minecart.CommandMinecart;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -916,6 +919,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
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) {
|
||||
@@ -947,7 +963,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
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);
|
86
patches/server/0044-Implement-command-block-events.patch
Normal file
86
patches/server/0044-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/network/protocol/game/ServerboundSetCommandMinecartPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
||||
index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400deb533d2 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCommandMinecartPacket.java
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.world.level.BaseCommandBlock;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
public class ServerboundSetCommandMinecartPacket implements Packet<ServerGamePacketListener> {
|
||||
- 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 8274514733caf0fb3c3db5836a3ab9bd204c4378..ca6b809f56cf4d28d5a6514c18322419c8184f30 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; // Scissors
|
||||
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent; // Scissors
|
||||
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent; // Scissors
|
||||
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Floats;
|
||||
@@ -159,6 +161,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; // Scissors
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.BucketItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
@@ -187,6 +190,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; // Scissors
|
||||
+import org.bukkit.craftbukkit.entity.CraftMinecartCommand; // Scissors
|
||||
import org.slf4j.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -993,6 +998,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
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) {
|
||||
@@ -1024,7 +1039,18 @@ 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();
|
||||
+ 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);
|
110
patches/server/0045-Add-depth-limit-to-SNBT.patch
Normal file
110
patches/server/0045-Add-depth-limit-to-SNBT.patch
Normal file
@ -0,0 +1,110 @@
|
||||
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..426425e38698b06d46c5e6a41b39d362176a4ee3 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
||||
@@ -169,8 +169,56 @@ public class TagParser {
|
||||
}
|
||||
|
||||
this.expect('}');
|
||||
- return compoundTag;
|
||||
+
|
||||
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag; // Scissors - Add depth limit to SNBT
|
||||
+ }
|
||||
+
|
||||
+ // Scissors start - Add depth limit to SNBT
|
||||
+ private boolean exceedsDepthLimit(Tag tag) {
|
||||
+ return this.exceedsDepthLimit(0, tag);
|
||||
+ }
|
||||
+
|
||||
+ private boolean exceedsDepthLimit(long depth, Tag tag)
|
||||
+ {
|
||||
+ if (depth > 256)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (tag instanceof ListTag listTag)
|
||||
+ {
|
||||
+ for (Tag childTag : listTag)
|
||||
+ {
|
||||
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
||||
+
|
||||
+ if (returnValue)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (tag instanceof CompoundTag compoundTag)
|
||||
+ {
|
||||
+ for (String key: compoundTag.getAllKeys())
|
||||
+ {
|
||||
+ Tag childTag = compoundTag.get(key);
|
||||
+
|
||||
+ if (childTag == null)
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
||||
+
|
||||
+ if (returnValue)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
}
|
||||
+ // Scissors end
|
||||
|
||||
private Tag readListTag() throws CommandSyntaxException {
|
||||
this.expect('[');
|
||||
@@ -203,7 +251,7 @@ public class TagParser {
|
||||
}
|
||||
|
||||
this.expect(']');
|
||||
- return listTag;
|
||||
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +276,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 +289,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 +305,7 @@ public class TagParser {
|
||||
}
|
||||
|
||||
this.expect(']');
|
||||
- return list;
|
||||
+ return (List<T>) list; // Scissors - Cast to List<T>
|
||||
}
|
||||
}
|
||||
|
27
patches/server/0046-Limit-beacon-effectRange.patch
Normal file
27
patches/server/0046-Limit-beacon-effectRange.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Wed, 7 Jun 2023 16:50:35 -0300
|
||||
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
|
||||
index ef740d1ad6352ca4af299001a081b720bc472d2e..63c569e05a86a590021ae6828918e5c5fce7b637 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
|
||||
@@ -83,7 +83,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
private double effectRange = -1;
|
||||
|
||||
public double getEffectRange() {
|
||||
- if (this.effectRange < 0) {
|
||||
+ if (this.effectRange < 0 || this.effectRange > 256) { // Scissors
|
||||
return this.levels * 10 + 10;
|
||||
} else {
|
||||
return effectRange;
|
||||
@@ -415,6 +415,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||
|
||||
this.lockKey = LockCode.fromTag(nbt);
|
||||
this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper
|
||||
+ if (this.effectRange > 256) this.effectRange = 256; // Scissors
|
||||
}
|
||||
|
||||
@Override
|
@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Tue, 13 Jun 2023 18:29:18 -0300
|
||||
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());
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Sat, 1 Jul 2023 21:22:29 -0300
|
||||
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 b1c594dc6a6b8a6c737b99272acab9e7dbd0ed63..1cc2e5a82652838b29a2e935d4284e5cc134724e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
@@ -56,7 +56,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) {
|
46
patches/server/0049-Fix-packet-related-lag-exploits.patch
Normal file
46
patches/server/0049-Fix-packet-related-lag-exploits.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Tue, 4 Jul 2023 18:49:34 -0300
|
||||
Subject: [PATCH] Fix packet-related lag exploits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index ca6b809f56cf4d28d5a6514c18322419c8184f30..6bbf1a5620a5ab52add56b9fcf9ce92288498dab 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -958,7 +958,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
|
||||
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
||||
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
|
||||
- } else {
|
||||
+ } else if (this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||
BaseCommandBlock commandblocklistenerabstract = null;
|
||||
CommandBlockEntity tileentitycommand = null;
|
||||
BlockPos blockposition = packet.getPos();
|
||||
@@ -1122,7 +1122,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
- if (this.player.canUseGameMasterBlocks()) {
|
||||
+ if (this.player.canUseGameMasterBlocks() && this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||
BlockPos blockposition = packet.getPos();
|
||||
BlockState iblockdata = this.player.level.getBlockState(blockposition);
|
||||
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||
@@ -1180,7 +1180,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
- if (this.player.canUseGameMasterBlocks()) {
|
||||
+ if (this.player.canUseGameMasterBlocks() && this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||
BlockPos blockposition = packet.getPos();
|
||||
BlockState iblockdata = this.player.level.getBlockState(blockposition);
|
||||
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||
@@ -1203,7 +1203,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@Override
|
||||
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
- if (this.player.canUseGameMasterBlocks()) {
|
||||
+ if (this.player.canUseGameMasterBlocks() && this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||
BlockPos blockposition = packet.getPos();
|
||||
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||
|
44
patches/server/0050-Limit-save-data-for-Bees-and-Vexes.patch
Normal file
44
patches/server/0050-Limit-save-data-for-Bees-and-Vexes.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Wed, 5 Jul 2023 22:58:24 +0100
|
||||
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 c33e5c51839c8e6ec04c1b302127d2bf0f48664c..c59094fbcb772ec9d671d02f38c2214cb0c94990 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -223,8 +223,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
this.hivePos = null;
|
||||
- if (nbt.contains("HivePos")) {
|
||||
- this.hivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos"));
|
||||
+ if (nbt.contains("HivePos"))
|
||||
+ {
|
||||
+ // Scissors start - Limit HivePos
|
||||
+ final BlockPos savedHivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos"));
|
||||
+ this.hivePos = this.level.isLoadedAndInBounds(savedHivePos) ? savedHivePos : null;
|
||||
+ // Scissors end - Limit HivePos
|
||||
}
|
||||
|
||||
this.savedFlowerPos = null;
|
||||
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 bb5c2f90bef5e3c57ffde996853e122d108b2789..4505af9d995df1ed2912814249bc336127be4f06 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||
@@ -118,8 +118,12 @@ public class Vex extends Monster implements TraceableEntity {
|
||||
@Override
|
||||
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"));
|
||||
+ if (nbt.contains("BoundX"))
|
||||
+ {
|
||||
+ // 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")) {
|
32
patches/server/0051-Mute-invalid-attributes.patch
Normal file
32
patches/server/0051-Mute-invalid-attributes.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Thu, 6 Jul 2023 23:01:12 +0100
|
||||
Subject: [PATCH] Mute invalid attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..d304612325d6c70a4100582d6c0fbfeecd8716d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
@@ -145,7 +145,7 @@ public class AttributeMap {
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
- LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string);
|
||||
+ // LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string); // Scissors - Mute invalid attributes
|
||||
});
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||
index 8de09eea46c27db9d8c472e84f768976769d1b0b..c8d05d35368e0cf593bcc3589b6c108a901bdc22 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||
@@ -90,7 +90,7 @@ public class AttributeModifier {
|
||||
AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation"));
|
||||
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
|
||||
} catch (Exception var3) {
|
||||
- LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage());
|
||||
+ // LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage()); // Scissors - Mute invalid attributes
|
||||
return null;
|
||||
}
|
||||
}
|
32
patches/server/0052-Mute-invalid-Enderdragon-phases.patch
Normal file
32
patches/server/0052-Mute-invalid-Enderdragon-phases.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Allink <arclicious@vivaldi.net>
|
||||
Date: Thu, 6 Jul 2023 23:34:46 +0100
|
||||
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 bca131e9c428e2cb073ae2ef517dda12f73a5dcd..b9d603c82b12299e94c31928b36c9517834cff62 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.");
|
||||
+ // 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 c2a14305cb737fbc6447c555d8a15e2d3977e3fa..402663c4ffca762df0bfb245e0d5a1ea42ef2150 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
|
||||
@@ -32,7 +32,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");
|
||||
+ // 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()) {
|
@ -1,7 +1,7 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user