mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 15:28:34 +00:00
Compare commits
338 Commits
archive/1.
...
folia/1.20
Author | SHA1 | Date | |
---|---|---|---|
7cec3d6681 | |||
e2427f3613 | |||
e8dbeb27e9 | |||
e1d2dd4813 | |||
c4826c11c8 | |||
44567fd8b0 | |||
1111ffabd7 | |||
a928a00e34 | |||
dce994005e | |||
4727e8db38 | |||
8303790110 | |||
6b951f73c5 | |||
36b4a55f38 | |||
1175851f8d | |||
896bf3f11b | |||
ed986eccd1 | |||
b4d84dc21b | |||
5d1989e36c | |||
3a063e3397 | |||
0d9d87dacf | |||
71a59bc142 | |||
8f81b70a32 | |||
6015aa70b7 | |||
b697c4be94 | |||
77e1aa9166 | |||
30357ec6b0 | |||
577780ddbf | |||
8134fe5dc1 | |||
503d399712 | |||
083e1d8f83 | |||
4c6342a24c | |||
5b98ad272f | |||
2109ba025d | |||
25eed98578 | |||
8bb5b4c152 | |||
9515027636 | |||
41e0723e0e | |||
76bd4f5ff2 | |||
51d07d5014 | |||
1376571cbd | |||
0070aa0553 | |||
d749843f1e | |||
f9f5f1b345 | |||
d2e0e16016 | |||
ddaee58457 | |||
ab658d7e35 | |||
016966e97e | |||
7bc46e28a7 | |||
345cce1b63 | |||
871cc5653c | |||
ca518d0329 | |||
70c16f6ffa | |||
9809c34764 | |||
c92c04eff6 | |||
f44bda2c9e | |||
0c8658f767 | |||
6b00cbdbb9 | |||
0aff8684fe | |||
e7512f7b6d | |||
772d2a7558 | |||
defd33d2bd | |||
adb61dab39 | |||
08e661b27a | |||
8ee33f4a4d | |||
7bebfce7df | |||
cb210eb5a1 | |||
4a8c0ce378 | |||
f128a0fc62 | |||
a40a8e3ed6 | |||
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 | |||
46668157cb | |||
3c39f1892b | |||
59d76f7bea | |||
aa10085c27 | |||
506b716f7b | |||
c054fc5086 | |||
6e849f20cd | |||
d3ac39a78f | |||
5722923db1 | |||
8fb90b1264 | |||
2c65ed7440 | |||
b36df60ff1 | |||
3f1d9c9ac8 | |||
420496e2e0 | |||
77839d1184 | |||
4df9a3cb36 | |||
7d85029867 | |||
54af1d2b70 | |||
b2fa32800c | |||
8befd612e7 | |||
6ee56d0f13 | |||
2b1cf2200e | |||
0d072fc182 | |||
04a1068b17 | |||
1fa3f6a734 | |||
6931ebe3f3 | |||
107075987e | |||
73b78dc339 | |||
261416de49 | |||
ce0f198467 | |||
4930040ef9 | |||
1bd8ad23ab | |||
da8e9e0497 | |||
d495d26d78 | |||
e3c53a1f8e | |||
67d8415fb3 | |||
cd9edca0e9 | |||
823057089b | |||
7081efe798 | |||
042c4d854f | |||
c32bbf0728 | |||
14d33a5998 | |||
6884a59cf4 | |||
d13728a72f | |||
6cf04f68f9 | |||
3780ab8142 | |||
3c9f6d0e01 | |||
54c0013982 | |||
fba2ddfedc | |||
7b1a66a44e | |||
53755af975 | |||
41be2256f0 | |||
aedd5067fd | |||
ef929a72a2 | |||
81609b1d4b | |||
65407daeae | |||
719cce7443 | |||
1546e4ae5f | |||
2671eeee6b | |||
a988bca4a6 | |||
b76c7d1ccd | |||
856ff4c719 | |||
4c0a4b8804 | |||
243ebd8d3b |
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
@ -1,5 +1,10 @@
|
|||||||
name: Patch and Build
|
name: Patch and Build
|
||||||
on: [ push, pull_request ]
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "**" ]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
# Only run on PRs if the source branch is on someone else's repo
|
# Only run on PRs if the source branch is on someone else's repo
|
||||||
@ -7,26 +12,19 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Git Repository
|
- name: Checkout Git Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Validate Gradle wrapper
|
- name: Validate Gradle wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
- name: Cache Gradle
|
- name: Setup Gradle
|
||||||
uses: actions/cache@v2
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.gradle/caches
|
|
||||||
~/.gradle/wrapper
|
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-gradle-
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v2.3.0
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
- name: Configure Git User Details
|
- name: Configure Git User Details
|
||||||
run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
|
run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
|
||||||
- name: Apply Patches
|
- name: Apply Patches
|
||||||
run: ./gradlew applyPatches --stacktrace
|
run: ./gradlew applyPatches
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build --stacktrace
|
run: ./gradlew build
|
||||||
|
16
Jenkinsfile
vendored
16
Jenkinsfile
vendored
@ -1,21 +1,27 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
options {
|
environment {
|
||||||
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')
|
GITHUB_BRANCH = "${BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('applyPatches') {
|
stage('applyPatches') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
sh './gradlew applyPatches --no-daemon'
|
sh './gradlew applyPatches --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('paperclipJar') {
|
stage('paperclipJar') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
sh './gradlew paperclipJar --no-daemon'
|
sh './gradlew createReobfPaperclipJar --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
|
sh """
|
||||||
|
#!/bin/sh
|
||||||
|
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
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('test') {
|
stage('test') {
|
||||||
@ -28,7 +34,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
archiveArtifacts artifacts: 'build/libs/*.jar', fingerprint: true
|
archiveArtifacts artifacts: 'build/libs/scissors-*.jar', fingerprint: true
|
||||||
junit 'Scissors-Server/build/test-results/test/*.xml'
|
junit 'Scissors-Server/build/test-results/test/*.xml'
|
||||||
junit 'Scissors-API/build/test-results/test/*.xml'
|
junit 'Scissors-API/build/test-results/test/*.xml'
|
||||||
cleanWs()
|
cleanWs()
|
||||||
|
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Scissors inherits its licensing from upstream projects.
|
||||||
|
|
||||||
|
As such, Scissors is licensed under the
|
||||||
|
[GNU General Public License version 3](licenses/GPL.md); as it inherits it from Paper and Spigot,
|
||||||
|
who in turn inherits it from the original Bukkit and Craftbukkit projects.
|
||||||
|
|
||||||
|
Any author who is _not_ listed below should be presumed to have released their work
|
||||||
|
under the original [GPL](licenses/GPL.md) license.
|
||||||
|
|
||||||
|
In the interest of promoting a better Minecraft platform for everyone, contributors
|
||||||
|
may choose to release their code under the more permissive [MIT License](licenses/MIT.md).
|
||||||
|
|
||||||
|
The authors listed below have chosen to release their code under that more permissive
|
||||||
|
[MIT License](licenses/MIT.md). Any contributor who wants their name added below
|
||||||
|
should submit a pull request to this project to add their name.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Allink (allinkdev) <arclicious@vivaldi.net>
|
||||||
|
Luna (LunaWasFlaggedAgain) <lunahatesgogle@gmail.com>
|
||||||
|
Telesphoreo <me@telesphoreo.me>
|
||||||
|
```
|
34
README.md
34
README.md
@ -1,2 +1,32 @@
|
|||||||
# Scissors
|
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.20.1/)
|
||||||
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.
|
|
||||||
|
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.20.1)
|
||||||
|
### [Scissors Announcements](https://totalfreedom.me/forum/board/139)
|
||||||
|
### [Scissors General Discussion](https://totalfreedom.me/forum/board/140)
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
```
|
||||||
|
Paperweight tasks
|
||||||
|
-----------------
|
||||||
|
applyApiPatches
|
||||||
|
applyPatches
|
||||||
|
applyServerPatches
|
||||||
|
cleanCache - Delete the project setup cache and task outputs.
|
||||||
|
createMojmapBundlerJar - Build a runnable bundler jar
|
||||||
|
createMojmapPaperclipJar - Build a runnable paperclip jar
|
||||||
|
createReobfBundlerJar - Build a runnable bundler jar
|
||||||
|
createReobfPaperclipJar - Build a runnable paperclip jar
|
||||||
|
generateDevelopmentBundle
|
||||||
|
rebuildApiPatches
|
||||||
|
rebuildPatches
|
||||||
|
rebuildServerPatches
|
||||||
|
reobfJar - Re-obfuscate the built jar to obf mappings
|
||||||
|
runDev - Spin up a non-relocated Mojang-mapped test server
|
||||||
|
runReobf - Spin up a test server from the reobfJar output jar
|
||||||
|
runShadow - Spin up a test server from the shadowJar archiveFile
|
||||||
|
```
|
||||||
|
@ -8,3 +8,9 @@
|
|||||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||||
|
|
||||||
|
## Used in Scissors 1.19
|
||||||
|
#minecraft net/minecraft/world/ContainerHelper
|
||||||
|
#minecraft net/minecraft/network/chat/contents/NbtContents
|
||||||
|
#minecraft net/minecraft/network/chat/ComponentUtils
|
||||||
|
#minecraft net/minecraft/network/chat/contents/EntityDataSource
|
@ -1,31 +1,23 @@
|
|||||||
import io.papermc.paperweight.util.constants.*
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
|
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||||
id("io.papermc.paperweight.patcher") version "1.2.0"
|
id("io.papermc.paperweight.patcher") version "1.5.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
val spigotDecompiler: Configuration by configurations.creating
|
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
maven(paperMavenPublicUrl) {
|
||||||
content {
|
content { onlyForConfigurations(configurations.paperclip.name) }
|
||||||
onlyForConfigurations(
|
|
||||||
configurations.paperclip.name,
|
|
||||||
spigotDecompiler.name,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
remapper("net.fabricmc:tiny-remapper:0.8.1:fat")
|
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||||
decompiler("net.minecraftforge:forgeflower:1.5.498.22")
|
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.4")
|
paperclip("io.papermc:paperclip:3.0.3")
|
||||||
paperclip("io.papermc:paperclip:2.0.1")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@ -50,21 +42,29 @@ subprojects {
|
|||||||
tasks.withType<ProcessResources> {
|
tasks.withType<ProcessResources> {
|
||||||
filteringCharset = Charsets.UTF_8.name()
|
filteringCharset = Charsets.UTF_8.name()
|
||||||
}
|
}
|
||||||
|
tasks.withType<Test> {
|
||||||
|
minHeapSize = "2g"
|
||||||
|
maxHeapSize = "4g"
|
||||||
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://papermc.io/repo/repository/maven-public/")
|
maven(paperMavenPublicUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paperweight {
|
paperweight {
|
||||||
serverProject.set(project(":Scissors-Server"))
|
serverProject.set(project(":Scissors-Server"))
|
||||||
|
|
||||||
remapRepo.set("https://maven.fabricmc.net/")
|
remapRepo.set(paperMavenPublicUrl)
|
||||||
decompileRepo.set("https://files.minecraftforge.net/maven/")
|
decompileRepo.set(paperMavenPublicUrl)
|
||||||
|
|
||||||
|
useStandardUpstream("Folia") {
|
||||||
|
url.set(github("PaperMC", "Folia"))
|
||||||
|
ref.set(providers.gradleProperty("foliaRef"))
|
||||||
|
|
||||||
|
withStandardPatcher {
|
||||||
|
baseName("Folia")
|
||||||
|
|
||||||
usePaperUpstream(providers.gradleProperty("paperRef")) {
|
|
||||||
withPaperPatcher {
|
|
||||||
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
||||||
apiOutputDir.set(layout.projectDirectory.dir("Scissors-API"))
|
apiOutputDir.set(layout.projectDirectory.dir("Scissors-API"))
|
||||||
|
|
||||||
@ -73,3 +73,32 @@ paperweight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.generateDevelopmentBundle {
|
||||||
|
apiCoordinates.set("me.totalfreedom.scissors:scissors-api")
|
||||||
|
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||||
|
libraryRepositories.set(
|
||||||
|
listOf(
|
||||||
|
"https://repo.maven.apache.org/maven2/",
|
||||||
|
paperMavenPublicUrl,
|
||||||
|
"https://repo.scissors.gg/repository/scissors-snapshot/",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
// Publishing API:
|
||||||
|
// ./gradlew :Scissors-API:publish[ToMavenLocal]
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "scissors-snapshots"
|
||||||
|
url = uri("https://repo.scissors.gg/repository/scissors-snapshot/")
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("scissorsUser")
|
||||||
|
password = System.getenv("scissorsPassword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,10 @@
|
|||||||
group=me.totalfreedom.scissors
|
group=me.totalfreedom.scissors
|
||||||
version=1.17.1-R0.1-SNAPSHOT
|
version=1.20.1-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion=1.17.1
|
mcVersion=1.20.1
|
||||||
paperRef=6625db387ea9fe5296a6c6f984975b387c3089f0
|
foliaRef=edafbcef6884cffe493e62cd71f4957708fba7ff
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.vfs.watch=false
|
org.gradle.vfs.watch=false
|
||||||
|
org.gradle.jvmargs=-Xmx4096m
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
18
gradlew
vendored
18
gradlew
vendored
@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (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.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@ -80,10 +80,10 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
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.
|
# 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"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
@ -143,12 +143,16 @@ fi
|
|||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | 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" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@ -205,6 +209,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
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.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# 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 limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@ -25,7 +25,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
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
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
675
licenses/GPL.md
Normal file
675
licenses/GPL.md
Normal file
@ -0,0 +1,675 @@
|
|||||||
|
### GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
### Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom
|
||||||
|
to share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users. We, the Free Software Foundation, use
|
||||||
|
the GNU General Public License for most of our software; it applies
|
||||||
|
also to any other work released this way by its authors. You can apply
|
||||||
|
it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you
|
||||||
|
have certain responsibilities if you distribute copies of the
|
||||||
|
software, or if you modify it: responsibilities to respect the freedom
|
||||||
|
of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the
|
||||||
|
manufacturer can do so. This is fundamentally incompatible with the
|
||||||
|
aim of protecting users' freedom to change the software. The
|
||||||
|
systematic pattern of such abuse occurs in the area of products for
|
||||||
|
individuals to use, which is precisely where it is most unacceptable.
|
||||||
|
Therefore, we have designed this version of the GPL to prohibit the
|
||||||
|
practice for those products. If such problems arise substantially in
|
||||||
|
other domains, we stand ready to extend this provision to those
|
||||||
|
domains in future versions of the GPL, as needed to protect the
|
||||||
|
freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish
|
||||||
|
to avoid the special danger that patents applied to a free program
|
||||||
|
could make it effectively proprietary. To prevent this, the GPL
|
||||||
|
assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
### TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
#### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
#### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
#### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
#### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
#### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
#### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
#### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
#### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
#### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
#### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
#### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
#### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
#### 13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
#### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in
|
||||||
|
detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU General Public
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that numbered version or
|
||||||
|
of any later version published by the Free Software Foundation. If the
|
||||||
|
Program does not specify a version number of the GNU General Public
|
||||||
|
License, you may choose any version ever published by the Free
|
||||||
|
Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU General Public License can be used, that proxy's public
|
||||||
|
statement of acceptance of a version permanently authorizes you to
|
||||||
|
choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
#### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
#### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
#### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands \`show w' and \`show c' should show the
|
||||||
|
appropriate parts of the General Public License. Of course, your
|
||||||
|
program's commands might be different; for a GUI interface, you would
|
||||||
|
use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your
|
||||||
|
program into proprietary programs. If your program is a subroutine
|
||||||
|
library, you may consider it more useful to permit linking proprietary
|
||||||
|
applications with the library. If this is what you want to do, use the
|
||||||
|
GNU Lesser General Public License instead of this License. But first,
|
||||||
|
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
23
licenses/MIT.md
Normal file
23
licenses/MIT.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the “Software”), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
63
patches/api/0001-Add-MasterBlockFireEvent.patch
Normal file
63
patches/api/0001-Add-MasterBlockFireEvent.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 4 Jul 2022 16:44:35 +0100
|
||||||
|
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..a24cb52a5af62012c5d5acc29e4c3558e92ae572
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
|
@@ -0,0 +1,51 @@
|
||||||
|
+package me.totalfreedom.scissors.event.block;
|
||||||
|
+
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a GameMasterBlock is fired (i.e. command block, structure block, jigsaw block)
|
||||||
|
+ */
|
||||||
|
+public class MasterBlockFireEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Location at;
|
||||||
|
+
|
||||||
|
+ public MasterBlockFireEvent(@NotNull Location at)
|
||||||
|
+ {
|
||||||
|
+ this.at = at;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Location getAt()
|
||||||
|
+ {
|
||||||
|
+ return this.at;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancelled)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancelled;
|
||||||
|
+ }
|
||||||
|
+}
|
72
patches/api/0002-Add-spectator-teleport-event.patch
Normal file
72
patches/api/0002-Add-spectator-teleport-event.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
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..d7efa63c316ed99c3eccfeadc1b0873b2ccb5d8a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
|
@@ -0,0 +1,60 @@
|
||||||
|
+package me.totalfreedom.scissors.event.player;
|
||||||
|
+
|
||||||
|
+import org.bukkit.entity.Entity;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called whenever a spectator attempts to teleport to an entity
|
||||||
|
+ */
|
||||||
|
+public class SpectatorTeleportEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlerList = new HandlerList();
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final Entity target;
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+
|
||||||
|
+ public SpectatorTeleportEvent(@NotNull Player player, @NotNull Entity target)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.target = target;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public Player getPlayer() {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public Entity getTarget() {
|
||||||
|
+ return this.target;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancelled)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ @Override
|
||||||
|
+ public HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlerList;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public static org.bukkit.event.HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlerList;
|
||||||
|
+ }
|
||||||
|
+}
|
24
patches/api/0003-Add-Scissors-configuration-file.patch
Normal file
24
patches/api/0003-Add-Scissors-configuration-file.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
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 b6a8217b97842cd07af24fadb21e0e44226e5bb9..d4e33e4c94f5c81d14a138c8be46939b758dd21b 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
|
@@ -2121,6 +2121,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ @NotNull
|
||||||
|
+ public org.bukkit.configuration.file.YamlConfiguration getScissorsConfig() {
|
||||||
|
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Sends the component to the player
|
||||||
|
*
|
173
patches/api/0004-Add-command-block-player-edit-event.patch
Normal file
173
patches/api/0004-Add-command-block-player-edit-event.patch
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 20:42:02 +0100
|
||||||
|
Subject: [PATCH] Add command block player edit event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/CommandBlockPlayerEditEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/CommandBlockPlayerEditEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..722f5839600954998cbbf799e68477d499d104c4
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/CommandBlockPlayerEditEvent.java
|
||||||
|
@@ -0,0 +1,77 @@
|
||||||
|
+package me.totalfreedom.scissors.event.block;
|
||||||
|
+
|
||||||
|
+import org.bukkit.block.CommandBlock;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a command block is modified by a player
|
||||||
|
+ */
|
||||||
|
+public class CommandBlockPlayerEditEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final String oldCommand;
|
||||||
|
+ private String newCommand;
|
||||||
|
+ private final CommandBlock commandBlock;
|
||||||
|
+
|
||||||
|
+ public CommandBlockPlayerEditEvent(@NotNull Player player, @NotNull String oldCommand, @NotNull String newCommand, @NotNull CommandBlock commandBlock)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.oldCommand = oldCommand;
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ this.commandBlock = commandBlock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getNewCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getOldCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.oldCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setNewCommand(@NotNull String newCommand)
|
||||||
|
+ {
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Player getPlayer()
|
||||||
|
+ {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull CommandBlock getCommandBlock()
|
||||||
|
+ {
|
||||||
|
+ return this.commandBlock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return this.cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancel)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancel;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
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..4282f24deb87e52ee19a13b172ec80c6a6017e28
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||||
|
@@ -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;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a command block is modified by a player
|
||||||
|
+ */
|
||||||
|
+public class CommandMinecartPlayerEditEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final String oldCommand;
|
||||||
|
+ private String newCommand;
|
||||||
|
+ private final CommandMinecart commandMinecart;
|
||||||
|
+
|
||||||
|
+ public CommandMinecartPlayerEditEvent(@NotNull Player player, @NotNull String oldCommand, @NotNull String newCommand, @NotNull CommandMinecart commandMinecart)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.oldCommand = oldCommand;
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ this.commandMinecart = commandMinecart;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getNewCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getOldCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.oldCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setNewCommand(@NotNull String newCommand)
|
||||||
|
+ {
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Player getPlayer()
|
||||||
|
+ {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull CommandMinecart getCommandMinecart()
|
||||||
|
+ {
|
||||||
|
+ return this.commandMinecart;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return this.cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancel)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancel;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
@ -5,74 +5,124 @@ Subject: [PATCH] Build changes
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2858823a1 100644
|
index 9ee90bc753e65f9dd532f28ec75cc16bf16486c8..9ca282a17c94d1314c625ca4ad15bb899cd6e02f 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -13,8 +13,8 @@ plugins {
|
@@ -13,12 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||||
}
|
val alsoShade: Configuration by configurations.creating
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
- implementation(project(":Paper-API"))
|
- // Folia start
|
||||||
- implementation(project(":Paper-MojangAPI"))
|
- implementation(project(":folia-api"))
|
||||||
+ implementation(project(":Scissors-API")) // Scissors
|
- implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
|
||||||
+ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // Scissors
|
+ // Scissors start
|
||||||
|
+ implementation(project(":Scissors-API"))
|
||||||
|
+ implementation("io.papermc.paper:paper-mojangapi:1.20.1-R0.1-SNAPSHOT") {
|
||||||
|
exclude("io.papermc.paper", "paper-api")
|
||||||
|
}
|
||||||
|
- // Folia end
|
||||||
|
+ // Scissors end
|
||||||
// Paper start
|
// Paper start
|
||||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
@@ -66,7 +66,7 @@ tasks.jar {
|
@@ -72,11 +72,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)
|
||||||
|
+ {
|
||||||
|
+ gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||||
|
+ } else {
|
||||||
|
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "CraftBukkit",
|
"Implementation-Title" to "CraftBukkit",
|
||||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
- "Implementation-Version" to "git-Folia-$implementationVersion", // Folia
|
||||||
+ "Implementation-Version" to "git-Scissors-$implementationVersion", // Scissors
|
+ "Implementation-Version" to "git-Scissors-$implementationVersion", // Scissors // Folia
|
||||||
"Implementation-Vendor" to date, // Paper
|
"Implementation-Vendor" to date, // Paper
|
||||||
"Specification-Title" to "Bukkit",
|
"Specification-Title" to "Bukkit",
|
||||||
"Specification-Version" to project.version,
|
"Specification-Version" to project.version,
|
||||||
@@ -193,7 +193,7 @@ tasks.test {
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
fun TaskContainer.registerRunTask(
|
index cb60d58d4a7556dd896f31d0cd249f860bb3ef84..f7038ee0d3475ee9c187da8feb12ff4553130e1d 100644
|
||||||
name: String, block: JavaExec.() -> Unit
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
- group = "paper"
|
@@ -593,7 +593,7 @@ public class Metrics {
|
||||||
+ group = "paperweight"
|
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||||
standardInput = System.`in`
|
// Only start Metrics, if it's enabled in the config
|
||||||
workingDir = rootProject.layout.projectDirectory.dir(
|
if (config.getBoolean("enabled", true)) {
|
||||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
- Metrics metrics = new Metrics("Folia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page
|
||||||
|
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger()); // Scissors // Folia - we have our own bstats page
|
||||||
|
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||||
|
String minecraftVersion = Bukkit.getVersion();
|
||||||
|
@@ -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-Folia-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Folia - we have our own bstats page
|
||||||
|
+ paperVersion = "git-Scissors-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Scissors // Folia - we have our own bstats page
|
||||||
|
} else {
|
||||||
|
paperVersion = "unknown";
|
||||||
|
}
|
||||||
|
- metrics.addCustomChart(new Metrics.SimplePie("folia_version", () -> paperVersion)); // Folia - we have our own bstats page
|
||||||
|
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> paperVersion)); // Scissors // Folia - we have our own bstats page
|
||||||
|
|
||||||
|
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
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 8091a901106a1085da9dfd8627dadcbe50f00872..e6da0f7e755e6b0225afbced2c7a14e9df83b09d 100644
|
index 75eb95c330d6ab7ac1e4a69da13695bbd40f894e..1d2918a9f1307bc6b36ea3973dc0fff9fd073647 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1729,7 +1729,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1811,7 +1811,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
- return "Folia"; // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||||
+ return "Scissors"; // Scissors - Scissors > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
+ return "Scissors"; // Scissors - Scissors > // Folia - Folia > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||||
}
|
}
|
||||||
|
|
||||||
public SystemReport fillSystemReport(SystemReport details) {
|
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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 99a94898316b0601f55b333c15a9926eae24f8a2..cc797b45674163b5913e20031d110796d78b928b 100644
|
index a8bf1f542ab20eb7c40c80b5e42b55982677373d..f9a2190b74121e510c8a234905ee5eb24e5ea7f7 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -251,7 +251,7 @@ import javax.annotation.Nullable; // Paper
|
@@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper
|
||||||
import javax.annotation.Nonnull; // Paper
|
import javax.annotation.Nonnull; // Paper
|
||||||
|
|
||||||
public final class CraftServer implements Server {
|
public final class CraftServer implements Server {
|
||||||
- private final String serverName = "Paper"; // Paper
|
- private final String serverName = "Folia"; // Folia // Paper
|
||||||
+ private final String serverName = "Scissors"; // Scissors // Paper
|
+ private final String serverName = "Scissors"; // Scissors // Folia // Paper
|
||||||
private final String serverVersion;
|
private final String serverVersion;
|
||||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||||
private final Logger logger = Logger.getLogger("Minecraft");
|
private final Logger logger = Logger.getLogger("Minecraft");
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
index 774556a62eb240da42e84db4502e2ed43495be17..becf61c0adde1c27f3e462a1b8248544ab181797 100644
|
index e9b6ca3aa25e140467ae866d572483050ea3fa0e..bb37db7715b7c5eb497f4d5f5a32668ad947943b 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||||
public static String getBukkitVersion() {
|
public static String getBukkitVersion() {
|
||||||
String result = "Unknown-Version";
|
String result = "Unknown-Version";
|
||||||
|
|
||||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.folia/folia-api/pom.properties"); // Folia
|
||||||
+ 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"); // Folia // Scissors
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
|
@ -1,17 +1,34 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Sat, 12 Mar 2022 19:34:59 -0700
|
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
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
index fda8aad4a394cf331f3421ec07ffe0d605c8da4e..c5711b3d120699ec78f81e9b6ee80d0764552e94 100644
|
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
@@ -175,7 +175,14 @@ public class HoverEvent {
|
@@ -174,7 +174,14 @@ public class HoverEvent {
|
||||||
} else {
|
} else {
|
||||||
JsonObject jsonObject = json.getAsJsonObject();
|
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"));
|
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ UUID uUID;
|
+ UUID uUID;
|
||||||
@ -24,10 +41,10 @@ index fda8aad4a394cf331f3421ec07ffe0d605c8da4e..c5711b3d120699ec78f81e9b6ee80d07
|
|||||||
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
|
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
|
||||||
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
||||||
}
|
}
|
||||||
@@ -187,7 +194,14 @@ public class HoverEvent {
|
@@ -186,7 +193,14 @@ public class HoverEvent {
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
||||||
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
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"));
|
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ UUID uUID;
|
+ UUID uUID;
|
||||||
@ -38,5 +55,5 @@ index fda8aad4a394cf331f3421ec07ffe0d605c8da4e..c5711b3d120699ec78f81e9b6ee80d07
|
|||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
||||||
} catch (CommandSyntaxException | JsonSyntaxException var5) {
|
} catch (Exception var5) {
|
||||||
return null;
|
return null;
|
200
patches/server/0003-ResourceLocation-validation.patch
Normal file
200
patches/server/0003-ResourceLocation-validation.patch
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
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 15173e715fa36546820d930a46e0f0c493d07cfc..356cc6f468975faa676db87db8fc0fa2df32f020 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
|
@@ -17,7 +17,7 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.bukkit.loot.LootTable getLootTable() {
|
||||||
|
- return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
|
||||||
|
+ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() && entity.getLootTable().toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; // Scissors - Validate length of loot tables before even trying
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||||
|
index 2ee4ee14ab3345486dad6b24fd9a4fcc6c746b99..c5ac6cda91a81d3075f5c763e30dc009b6be7936 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||||
|
@@ -15,7 +15,7 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.bukkit.loot.LootTable getLootTable() {
|
||||||
|
- return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null;
|
||||||
|
+ return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() && tileEntityLootable.lootTable.toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; // Scissors - Validate length of loot tables before even trying
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
index a178f00744ad2e27c0f35d69803574e5a16ec294..a971a7efc8e2a318d596f668e35a933de90b0525 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
@@ -408,7 +408,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 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..7b0aed8ed3a150b7c10fa246bb0b519232424737 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 a21edc7df32a59a6cb1af3865d2ce35f72cf8afc..0b272b0cf56dcb1c509fa63ff0f6e526c5536748 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
@@ -638,7 +638,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 448fa4f4f200430d6ce3051763c7ceb697696146..40e59b8db83aec1143e3c394427e916beea7c01f 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/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||||
|
index 0425151e688966442340ea1cf892aff34ffe0791..244b04e0020b1bd1e7be34a1b6266a8ac75d29fc 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||||
|
@@ -199,7 +199,7 @@ public class BrushableBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
private boolean tryLoadLootTable(CompoundTag nbt) {
|
||||||
|
if (nbt.contains("LootTable", 8)) {
|
||||||
|
- this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
||||||
|
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors
|
||||||
|
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
|
||||||
|
index 6f9286db4e5786464fb0b49dc125e1228ab7ae93..8d91accb0d5e8afa3957d816bd71681b4198ee6e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
|
||||||
|
@@ -90,7 +90,7 @@ public class DecoratedPotBlockEntity extends BlockEntity {
|
||||||
|
return Items.BRICK;
|
||||||
|
} else {
|
||||||
|
Tag tag = list.get(index);
|
||||||
|
- return BuiltInRegistries.ITEM.get(new ResourceLocation(tag.getAsString()));
|
||||||
|
+ return BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(tag.getAsString())); // Scissors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 081691f9710ff1115e4308f79ed49fbc38941193..c29dfd15e147d5c4d9c9584ff7803c2a52009f0d 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 b7d0892953f357e58665e87fbcf794a75f1c0980..e65232cb1abd59b896650e249a2b2ad8b0828712 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
@@ -41,8 +41,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 148d0393b093a326f76fc34c035768f4758f3f1b..43034806bf8dcd940e1ec47edd3875adb9cefe0f 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
@@ -88,8 +88,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
|
@ -5,27 +5,23 @@ 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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||||
index 7cacc61fed0c610845c67894d1cc68e44f5e46fe..4186b9558cbf6799e8491443b9ed5a2c9063ab7c 100644
|
index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..48fce864be2a92c9665b9eeb85e3193eaed4133d 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||||
@@ -6,6 +6,9 @@ import java.util.Map;
|
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import java.util.UUID;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import com.destroystokyo.paper.profile.CraftPlayerProfile;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
||||||
+// Scissors start
|
+import org.apache.commons.lang3.StringUtils; // Scissors
|
||||||
+import org.apache.commons.lang3.StringUtils;
|
|
||||||
+// Scissors end
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.NamespacedKey;
|
||||||
@@ -47,7 +50,9 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
@@ -74,7 +75,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||||
|
try { // Paper - Ignore invalid game profiles
|
||||||
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
|
||||||
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT)));
|
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()) {
|
- } 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
|
||||||
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) {
|
|
||||||
+ // Scissors end
|
|
||||||
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ignored) {} // Paper
|
@ -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 f57864ce919ef4721cfb5913c636fe8903ce4cc1..d80c7be5b153db4046d0b11c0116c6aa860ea48c 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);
|
|
@ -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
|
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 8484e80a70129fb0358d56efab6fd54798b54e6e..90fce5d2178672608f3ae97277cafe740a9ebead 100644
|
index 41c9f074203915c31c1ae7a160ce509c13383f84..8b4989593da43fc2fd661ac66bfe5ae1eb5e2780 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||||
+++ b/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;
|
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.network.protocol.game.DebugPackets;
|
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.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
@@ -351,6 +352,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
@@ -370,6 +371,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
for (int i = 0; i < nbttaglist.size(); ++i) {
|
||||||
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
|
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
|
||||||
@ -25,7 +25,7 @@ index 8484e80a70129fb0358d56efab6fd54798b54e6e..90fce5d2178672608f3ae97277cafe74
|
|||||||
+ if (!nbttagcompound1.contains("id") || !ResourceLocation.isValidResourceLocation(nbttagcompound1.getString("id")) || EntityType.byString(nbttagcompound1.getString("id")).isEmpty()) {
|
+ if (!nbttagcompound1.contains("id") || !ResourceLocation.isValidResourceLocation(nbttagcompound1.getString("id")) || EntityType.byString(nbttagcompound1.getString("id")).isEmpty()) {
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissor end
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
||||||
|
|
@ -5,19 +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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
index c88ab49f60857d5687facc8523f9edc4d652c81b..2e3220cbbea5f6cb9acb7f8fbaf2ff8f91b09234 100644
|
index 3df1822b55358a9bdf41bcacd5b7fecfd8f05dfa..f9741039dada19391e80d9623f2d8cabc1089506 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
@@ -1758,7 +1758,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -1813,8 +1813,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
try {
|
|
||||||
blockParser = blockParser.parse(false);
|
|
||||||
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) {
|
|
||||||
- e.printStackTrace();
|
|
||||||
+ // Scissors - Don't log errors thrown by Brigadier when an error is thrown
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1782,8 +1782,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
||||||
resource = CraftNamespacedKey.fromMinecraft(key);
|
resource = CraftNamespacedKey.fromMinecraft(key);
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
|
@ -6,19 +6,18 @@ 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
|
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 d80c7be5b153db4046d0b11c0116c6aa860ea48c..dfbae9ca58722c0aeb6cb9888643016d4cb36f63 100644
|
index 272095d7a09ab41227d741172735f66fd2798ce1..757ae1773ba35c2348483dddbb231060afafc602 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||||
@@ -192,7 +192,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -139,7 +139,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
@Override
|
@Override
|
||||||
public void remove(Entity.RemovalReason reason) {
|
public void remove(Entity.RemovalReason reason) {
|
||||||
if (!this.level.isClientSide && reason.shouldDestroy()) {
|
if (!this.level().isClientSide && reason.shouldDestroy()) {
|
||||||
- Containers.dropContents(this.level, this, this);
|
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||||
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
||||||
+ try {
|
+ try {
|
||||||
+ Containers.dropContents(this.level, this, this);
|
+ Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||||
+ } catch (Exception ignored) {
|
+ } catch (Exception ignored) {}
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
@ -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,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
|
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 063f3e4c67e6716c9a03dbe4b72eafd32e4f0d53..03b8cc0ae12f17cf3a1c57958cf10ca23750b92a 100644
|
index 76e010769786132d8af3889051b3f52e9f683509..c8ac6e7dd19dfe38a99364f586c8d8d5e2539fb4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
@@ -377,11 +377,14 @@ public class ItemEntity extends Entity {
|
@@ -424,11 +424,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||||
|
|
||||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||||
|
|
||||||
- this.setItem(ItemStack.of(nbttagcompound1));
|
- this.setItem(ItemStack.of(nbttagcompound1));
|
||||||
|
- if (this.getItem().isEmpty()) {
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
if (this.getItem().isEmpty()) {
|
+ ItemStack item = ItemStack.of(nbttagcompound1);
|
||||||
|
+ if (item.isEmpty()) {
|
||||||
this.discard();
|
this.discard();
|
||||||
+ return;
|
+ return;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ this.setItem(ItemStack.of(nbttagcompound1));
|
+ this.setItem(item);
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
index bb5319afd112f1013445e29e9fcad137d4c581f9..1cd62752e675b91fdcc21733509c95d5bd97625a 100644
|
index b79f4ce38a42e4dba8ebdfc97dadc531b7245c7a..9c49be7c53a1f2a8c203341b8ded9cd222d0c178 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||||
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
|
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
|
||||||
@ -31,10 +31,10 @@ index bb5319afd112f1013445e29e9fcad137d4c581f9..1cd62752e675b91fdcc21733509c95d5
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
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
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
+++ b/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++) {
|
for (int i = 0; i < pages.size(); i++) {
|
||||||
String recipe = pages.getString(i);
|
String recipe = pages.getString(i);
|
||||||
|
|
||||||
@ -42,8 +42,7 @@ index e816e505cd292d6c5138dff0aeae0e9592c09de0..0f6438dfe0a6620eb87233b9eefbe234
|
|||||||
+ // Scissors start - Don't add recipes with invalid namespaces
|
+ // Scissors start - Don't add recipes with invalid namespaces
|
||||||
+ try {
|
+ try {
|
||||||
+ this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
+ this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
||||||
+ } catch (Exception ignored) {
|
+ } catch (Exception ignored) {}
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
+ // 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 efa800402413202d190926610d8264dfbf5019e7..1b3229128771adb85a7d007989891ef073a80278 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
@@ -234,7 +234,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 270b37a34de47bc9846442d58827e8ff5e35178c..dbac57c9f6048779330f404d96ad213af5810707 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
|
@@ -546,7 +546,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,10 +5,10 @@ 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
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
index c5711b3d120699ec78f81e9b6ee80d0764552e94..9c1341803cf892f7f3af11381bd56bc95f31fad0 100644
|
index c0633f9553fb5aa52e8ffc863159521d09cb3bd5..7449a024265c42f28a6c9a1ed8d8f4b9e3096aac 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
@@ -315,7 +315,7 @@ public class HoverEvent {
|
@@ -314,7 +314,7 @@ public class HoverEvent {
|
||||||
CompoundTag compoundTag = TagParser.parseTag(string);
|
CompoundTag compoundTag = TagParser.parseTag(string);
|
||||||
return new HoverEvent.ItemStackInfo(item, i, compoundTag);
|
return new HoverEvent.ItemStackInfo(item, i, compoundTag);
|
||||||
} catch (CommandSyntaxException var6) {
|
} catch (CommandSyntaxException var6) {
|
||||||
@ -17,7 +17,7 @@ index c5711b3d120699ec78f81e9b6ee80d0764552e94..9c1341803cf892f7f3af11381bd56bc9
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ public class HoverEvent {
|
@@ -328,7 +328,7 @@ public class HoverEvent {
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
||||||
return new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag));
|
return new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag));
|
||||||
} catch (CommandSyntaxException var2) {
|
} catch (CommandSyntaxException var2) {
|
||||||
@ -27,10 +27,10 @@ index c5711b3d120699ec78f81e9b6ee80d0764552e94..9c1341803cf892f7f3af11381bd56bc9
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
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 b829efdb40051a41b3bf1cabb8bf7d7c952797b5..a0f20bd54f713afe17c9b5fea9fdee6c59b6e219 100644
|
index 0344b1f77f23274c2932b5dce01b0ea6887078cf..d3d716e349df0edd28a4dabe528a332ea218b37f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
@@ -388,7 +388,7 @@ public class ItemFrame extends HangingEntity {
|
@@ -443,7 +443,7 @@ public class ItemFrame extends HangingEntity {
|
||||||
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
||||||
|
|
||||||
if (itemstack.isEmpty()) {
|
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 dca8853944832e8fc5a291aa6b46d84b24181ea7..24f009fa3b84323b4c43e0ed15c224d16a7ede81 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
@@ -230,7 +230,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 52e4948fd1657fa1776ac6b0142e8c21e7567976..a811b97021e2eed6efc592bc33602a270feb75a0 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
|
||||||
@@ -536,7 +536,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
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab60919ee955a 100644
|
index e2f704c115fd6e00960bb56bb0779f1100c89c17..0a821ba42f850b95412c89eba8f66dbf0d6b5c66 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
+++ b/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.base.Charsets;
|
||||||
import com.google.common.io.Resources;
|
import com.google.common.io.Resources;
|
||||||
import com.google.gson.*;
|
import com.google.gson.*;
|
||||||
+import io.papermc.paper.util.JarManifests;
|
+import io.papermc.paper.util.JarManifests; // Scissors
|
||||||
+import java.util.Map;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.kyori.adventure.text.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;
|
@@ -19,8 +21,8 @@ import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
public class PaperVersionFetcher implements VersionFetcher {
|
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 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 GITHUB_BRANCH_NAME = "master";
|
||||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/paper";
|
||||||
+ private static final String GITHUB_BRANCH_NAME = getBranch();
|
+ private static final String GITHUB_BRANCH_NAME = getBranch(); // Scissors
|
||||||
+ private static final String DOWNLOAD_PAGE = "https://ci.plex.us.org/job/Scissors/job/" + GITHUB_BRANCH_NAME;
|
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME; // Scissors
|
||||||
private static @Nullable String mcVer;
|
private static @Nullable String mcVer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -32,10 +37,10 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab609
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Component getVersionMessage(@Nonnull String serverVersion) {
|
public Component getVersionMessage(@Nonnull String serverVersion) {
|
||||||
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
|
- String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia
|
||||||
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
|
||||||
+ String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]");
|
+ String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]"); // Scissors // Folia
|
||||||
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]);
|
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]); // Scissors // Folia
|
||||||
final Component history = getHistory();
|
final Component history = getHistory();
|
||||||
|
|
||||||
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
|
||||||
@ -45,13 +50,13 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab609
|
|||||||
|
|
||||||
+ // Scissors start - Allow getting git information
|
+ // Scissors start - Allow getting git information
|
||||||
+ public static String getCommit() {
|
+ public static String getCommit() {
|
||||||
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
||||||
+ return attributes.get("Git-Commit");
|
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Commit");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static String getBranch() {
|
+ public static String getBranch() {
|
||||||
+ Map<String, String> attributes = JarManifests.MANIFEST_MAP;
|
+ final var manifest = JarManifests.manifest(Bukkit.getServer().getClass());
|
||||||
+ return attributes.get("Git-Branch");
|
+ return manifest == null ? null : manifest.getMainAttributes().getValue("Git-Branch");
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
@ -71,3 +76,16 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab609
|
|||||||
|
|
||||||
switch (distance) {
|
switch (distance) {
|
||||||
case -1:
|
case -1:
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
index 776b7fc26fe96b69be260bbd36efae147d988640..344bef62aa1551a6a09c10492cbc26acb63fa105 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -292,7 +292,7 @@ public class Main {
|
||||||
|
if (buildDate.before(deadline.getTime())) {
|
||||||
|
// Paper start - This is some stupid bullshit
|
||||||
|
System.err.println("*** Warning, you've not updated in a while! ***");
|
||||||
|
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
|
||||||
|
+ System.err.println("*** Please download a new build from https://ci.scissors.gg/job/Scissors ***"); // Scissors > // Paper
|
||||||
|
//System.err.println("*** Server will start in 20 seconds ***");
|
||||||
|
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
||||||
|
// Paper End
|
@ -1,54 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Mon, 14 Mar 2022 00:49:35 -0600
|
|
||||||
Subject: [PATCH] Even more resource location validation
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
|
||||||
index 4733f74ff028c03a60b73280caf9e4d1e2f0ca30..02172fdcf587904258387d309938fb379a300524 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 setType(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 1c446dba5de89698397041ee38a2e1a00bec8a56..93799eda06c7b699580251f80b641c47643f3615 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
||||||
@@ -513,7 +513,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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -537,7 +537,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 8837fc04a67a656d0e780965ac113d3b28e2369f..11427668a0af28cf638df3574357f696f49af13d 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
||||||
@@ -570,7 +570,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");
|
|
||||||
}
|
|
||||||
|
|
@ -4,21 +4,39 @@ Date: Mon, 28 Mar 2022 13:19:43 -0600
|
|||||||
Subject: [PATCH] Better handling of invalid JSON components
|
Subject: [PATCH] Better handling of invalid JSON components
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||||
|
index cadb91c7f5ef80aac8513f246fdf481947fa0a17..7c64d20f551c120f37b278cc2f09b002920cab62 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||||
|
@@ -584,13 +584,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
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
index 5ba1636bbb938373e43c1f3ac561368fc9cffd43..6978d14c6bd90ffb640e39e8666430d95d5ef45c 100644
|
index 37fc353c3e59dd5af2fd6c58ac084fb0e6e155d7..2873ed7c443ed8c8c57a8b1d3e444d229f10f07b 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
@@ -24,6 +24,8 @@ import java.util.List;
|
@@ -26,6 +26,7 @@ import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+
|
+import net.minecraft.ChatFormatting; // Scissors
|
||||||
+import net.minecraft.ChatFormatting;
|
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.network.chat.contents.BlockDataSource;
|
||||||
import net.minecraft.util.FormattedCharSequence;
|
import net.minecraft.network.chat.contents.DataSource;
|
||||||
@@ -427,6 +429,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
@@ -522,6 +523,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
return Component.Serializer.GSON.toJsonTree(text);
|
return GsonHelper.toStableString(Serializer.toJsonTree(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
@ -27,7 +45,7 @@ index 5ba1636bbb938373e43c1f3ac561368fc9cffd43..6978d14c6bd90ffb640e39e8666430d9
|
|||||||
+ try {
|
+ try {
|
||||||
+ return fromJson(json);
|
+ return fromJson(json);
|
||||||
+ } catch (Exception ex) {
|
+ } catch (Exception ex) {
|
||||||
+ return new TextComponent("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -36,19 +54,19 @@ index 5ba1636bbb938373e43c1f3ac561368fc9cffd43..6978d14c6bd90ffb640e39e8666430d9
|
|||||||
+ try {
|
+ try {
|
||||||
+ return fromJson(json);
|
+ return fromJson(json);
|
||||||
+ } catch (Exception ex) {
|
+ } catch (Exception ex) {
|
||||||
+ return new TextComponent("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
+ return Component.empty().append("** Invalid JSON Component **").withStyle(ChatFormatting.RED);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
@Nullable
|
public static JsonElement toJsonTree(Component text) {
|
||||||
public static MutableComponent fromJson(String json) {
|
return Component.Serializer.GSON.toJsonTree(text);
|
||||||
return (MutableComponent) GsonHelper.fromJson(Component.Serializer.GSON, json, MutableComponent.class, false);
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
index 9c1341803cf892f7f3af11381bd56bc95f31fad0..c4394812326bccd70d64b4bd45eb1bb7b53b0905 100644
|
index 7449a024265c42f28a6c9a1ed8d8f4b9e3096aac..487c68abc3eb5c18dc7fee762b2164001283cab7 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
||||||
@@ -80,7 +80,7 @@ public class HoverEvent {
|
@@ -79,7 +79,7 @@ public class HoverEvent {
|
||||||
if (jsonElement != null) {
|
if (jsonElement != null) {
|
||||||
return action.deserialize(jsonElement);
|
return action.deserialize(jsonElement);
|
||||||
} else {
|
} else {
|
||||||
@ -57,7 +75,7 @@ index 9c1341803cf892f7f3af11381bd56bc95f31fad0..c4394812326bccd70d64b4bd45eb1bb7
|
|||||||
return component != null ? action.deserializeFromLegacy(component) : null;
|
return component != null ? action.deserializeFromLegacy(component) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ public class HoverEvent {
|
@@ -94,7 +94,7 @@ public class HoverEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Action<T> {
|
public static class Action<T> {
|
||||||
@ -66,7 +84,7 @@ index 9c1341803cf892f7f3af11381bd56bc95f31fad0..c4394812326bccd70d64b4bd45eb1bb7
|
|||||||
public static final HoverEvent.Action<HoverEvent.ItemStackInfo> SHOW_ITEM = new HoverEvent.Action<>("show_item", true, HoverEvent.ItemStackInfo::create, HoverEvent.ItemStackInfo::serialize, HoverEvent.ItemStackInfo::create);
|
public static final HoverEvent.Action<HoverEvent.ItemStackInfo> SHOW_ITEM = new HoverEvent.Action<>("show_item", true, HoverEvent.ItemStackInfo::create, HoverEvent.ItemStackInfo::serialize, HoverEvent.ItemStackInfo::create);
|
||||||
public static final HoverEvent.Action<HoverEvent.EntityTooltipInfo> SHOW_ENTITY = new HoverEvent.Action<>("show_entity", true, HoverEvent.EntityTooltipInfo::create, HoverEvent.EntityTooltipInfo::serialize, HoverEvent.EntityTooltipInfo::create);
|
public static final HoverEvent.Action<HoverEvent.EntityTooltipInfo> SHOW_ENTITY = new HoverEvent.Action<>("show_entity", true, HoverEvent.EntityTooltipInfo::create, HoverEvent.EntityTooltipInfo::serialize, HoverEvent.EntityTooltipInfo::create);
|
||||||
private static final Map<String, HoverEvent.Action<?>> LOOKUP = Stream.of(SHOW_TEXT, SHOW_ITEM, SHOW_ENTITY).collect(ImmutableMap.toImmutableMap(HoverEvent.Action::getName, (action) -> {
|
private static final Map<String, HoverEvent.Action<?>> LOOKUP = Stream.of(SHOW_TEXT, SHOW_ITEM, SHOW_ENTITY).collect(ImmutableMap.toImmutableMap(HoverEvent.Action::getName, (action) -> {
|
||||||
@@ -183,7 +183,7 @@ public class HoverEvent {
|
@@ -182,7 +182,7 @@ public class HoverEvent {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Scissors end
|
// Scissors end
|
||||||
@ -75,50 +93,45 @@ index 9c1341803cf892f7f3af11381bd56bc95f31fad0..c4394812326bccd70d64b4bd45eb1bb7
|
|||||||
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ public class HoverEvent {
|
@@ -191,7 +191,7 @@ public class HoverEvent {
|
||||||
public static HoverEvent.EntityTooltipInfo create(Component text) {
|
public static HoverEvent.EntityTooltipInfo create(Component text) {
|
||||||
try {
|
try {
|
||||||
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
- 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
|
+ 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
|
// Scissors start
|
||||||
UUID uUID;
|
UUID uUID;
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
index ae9fef071388bc6b10d34a0126c9dd1ac77eb9e7..f5f2ec1192303bc55a64dce3e0457e4531a35ba7 100644
|
index 97a2657bc98d41c3c1e376b266d2c85f685acc88..9d20f3f1af8e663a8c13714c8928d4a91653daa4 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
@@ -77,13 +77,14 @@ public abstract class NbtComponent extends BaseComponent implements ContextAware
|
@@ -8,6 +8,7 @@ import java.util.Optional;
|
||||||
if (this.interpreting) {
|
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);
|
Component component = DataFixUtils.orElse(ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR);
|
||||||
return stream.flatMap((text) -> {
|
return stream.flatMap((text) -> {
|
||||||
+ // Scissors start - Use safer method for getting Components from JSON
|
|
||||||
try {
|
try {
|
||||||
- MutableComponent mutableComponent = Component.Serializer.fromJson(text);
|
- 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));
|
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
|
||||||
} catch (Exception var5) {
|
} catch (Exception var5) {
|
||||||
- LOGGER.warn("Failed to parse component: {}", text, var5);
|
- LOGGER.warn("Failed to parse component: {}", text, var5);
|
||||||
|
+ // Scissors - don't log
|
||||||
return Stream.of();
|
return Stream.of();
|
||||||
}
|
}
|
||||||
+ // Scissors end
|
|
||||||
}).reduce((accumulator, current) -> {
|
}).reduce((accumulator, current) -> {
|
||||||
return accumulator.append(component).append(current);
|
|
||||||
}).orElseGet(() -> {
|
|
||||||
@@ -94,7 +95,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
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index b7c4700fd5db14c77e7ee78311dd77a754d9d41c..07f04c1708b118ace3ed73ae2bf88c29b1c80ad2 100644
|
index fa35d2c1c8de225acd68e08f15976c92f7ab82aa..c3e587abaf61772f2a6872ece6ea65b18cf7cdee 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -2202,12 +2202,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -2491,12 +2491,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||||
this.setRot(this.getYRot(), this.getXRot());
|
this.setRot(this.getYRot(), this.getXRot());
|
||||||
if (nbt.contains("CustomName", 8)) {
|
if (nbt.contains("CustomName", 8)) {
|
||||||
String s = nbt.getString("CustomName");
|
String s = nbt.getString("CustomName");
|
||||||
@ -132,46 +145,20 @@ index b7c4700fd5db14c77e7ee78311dd77a754d9d41c..07f04c1708b118ace3ed73ae2bf88c29
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible"));
|
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 3281448bf37da8a1b4b7b44f10f4b2438b4a4f29..8038e3a10b563321df1e8cedd26b256078ce745a 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
|
|
||||||
@@ -405,7 +405,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 = Component.Serializer.fromJson(nbt.getString("CustomName"));
|
|
||||||
+ 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 40ac65501a0213b43964fd68eb155d4358fb7fd4..9cfc44472e841e1a2cd7de2a1284afdde05a7989 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
|
|
||||||
@@ -44,7 +44,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
|
||||||
public void load(CompoundTag nbt) {
|
|
||||||
super.load(nbt);
|
|
||||||
if (nbt.contains("CustomName", 8)) {
|
|
||||||
- this.name = Component.Serializer.fromJson(nbt.getString("CustomName"));
|
|
||||||
+ 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
|
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
index 2153e7035535990b5307b85d8bc3dab50c0a3ae8..5f11f9b77684bd91b4cfe77cd415ed42bd9bc21a 100644
|
index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1a2417616 100644
|
||||||
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
@@ -39,7 +39,7 @@ public class ScoreboardSaveData extends SavedData {
|
@@ -35,7 +35,7 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
}
|
CompoundTag compoundTag = nbt.getCompound(i);
|
||||||
|
String string = compoundTag.getString("Name");
|
||||||
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
if (component != null) {
|
if (component != null) {
|
||||||
playerTeam.setDisplayName(component);
|
playerTeam.setDisplayName(component);
|
||||||
}
|
}
|
||||||
@@ -57,14 +57,14 @@ public class ScoreboardSaveData extends SavedData {
|
@@ -53,14 +53,14 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
if (compoundTag.contains("MemberNamePrefix", 8)) {
|
||||||
@ -188,12 +175,12 @@ index 2153e7035535990b5307b85d8bc3dab50c0a3ae8..5f11f9b77684bd91b4cfe77cd415ed42
|
|||||||
if (component3 != null) {
|
if (component3 != null) {
|
||||||
playerTeam.setPlayerSuffix(component3);
|
playerTeam.setPlayerSuffix(component3);
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ public class ScoreboardSaveData extends SavedData {
|
@@ -115,7 +115,7 @@ public class ScoreboardSaveData extends SavedData {
|
||||||
string = string.substring(0, 16);
|
CompoundTag compoundTag = nbt.getCompound(i);
|
||||||
}
|
ObjectiveCriteria.byName(compoundTag.getString("CriteriaName")).ifPresent((criterion) -> {
|
||||||
|
String string = compoundTag.getString("Name");
|
||||||
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
|
||||||
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
|
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
|
||||||
this.scoreboard.addObjective(string, objectiveCriteria, component, renderType);
|
this.scoreboard.addObjective(string, criterion, component, renderType);
|
||||||
});
|
});
|
@ -1,82 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 20 Mar 2022 03:04:33 -0600
|
|
||||||
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 02172fdcf587904258387d309938fb379a300524..3c60094119a2b51d5fbab6c559c43293913f6204 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 5a43e420f14fa52d71d41ff3694a179e7a1a5be3..488ccdeb867dcd3aaae4bce77da8b7a11d07eddc 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
@@ -67,8 +67,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
|
||||||
this.getHandle().lootTable = this.getHandle().getDefaultLootTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().lootTable);
|
|
||||||
- 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().lootTable);
|
|
||||||
+ return Bukkit.getLootTable(key);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
173
patches/server/0014-Block-server-side-chunkbans.patch
Normal file
173
patches/server/0014-Block-server-side-chunkbans.patch
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
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..7de21c9bcc1f3c556790da62f96cc44995e877b2 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,59 @@ 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 ClientboundContainerSetContentPacket containerSetContentPacket) {
|
||||||
|
+ packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY);
|
||||||
|
+ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) {
|
||||||
|
+ packet = new ClientboundSetEquipmentPacket(setEquipmentPacket.getEntity(), Collections.emptyList());
|
||||||
|
+ } else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket) {
|
||||||
|
+ packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY);
|
||||||
|
+ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) {
|
||||||
|
+ packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(), mapItemDataPacket.getScale(), mapItemDataPacket.isLocked(), null, null);
|
||||||
|
+ } else if (packet instanceof ClientboundPlayerChatPacket playerChatPacket) {
|
||||||
|
+ final SignedMessageBody.Packed body = playerChatPacket.body();
|
||||||
|
+ packet = new ClientboundPlayerChatPacket(playerChatPacket.sender(), // Not sending this packet results in a kick when someone says something.
|
||||||
|
+ playerChatPacket.index(),
|
||||||
|
+ playerChatPacket.signature(),
|
||||||
|
+ playerChatPacket.body(),
|
||||||
|
+ Component.empty().append("** Message too large **").withStyle(ChatFormatting.RED),
|
||||||
|
+ playerChatPacket.filterMask(),
|
||||||
|
+ playerChatPacket.chatType()
|
||||||
|
+ );
|
||||||
|
+ } else {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return packet;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
// Paper start
|
||||||
|
private static int MAX_PACKET_SIZE = 8388608;
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
index 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f309df6a79e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
@@ -24,7 +24,7 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
|
||||||
|
return create(blockEntity, BlockEntity::getUpdateTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) {
|
||||||
|
+ public ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) { // Scissors - private -> public
|
||||||
|
this.pos = pos;
|
||||||
|
this.type = blockEntityType;
|
||||||
|
this.tag = nbt.isEmpty() ? null : nbt;
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
|
index 39b879f21f958dbd91ab0f74e5d4f3c74928fc33..688287c637a0d4b28d630b7304a3c2cf339bdf54 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,28 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 20 Mar 2022 04:39:09 -0600
|
|
||||||
Subject: [PATCH] Fixes crash exploit related to out of bounds Axolotl variants
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
|
||||||
index 2b8725087fd3bfeca7162bda2783fdacd13a8390..802c9c87df190dce09f9e703cedcb06874c58389 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
|
||||||
@@ -118,7 +118,7 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable {
|
|
||||||
@Override
|
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
|
||||||
super.readAdditionalSaveData(nbt);
|
|
||||||
- this.setVariant(Axolotl.Variant.BY_ID[nbt.getInt("Variant")]);
|
|
||||||
+ this.setVariant(Axolotl.Variant.BY_ID[Math.min(Math.abs(nbt.getInt("Variant")), 4)]); // Scissors - Fixes out of bounds Axolotl variant exploit
|
|
||||||
this.setFromBucket(nbt.getBoolean("FromBucket"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ public class Axolotl extends Animal implements LerpingModel, Bucketable {
|
|
||||||
@Override
|
|
||||||
public void loadFromBucketTag(CompoundTag nbt) {
|
|
||||||
Bucketable.loadDefaultDataFromBucketTag(this, nbt);
|
|
||||||
- this.setVariant(Axolotl.Variant.BY_ID[nbt.getInt("Variant")]);
|
|
||||||
+ this.setVariant(Axolotl.Variant.BY_ID[Math.min(Math.abs(nbt.getInt("Variant")), 4)]); // Scissors - Fix out-of-bounds Axolotl variant exploit
|
|
||||||
if (nbt.contains("Age")) {
|
|
||||||
this.setAge(nbt.getInt("Age"));
|
|
||||||
}
|
|
@ -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
|
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
|
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
@@ -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 {
|
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
||||||
+ // Scissors start - Reject oversized components
|
+ MutableComponent result; // Scissors
|
||||||
+ MutableComponent result;
|
|
||||||
+
|
|
||||||
if (depth > 100) {
|
if (depth > 100) {
|
||||||
- return text.copy();
|
- return text.copy();
|
||||||
+ result = text.copy();
|
+ result = text.copy(); // Scissors
|
||||||
} else {
|
} else {
|
||||||
MutableComponent mutableComponent = text instanceof ContextAwareComponent ? ((ContextAwareComponent)text).resolve(source, sender, depth + 1) : text.plainCopy();
|
// Paper start
|
||||||
|
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
||||||
@@ -46,8 +49,12 @@ public class ComponentUtils {
|
@@ -53,8 +54,9 @@ public class ComponentUtils {
|
||||||
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||||
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth)); // Scissors
|
||||||
}
|
}
|
||||||
+
|
+ return Component.Serializer.toJson(result).length() > 65535 ? Component.empty() : result; // Scissors
|
||||||
+ // Would the resulting component exceed 65535 bytes when encoded as a string?
|
|
||||||
+ return Component.Serializer.toJson(result).length() > 65535 ? new TextComponent("") : result;
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
@ -1,44 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sun, 20 Mar 2022 07:46:37 -0600
|
|
||||||
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 621ec8e8a197323da6b423fee57c816ac9d7c875..83333ae9c8e8c1edc6e7f02468bd8dc7e44bb66e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -2933,20 +2933,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
||||||
if (this.player.gameMode.isCreative()) {
|
|
||||||
boolean flag = packet.getSlotNum() < 0;
|
|
||||||
ItemStack itemstack = packet.getItem();
|
|
||||||
- CompoundTag nbttagcompound = itemstack.getTagElement("BlockEntityTag");
|
|
||||||
|
|
||||||
+ CompoundTag nbttagcompound = itemstack.getTagElement("BlockEntityTag");
|
|
||||||
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
|
|
||||||
BlockPos blockposition = new BlockPos(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z"));
|
|
||||||
- BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
|
||||||
+ // 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 = this.player.level.getBlockEntity(blockposition);
|
|
||||||
|
|
||||||
- if (tileentity != null) {
|
|
||||||
- CompoundTag nbttagcompound1 = tileentity.save(new CompoundTag());
|
|
||||||
+ if (tileentity != null) {
|
|
||||||
+ CompoundTag nbttagcompound1 = tileentity.save(new CompoundTag());
|
|
||||||
|
|
||||||
- nbttagcompound1.remove("x");
|
|
||||||
- nbttagcompound1.remove("y");
|
|
||||||
- nbttagcompound1.remove("z");
|
|
||||||
- itemstack.addTagElement("BlockEntityTag", (Tag) nbttagcompound1);
|
|
||||||
+ nbttagcompound1.remove("x");
|
|
||||||
+ nbttagcompound1.remove("y");
|
|
||||||
+ nbttagcompound1.remove("z");
|
|
||||||
+ itemstack.addTagElement("BlockEntityTag", (Tag) nbttagcompound1);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
|
|
@ -0,0 +1,508 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
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 a2f71a6d1a9e98133dff6cd0f625da9435a8af14..f83b2c4298bd1a5f65487f64bd6a11fb190a622d 100644
|
||||||
|
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
|
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
|
@@ -25,6 +25,7 @@ package co.aikar.timings;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import io.papermc.paper.adventure.PaperAdventure;
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
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)),
|
||||||
|
- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null))
|
||||||
|
+ pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)),
|
||||||
|
+ pair("scissors", mapAsJSON(ScissorsConfig.config, null)) // Scissors
|
||||||
|
));
|
||||||
|
|
||||||
|
new TimingsExport(listeners, parent, history).start();
|
||||||
|
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..797677d892d83cf54d9a60af1e277b67ed3d6e95
|
||||||
|
--- /dev/null
|
||||||
|
+++ 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 net.minecraft.resources.ResourceLocation;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.ChatColor;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+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
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final String BASE_PERM = "bukkit.command.scissors.";
|
||||||
|
+ private static final ImmutableSet<String> SUBCOMMANDS = ImmutableSet.<String>builder().add("reload", "version").build();
|
||||||
|
+
|
||||||
|
+ public ScissorsCommand(String name)
|
||||||
|
+ {
|
||||||
|
+ 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())));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static boolean testPermission(CommandSender commandSender, String permission)
|
||||||
|
+ {
|
||||||
|
+ if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.scissors"))
|
||||||
|
+ return true;
|
||||||
|
+ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Code from Mojang - copyright them
|
||||||
|
+ public static List<String> getListMatchingLast(CommandSender sender, String[] args, String... matches)
|
||||||
|
+ {
|
||||||
|
+ return getListMatchingLast(sender, args, Arrays.asList(matches));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static boolean matches(String s, String s1)
|
||||||
|
+ {
|
||||||
|
+ return s1.regionMatches(true, 0, s, 0, s.length());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static List<String> getListMatchingLast(CommandSender sender, String[] strings, Collection<?> collection)
|
||||||
|
+ {
|
||||||
|
+ String last = strings[strings.length - 1];
|
||||||
|
+ ArrayList<String> results = Lists.newArrayList();
|
||||||
|
+
|
||||||
|
+ if (!collection.isEmpty())
|
||||||
|
+ {
|
||||||
|
+ Iterator iterator = Iterables.transform(collection, Functions.toStringFunction()).iterator();
|
||||||
|
+
|
||||||
|
+ while (iterator.hasNext())
|
||||||
|
+ {
|
||||||
|
+ String s1 = (String) iterator.next();
|
||||||
|
+
|
||||||
|
+ if (matches(last, s1) && (sender.hasPermission(BASE_PERM + s1) || sender.hasPermission("bukkit.command.scissors")))
|
||||||
|
+ {
|
||||||
|
+ results.add(s1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (results.isEmpty())
|
||||||
|
+ {
|
||||||
|
+ iterator = collection.iterator();
|
||||||
|
+
|
||||||
|
+ while (iterator.hasNext())
|
||||||
|
+ {
|
||||||
|
+ Object object = iterator.next();
|
||||||
|
+
|
||||||
|
+ if (object instanceof ResourceLocation && matches(last, ((ResourceLocation) object).getPath()))
|
||||||
|
+ {
|
||||||
|
+ results.add(String.valueOf(object));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return results;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException
|
||||||
|
+ {
|
||||||
|
+ if (args.length <= 1)
|
||||||
|
+ return getListMatchingLast(sender, args, SUBCOMMANDS);
|
||||||
|
+
|
||||||
|
+ return Collections.emptyList();
|
||||||
|
+ }
|
||||||
|
+ // end copy stuff
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||||
|
+ {
|
||||||
|
+ if (!testPermission(sender)) return true;
|
||||||
|
+
|
||||||
|
+ if (args.length == 0)
|
||||||
|
+ {
|
||||||
|
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ if (SUBCOMMANDS.contains(args[0].toLowerCase(Locale.ENGLISH)))
|
||||||
|
+ {
|
||||||
|
+ if (!testPermission(sender, args[0].toLowerCase(Locale.ENGLISH))) return true;
|
||||||
|
+ }
|
||||||
|
+ switch (args[0].toLowerCase(Locale.ENGLISH))
|
||||||
|
+ {
|
||||||
|
+ case "reload":
|
||||||
|
+ doReload(sender);
|
||||||
|
+ break;
|
||||||
|
+ case "ver":
|
||||||
|
+ if (!testPermission(sender, "version"))
|
||||||
|
+ break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set)
|
||||||
|
+ case "version":
|
||||||
|
+ Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
|
||||||
|
+ if (ver != null)
|
||||||
|
+ {
|
||||||
|
+ ver.execute(sender, commandLabel, new String[0]);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ // else - fall through to default
|
||||||
|
+ default:
|
||||||
|
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void doReload(CommandSender sender)
|
||||||
|
+ {
|
||||||
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
||||||
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||||
|
+
|
||||||
|
+ MinecraftServer console = MinecraftServer.getServer();
|
||||||
|
+ ScissorsConfig.init((File) console.options.valueOf("scissors-settings"));
|
||||||
|
+ console.server.reloadCount++;
|
||||||
|
+
|
||||||
|
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Scissors config reload complete.");
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
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..8cd2848aa6b06c5efbe797ed2d75ff4b025b3c52
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
@@ -0,0 +1,225 @@
|
||||||
|
+package me.totalfreedom.scissors;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+import com.google.common.base.Throwables;
|
||||||
|
+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
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final String HEADER = """
|
||||||
|
+ This is the main configuration file for Scissors.
|
||||||
|
+ As you can see, there's tons to configure. Some options may impact gameplay, so use
|
||||||
|
+ with caution, and make sure you know what each option does before configuring.
|
||||||
|
+
|
||||||
|
+ If you need help with the configuration or have any questions related to Scissors,
|
||||||
|
+ join us in our Discord.
|
||||||
|
+
|
||||||
|
+ Discord: https://discord.com/invite/mtVQcHn58h
|
||||||
|
+ Website: https://scissors.gg/\s
|
||||||
|
+ Docs: https://javadoc.scissors.gg/1.20.1/\s
|
||||||
|
+ """;
|
||||||
|
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||||
|
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||||
|
+ /*========================================================================*/
|
||||||
|
+ public static YamlConfiguration config;
|
||||||
|
+ static int version;
|
||||||
|
+ /*========================================================================*/
|
||||||
|
+ static Map<String, Command> commands;
|
||||||
|
+ private static File CONFIG_FILE;
|
||||||
|
+
|
||||||
|
+ public static void init(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
|
||||||
|
+ {
|
||||||
|
+ config.load(CONFIG_FILE);
|
||||||
|
+ }
|
||||||
|
+ catch (IOException ex)
|
||||||
|
+ {
|
||||||
|
+ }
|
||||||
|
+ catch (InvalidConfigurationException ex)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load scissors.yml, please correct your syntax errors", ex);
|
||||||
|
+ throw Throwables.propagate(ex);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ commands = new HashMap<>();
|
||||||
|
+ commands.put("scissors", new ScissorsCommand("scissors"));
|
||||||
|
+
|
||||||
|
+ config.options().header(HEADER);
|
||||||
|
+ config.options().copyDefaults(true);
|
||||||
|
+
|
||||||
|
+ version = getInt("config-version", 5);
|
||||||
|
+ set("config-version", 5);
|
||||||
|
+ readConfig(ScissorsConfig.class, null);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected static void logError(String s)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().severe(s);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected static void fatal(String s)
|
||||||
|
+ {
|
||||||
|
+ throw new RuntimeException("Fatal scissors.yml config error: " + s);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void registerCommands()
|
||||||
|
+ {
|
||||||
|
+ for (Map.Entry<String, Command> entry : commands.entrySet())
|
||||||
|
+ {
|
||||||
|
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Scissors", entry.getValue());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static void readConfig(Class<?> clazz, Object instance)
|
||||||
|
+ {
|
||||||
|
+ for (Method method : clazz.getDeclaredMethods())
|
||||||
|
+ {
|
||||||
|
+ if (Modifier.isPrivate(method.getModifiers()))
|
||||||
|
+ {
|
||||||
|
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE)
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ method.setAccessible(true);
|
||||||
|
+ method.invoke(instance);
|
||||||
|
+ }
|
||||||
|
+ catch (InvocationTargetException ex)
|
||||||
|
+ {
|
||||||
|
+ throw Throwables.propagate(ex.getCause());
|
||||||
|
+ }
|
||||||
|
+ catch (Exception ex)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ saveConfig();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static void saveConfig()
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ config.save(CONFIG_FILE);
|
||||||
|
+ }
|
||||||
|
+ catch (IOException ex)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static boolean runCommandsInBooks = false;
|
||||||
|
+
|
||||||
|
+ 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);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static boolean getBoolean(String path, boolean def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getBoolean(path, config.getBoolean(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static double getDouble(String path, double def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getDouble(path, config.getDouble(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static float getFloat(String path, float def)
|
||||||
|
+ {
|
||||||
|
+ // TODO: Figure out why getFloat() always returns the default value.
|
||||||
|
+ return (float) getDouble(path, def);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static int getInt(String path, int def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getInt(path, config.getInt(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static <T> List getList(String path, T def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getList(path, config.getList(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static String getString(String path, String def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ 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 dae36c6452ccd57a436dd918547b64d59957ab0a..d450cf3cf8ab5cbb5d32a28ee2e4a6717941adef 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
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 c5dfd99a38a79fd19a2bf85fa297a28e40612b51..a2aee0bbd0ffcd3d86d33a4cea7b0d683736726b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
@@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ try {
|
||||||
|
+ 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;
|
||||||
|
+ }
|
||||||
|
+ me.totalfreedom.scissors.ScissorsConfig.registerCommands();
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||||
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||||
|
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 f9a2190b74121e510c8a234905ee5eb24e5ea7f7..d6eef122c2ee170d5c305524166e18b7315fe9f3 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -1097,6 +1097,7 @@ public final class CraftServer implements Server {
|
||||||
|
}
|
||||||
|
|
||||||
|
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||||
|
+ me.totalfreedom.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors
|
||||||
|
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||||
|
for (ServerLevel world : this.console.getAllLevels()) {
|
||||||
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
|
@@ -1128,6 +1129,7 @@ public final class CraftServer implements Server {
|
||||||
|
this.reloadData();
|
||||||
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||||
|
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");
|
||||||
|
|
||||||
|
@@ -2975,6 +2977,14 @@ public final class CraftServer implements Server {
|
||||||
|
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ @Override
|
||||||
|
+ public YamlConfiguration getScissorsConfig()
|
||||||
|
+ {
|
||||||
|
+ 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 344bef62aa1551a6a09c10492cbc26acb63fa105..0e3127f3fffb832571aef3b14085e66289ad76b1 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -180,6 +180,20 @@ public class Main {
|
||||||
|
.defaultsTo("Unknown Server")
|
||||||
|
.describedAs("Name");
|
||||||
|
// Paper end
|
||||||
|
+
|
||||||
|
+ // Scissors start
|
||||||
|
+ 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,23 +6,23 @@ 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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
index 2e3220cbbea5f6cb9acb7f8fbaf2ff8f91b09234..8018709dfce483a9000ada93cf47812fd49458a8 100644
|
index f9741039dada19391e80d9623f2d8cabc1089506..38238d9e6d464990caf10557997c6ca88ee100c0 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
@@ -45,6 +45,7 @@ import net.minecraft.nbt.NbtIo;
|
@@ -46,6 +46,7 @@ import net.minecraft.nbt.NbtIo;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
import net.minecraft.nbt.Tag;
|
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.resources.ResourceLocation; // Scissors
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang3.EnumUtils;
|
||||||
@@ -481,7 +482,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -486,7 +487,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
||||||
|
|
||||||
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
||||||
- if (attributeName == null || attributeName.isEmpty()) {
|
- if (attributeName == null || attributeName.isEmpty()) {
|
||||||
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() < 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Sat, 9 Apr 2022 13:00:27 -0600
|
||||||
|
Subject: [PATCH] Don't query player data in the `nbt` component
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
|
index 8a6799b50062c1b7b141ee1568dc523f9ee7ecfd..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;
|
||||||
|
|
||||||
|
+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();
|
||||||
|
}
|
@ -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,162 +0,0 @@
|
|||||||
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 b039a32b805fc02033fa862a1c40c4a51639e69a..1d407ebea9ff2932f93b7d6842b0e2a4e801b48c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
@@ -4,9 +4,17 @@ import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
|
||||||
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
|
||||||
+
|
|
||||||
import java.io.IOException;
|
|
||||||
+
|
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.protocol.Packet;
|
|
||||||
import net.minecraft.network.protocol.PacketFlow;
|
|
||||||
+import net.minecraft.network.protocol.game.*;
|
|
||||||
+import net.minecraft.network.syncher.SynchedEntityData;
|
|
||||||
+import net.minecraft.server.MinecraftServer;
|
|
||||||
+import net.minecraft.world.item.ItemStack;
|
|
||||||
+import net.minecraft.world.level.chunk.LevelChunk;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.apache.logging.log4j.Marker;
|
|
||||||
@@ -44,27 +52,93 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
|
||||||
packet.write(friendlyByteBuf);
|
|
||||||
int j = friendlyByteBuf.writerIndex() - i;
|
|
||||||
if (j > 8388608) {
|
|
||||||
- throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
|
|
||||||
+ // Scissors start
|
|
||||||
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
|
||||||
+ //throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
} catch (Throwable var9) {
|
|
||||||
+ // Scissors start
|
|
||||||
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
|
||||||
+ /*
|
|
||||||
LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var9); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE?
|
|
||||||
if (packet.isSkippable()) {
|
|
||||||
throw new SkipPacketException(var9);
|
|
||||||
} else {
|
|
||||||
throw var9;
|
|
||||||
}
|
|
||||||
+ */
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paper start
|
|
||||||
int packetLength = friendlyByteBuf.readableBytes();
|
|
||||||
if (packetLength > MAX_PACKET_SIZE) {
|
|
||||||
- throw new PacketTooLargeException(packet, packetLength);
|
|
||||||
+ // Scissors start
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
|
||||||
+ packetLength = friendlyByteBuf.readableBytes();
|
|
||||||
+ if (packetLength > MAX_PACKET_SIZE) {
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ //throw new PacketTooLargeException(packet, packetLength);
|
|
||||||
+ }
|
|
||||||
+ //throw new PacketTooLargeException(packet, packetLength);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ private static void noKicking(FriendlyByteBuf friendlyByteBuf, Packet packet, Integer integer, ChannelHandlerContext channelHandlerContext) {
|
|
||||||
+ // no kicking!!
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ friendlyByteBuf.writeVarInt(integer);
|
|
||||||
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
|
|
||||||
+ boolean didIt = true;
|
|
||||||
+ if (packet instanceof ClientboundBlockEntityDataPacket blockEntityDataPacket) {
|
|
||||||
+ packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag());
|
|
||||||
+ } else if (packet instanceof ClientboundLevelChunkPacket chunkPacket) {
|
|
||||||
+ chunkPacket.clearNbt();
|
|
||||||
+ } else if (packet instanceof ClientboundSetEntityDataPacket entityDataPacket) {
|
|
||||||
+ friendlyByteBuf.writeVarInt(entityDataPacket.getId());
|
|
||||||
+ friendlyByteBuf.writeByte(255);
|
|
||||||
+ didIt = false;//prevent default packet writing
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) {
|
|
||||||
+ containerSetContentPacket.clearNbt();
|
|
||||||
+ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) {
|
|
||||||
+ friendlyByteBuf.writeVarInt(setEquipmentPacket.getEntity());
|
|
||||||
+ didIt = false;//prevent default
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket) {
|
|
||||||
+ //i really would rather cancel this packet entirely buuut idk how sOOOOoooo
|
|
||||||
+ friendlyByteBuf.writeByte(containerSetSlotPacket.getContainerId());
|
|
||||||
+ friendlyByteBuf.writeVarInt(containerSetSlotPacket.getStateId());
|
|
||||||
+ friendlyByteBuf.writeShort(containerSetSlotPacket.getSlot());
|
|
||||||
+ friendlyByteBuf.writeItem(ItemStack.EMPTY);
|
|
||||||
+ didIt = false;//prevent default
|
|
||||||
+ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) {
|
|
||||||
+ packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(),mapItemDataPacket.getScale(),mapItemDataPacket.isLocked(),null,null);
|
|
||||||
+ } else {
|
|
||||||
+ didIt = false;
|
|
||||||
+ LOGGER.info(packet.getClass().getName() + " overflowed/errored and was not caught!!");
|
|
||||||
+ }
|
|
||||||
+ if (didIt) {
|
|
||||||
+ try {
|
|
||||||
+ int i = friendlyByteBuf.writerIndex();
|
|
||||||
+ packet.write(friendlyByteBuf);
|
|
||||||
+ int j = friendlyByteBuf.writerIndex() - i;
|
|
||||||
+ if (j > 8388608) {
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ //throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
|
|
||||||
+ }
|
|
||||||
+ } catch (Throwable var69) {
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start
|
|
||||||
private static int MAX_PACKET_SIZE = 2097152;
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
||||||
index dbd8b9b09b82c1b75e8be9dc7416d9f0863c8c87..f71f68d1482f7e0481a95533e42e8ee5089f15ff 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
||||||
@@ -10,7 +10,14 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
|
|
||||||
private final int containerId;
|
|
||||||
private final int stateId;
|
|
||||||
private final List<ItemStack> items;
|
|
||||||
- private final ItemStack carriedItem;
|
|
||||||
+ private ItemStack carriedItem; // Scissors - removed "final"
|
|
||||||
+
|
|
||||||
+ // Scissors start
|
|
||||||
+ public void clearNbt(){
|
|
||||||
+ this.items.clear();
|
|
||||||
+ this.carriedItem = ItemStack.EMPTY;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
|
|
||||||
public ClientboundContainerSetContentPacket(int syncId, int revision, NonNullList<ItemStack> contents, ItemStack cursorStack) {
|
|
||||||
this.containerId = syncId;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
|
||||||
index 60d72e488bc77cd913328be400ca374a873b4561..89c385c5ec88c8b51f9e118b65f3b9c2a58c7d9b 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
|
||||||
@@ -50,6 +50,13 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ public void clearNbt() {
|
|
||||||
+ this.blockEntitiesTags.clear();
|
|
||||||
+ this.extraPackets.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start - Anti-Xray - Add chunk packet info
|
|
||||||
@Deprecated public ClientboundLevelChunkPacket(LevelChunk chunk) { this(chunk, true); } // Notice for updates: Please make sure this constructor isn't used anywhere
|
|
||||||
public ClientboundLevelChunkPacket(LevelChunk chunk, boolean modifyBlocks) {
|
|
@ -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
|
diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||||
index 79e036d79dec2ec4404baf02c23ba5ccad20cdce..506be74453c6ecc52f05a48b1d95f82175fa6159 100644
|
index 53cc6befb752affcfec65e18365f6d369448d407..181f5aa262689617ff3ad766dae485c36b88c9aa 100644
|
||||||
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
--- a/src/main/java/net/minecraft/world/effect/MobEffect.java
|
||||||
+++ b/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 {
|
@@ -57,6 +57,7 @@ public class MobEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
||||||
@ -17,7 +17,7 @@ index 79e036d79dec2ec4404baf02c23ba5ccad20cdce..506be74453c6ecc52f05a48b1d95f821
|
|||||||
if (this == MobEffects.REGENERATION) {
|
if (this == MobEffects.REGENERATION) {
|
||||||
if (entity.getHealth() < entity.getMaxHealth()) {
|
if (entity.getHealth() < entity.getMaxHealth()) {
|
||||||
entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
|
entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
|
||||||
@@ -75,17 +76,31 @@ public class MobEffect {
|
@@ -83,17 +84,31 @@ public class MobEffect {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
} else if ((this != MobEffects.HEAL || entity.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entity.isInvertedHealAndHarm())) {
|
} else if ((this != MobEffects.HEAL || entity.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entity.isInvertedHealAndHarm())) {
|
||||||
@ -25,9 +25,9 @@ index 79e036d79dec2ec4404baf02c23ba5ccad20cdce..506be74453c6ecc52f05a48b1d95f821
|
|||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
+ amplifier = Math.min(Math.abs(amplifier), 124);
|
||||||
+ if (!god && (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm())) {
|
+ if (!god && (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm())) {
|
||||||
entity.hurt(DamageSource.MAGIC, (float) (6 << amplifier));
|
|
||||||
}
|
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
|
entity.hurt(entity.damageSources().magic(), (float) (6 << amplifier));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
- entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
- entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit
|
||||||
+ // Scissors start
|
+ // Scissors start
|
19
patches/server/0021-Fix-negative-death-times.patch
Normal file
19
patches/server/0021-Fix-negative-death-times.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
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 f636bdf1075fa784ce7ee25478d4d94bacb05677..77275e948b3636d21cca8f59c35834e8fdb339c7 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
@@ -637,7 +637,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
public boolean broadcastedDeath = false; // Folia - region threading
|
||||||
|
protected void tickDeath() {
|
||||||
|
++this.deathTime;
|
||||||
|
- if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved() && !this.broadcastedDeath) { // Folia - region threading
|
||||||
|
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved() && !this.broadcastedDeath) { // Scissors // Folia - region threading
|
||||||
|
this.level().broadcastEntityEvent(this, (byte) 60);
|
||||||
|
this.broadcastedDeath = true; // Folia - region threading - death has been broadcasted
|
||||||
|
if (!(this instanceof ServerPlayer)) this.remove(Entity.RemovalReason.KILLED); // Folia - region threading - don't remove, we want the tick scheduler to be running
|
@ -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 24f009fa3b84323b4c43e0ed15c224d16a7ede81..1d1876c78f82ce36d45320e4575c79fdc284ce0e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
||||||
@@ -78,7 +78,12 @@ public final class NbtUtils {
|
|
||||||
|
|
||||||
// Paper start - support string UUID's
|
|
||||||
if (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
|
|
||||||
if (compound.hasUUID("Id")) {
|
|
@ -0,0 +1,103 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
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 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce032ece6b 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; // Scissors
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.BlockUtil;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
@@ -107,6 +108,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
|
private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
|
private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
|
private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
|
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
||||||
|
public double maxSpeed = 0.4D;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@@ -434,8 +436,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 start
|
||||||
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
|
+ 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()) {
|
||||||
|
@@ -462,6 +466,14 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
|
entity.push(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // 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 35aeba4e8430e6419caa9db4a0b931a994228618..289eb39b15a283b0d9dbc33823f3a73f87202907 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
|
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
+import java.util.concurrent.TimeUnit; // Scissors
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.BlockUtil;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -109,6 +110,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
|
public double unoccupiedDeceleration = -1;
|
||||||
|
public boolean landBoats = false;
|
||||||
|
// CraftBukkit end
|
||||||
|
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
||||||
|
|
||||||
|
public Boat(EntityType<? extends Boat> type, Level world) {
|
||||||
|
super(type, world);
|
||||||
|
@@ -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()) {
|
||||||
|
+ 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) {
|
||||||
|
+ 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)) {
|
||||||
|
@@ -435,6 +437,14 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add collision debounce
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ } else if (list.size() > 3) {
|
||||||
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
181
patches/server/0023-Add-custom-classes-used-by-Scissors.patch
Normal file
181
patches/server/0023-Add-custom-classes-used-by-Scissors.patch
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
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..b3efac47ee700d5a7ff26452d6bcbf2f687a32cf
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||||
|
@@ -0,0 +1,75 @@
|
||||||
|
+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 += key.getBytes(StandardCharsets.UTF_8).length;
|
||||||
|
+ 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..c5dcc833d6f2c0daa1d0c2a7ab81430f25e0b2f3
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
|
@@ -0,0 +1,53 @@
|
||||||
|
+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,95 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Business Goose <arclicious@vivaldi.net>
|
|
||||||
Date: Mon, 4 Apr 2022 00:16:54 +0100
|
|
||||||
Subject: [PATCH] Prevent abusable entities from being spawned by spawners
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
||||||
index 569cef8fcb1e3e1e8b66dad4fa9b956b44542bf1..f844e0b1e44f0b45b1febadf02d7b37d3099fbdb 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
||||||
@@ -19,7 +19,9 @@ import net.minecraft.util.StringUtil;
|
|
||||||
import net.minecraft.util.random.WeightedRandomList;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
+import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.Mob;
|
|
||||||
+import net.minecraft.world.entity.MobCategory;
|
|
||||||
import net.minecraft.world.entity.MobSpawnType;
|
|
||||||
import net.minecraft.world.entity.SpawnGroupData;
|
|
||||||
import net.minecraft.world.entity.SpawnPlacements;
|
|
||||||
@@ -31,6 +33,7 @@ public abstract class BaseSpawner {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
|
||||||
private static final int EVENT_SPAWN = 1;
|
|
||||||
+ public static List<MobCategory> whitelistedCategories = List.of(MobCategory.CREATURE, MobCategory.MONSTER, MobCategory.WATER_CREATURE, MobCategory.UNDERGROUND_WATER_CREATURE, MobCategory.AMBIENT); // Scissors
|
|
||||||
public static WeightedRandomList<SpawnData> EMPTY_POTENTIALS = WeightedRandomList.create(); // Paper - private->public
|
|
||||||
public int spawnDelay = 20;
|
|
||||||
public WeightedRandomList<SpawnData> spawnPotentials;
|
|
||||||
@@ -64,6 +67,13 @@ public abstract class BaseSpawner {
|
|
||||||
public ResourceLocation getEntityId(@Nullable Level world, BlockPos pos) {
|
|
||||||
String s = this.nextSpawnData.getTag().getString("id");
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ Optional<EntityType<?>> entityType = EntityType.byString(s);
|
|
||||||
+ if (entityType.isPresent() && !whitelistedCategories.contains(entityType.get().getCategory())) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
try {
|
|
||||||
return StringUtil.isNullOrEmpty(s) ? null : new ResourceLocation(s);
|
|
||||||
} catch (ResourceLocationException resourcekeyinvalidexception) {
|
|
||||||
@@ -73,6 +83,12 @@ public abstract class BaseSpawner {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEntityId(EntityType<?> type) {
|
|
||||||
+ // Scissors start - Don't allow unnatural entities to be added to spawners
|
|
||||||
+ if (!whitelistedCategories.contains(type.getCategory())) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
this.nextSpawnData.getTag().putString("id", Registry.ENTITY_TYPE.getKey(type).toString());
|
|
||||||
this.spawnPotentials = BaseSpawner.EMPTY_POTENTIALS; // CraftBukkit - SPIGOT-3496, MC-92282
|
|
||||||
}
|
|
||||||
@@ -121,7 +137,7 @@ public abstract class BaseSpawner {
|
|
||||||
CompoundTag nbttagcompound = this.nextSpawnData.getTag();
|
|
||||||
Optional<EntityType<?>> optional = EntityType.by(nbttagcompound);
|
|
||||||
|
|
||||||
- if (!optional.isPresent()) {
|
|
||||||
+ if (!(optional.isPresent() && whitelistedCategories.contains(optional.get().getCategory()))) { // Scissors - Don't try spawning in entites that aren't whitelisted
|
|
||||||
this.delay(world, pos);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
@@ -254,12 +270,16 @@ public abstract class BaseSpawner {
|
|
||||||
ListTag nbttaglist = nbt.getList("SpawnPotentials", 10);
|
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
|
||||||
- list.add(new SpawnData(nbttaglist.getCompound(i)));
|
|
||||||
+ // Scissors start - Filter unnatural entity types from being added
|
|
||||||
+ if (isValid(nbttaglist.getCompound(i))) {
|
|
||||||
+ list.add(new SpawnData(nbttaglist.getCompound(i)));
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.spawnPotentials = WeightedRandomList.create((List) list);
|
|
||||||
- if (nbt.contains("SpawnData", 10)) {
|
|
||||||
+ if (nbt.contains("SpawnData", 10) && isValid(nbt.getCompound("SpawnData"))) { // Scissors - Filter unnatural entity types from being added
|
|
||||||
this.setNextSpawnData(world, pos, new SpawnData(1, nbt.getCompound("SpawnData")));
|
|
||||||
} else if (!list.isEmpty()) {
|
|
||||||
this.spawnPotentials.getRandom(this.random).ifPresent((mobspawnerdata) -> {
|
|
||||||
@@ -371,4 +391,11 @@ public abstract class BaseSpawner {
|
|
||||||
public double getoSpin() {
|
|
||||||
return this.oSpin;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ // Scissors start
|
|
||||||
+ public boolean isValid(CompoundTag tag) {
|
|
||||||
+ Optional<EntityType<?>> type = EntityType.by(tag);
|
|
||||||
+ return type.isPresent() && whitelistedCategories.contains(type.get().getCategory());
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Video <videogamesm12@gmail.com>
|
|
||||||
Date: Sat, 9 Apr 2022 13:00:27 -0600
|
|
||||||
Subject: [PATCH] Don't query player data in the `nbt` component
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/NbtComponent.java b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
|
||||||
index f5f2ec1192303bc55a64dce3e0457e4531a35ba7..62613d9fccd74fe16512fe1fe703dc6db0166b28 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/NbtComponent.java
|
|
||||||
@@ -22,6 +22,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.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
@@ -218,7 +219,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();
|
|
||||||
}
|
|
313
patches/server/0024-Reset-large-tags.patch
Normal file
313
patches/server/0024-Reset-large-tags.patch
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
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..04c47cf1a920ae6c356449df801227ee14f6dfb7 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
@@ -2,6 +2,7 @@ package net.minecraft.world;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
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();
|
||||||
|
+ long total = 0; // Scissors
|
||||||
|
|
||||||
|
for(int i = 0; i < stacks.size(); ++i) {
|
||||||
|
ItemStack itemStack = stacks.get(i);
|
||||||
|
if (!itemStack.isEmpty()) {
|
||||||
|
+ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors
|
||||||
|
CompoundTag compoundTag = new CompoundTag();
|
||||||
|
compoundTag.putByte("Slot", (byte)i);
|
||||||
|
itemStack.save(compoundTag);
|
||||||
|
@@ -33,7 +36,7 @@ public class ContainerHelper {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!listTag.isEmpty() || setIfEmpty) {
|
||||||
|
+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) { // Scissors
|
||||||
|
nbt.put("Items", listTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -42,11 +45,19 @@ public class ContainerHelper {
|
||||||
|
|
||||||
|
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
||||||
|
ListTag listTag = nbt.getList("Items", 10);
|
||||||
|
+ long total = 0; // Scissors - Account for items inside containers
|
||||||
|
|
||||||
|
for(int i = 0; i < listTag.size(); ++i) {
|
||||||
|
CompoundTag compoundTag = listTag.getCompound(i);
|
||||||
|
int j = compoundTag.getByte("Slot") & 255;
|
||||||
|
if (j >= 0 && j < stacks.size()) {
|
||||||
|
+ // Scissors start
|
||||||
|
+ total += NbtUtility.getTagSize(compoundTag);
|
||||||
|
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ stacks.clear();
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
stacks.set(j, ItemStack.of(compoundTag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
index d30156d5cb888b8cf2af9aee9b94e242a6510192..7fb7337256a0c3cdde587fb5a9222bb8faa322ec 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
@@ -21,6 +21,7 @@ import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
|
@@ -253,6 +254,12 @@ public final class ItemStack {
|
||||||
|
|
||||||
|
// CraftBukkit - break into own method
|
||||||
|
private void load(CompoundTag nbttagcompound) {
|
||||||
|
+ // Scissors start - Reset large tags
|
||||||
|
+ if (NbtUtility.isTooLarge(nbttagcompound)) {
|
||||||
|
+ // Reset tag without destroying item
|
||||||
|
+ nbttagcompound = NbtUtility.Item.removeItemData(nbttagcompound);
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
|
||||||
|
this.count = nbttagcompound.getByte("Count");
|
||||||
|
if (nbttagcompound.contains("tag", 10)) {
|
||||||
|
@@ -556,7 +563,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;
|
||||||
|
@@ -886,6 +897,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 40e59b8db83aec1143e3c394427e916beea7c01f..f292aa0016e6f741b36ddc1417f6f63d248f987f 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
@@ -9,6 +9,7 @@ import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility; // 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 start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||||
|
index 416aa989ebb18a8741cc9d605a1180ab830f6643..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 me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
@@ -34,6 +35,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
|
index 526d1bfd5ad0de7bcfd0c2da902515f3dec94c54..2cf0e645aeae983ec6db9b1a25401120fd968f06 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
|
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility; // 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 start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||||
|
index 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 me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
@@ -40,6 +41,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||||
|
index 881379681c39230a00b3a1f11cd87498984396c7..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 me.totalfreedom.scissors.NbtUtility; // Scissors
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@@ -28,6 +29,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
index 1eebd3969735bff3e5559ed01ab4a2ec1c3c2de6..a7d8a6beb45bcc8be3e4a444ab1020783fba1635 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
@@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility; // 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 start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||||
|
index 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
|
||||||
|
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility; // 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;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors start - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.itemStacks) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.itemStacks.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return this.itemStacks;
|
||||||
|
}
|
||||||
|
|
19
patches/server/0025-Don-t-log-invalid-teams-to-console.patch
Normal file
19
patches/server/0025-Don-t-log-invalid-teams-to-console.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 17 May 2022 05:57:52 +0100
|
||||||
|
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 77275e948b3636d21cca8f59c35834e8fdb339c7..4bc677c5ab2cdcb1a235ecfab9468e7f1d7a96f3 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
@@ -871,7 +871,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 - Prevent log spam possible with this error message, easily provokable by players in creative.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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 88bac72edf19c578902f49d20353989ed4d96f8f..6963f2720fcc9888f62f5a1382dd96d82f598ac8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/ListTag.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
|
|
||||||
@@ -34,6 +34,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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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);
|
|
@ -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 66cf0a6cd1525ecf2615809210a26d55f445d07d..74fb79d4ea11f88f2c0de65b492a5fecc49684f1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
@@ -270,6 +270,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 {
|
158
patches/server/0027-Add-MasterBlockFireEvent.patch
Normal file
158
patches/server/0027-Add-MasterBlockFireEvent.patch
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
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 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,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
@@ -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.Location; // Scissors
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
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 start - Add master block fire event
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (hasCommand) {
|
||||||
|
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 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
|
||||||
|
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
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";
|
||||||
|
@@ -107,6 +109,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||||
|
+ // 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())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
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 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
|
||||||
|
@@ -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; // Scissors
|
||||||
|
import net.minecraft.ResourceLocationException;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -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 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 +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);
|
||||||
|
@@ -321,6 +323,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
public boolean saveStructure(boolean bl) {
|
||||||
|
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||||
|
+ // Scissors 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())
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
||||||
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
|
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 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()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
StructureTemplateManager structureTemplateManager = world.getStructureManager();
|
||||||
|
|
||||||
|
Optional<StructureTemplate> optional;
|
||||||
|
@@ -403,6 +425,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unloadStructure() {
|
||||||
|
+ // 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()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.structureName != null) {
|
||||||
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
|
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
|
32
patches/server/0028-Add-spectator-teleport-event.patch
Normal file
32
patches/server/0028-Add-spectator-teleport-event.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
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 678bba9d636a0eb34270a2d26b5b3d0d6d900115..30339009c126fca8393ceed3c780c097b6c06ffd 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; // Scissors
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
import com.mojang.brigadier.ParseResults;
|
||||||
|
@@ -2148,6 +2149,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
Entity entity = packet.getEntity(worldserver);
|
||||||
|
|
||||||
|
if (entity != null) {
|
||||||
|
+ // Scissors start - Add spectator teleport event
|
||||||
|
+ final SpectatorTeleportEvent event = new SpectatorTeleportEvent(this.player.getBukkitEntity(), entity.getBukkitEntity());
|
||||||
|
+
|
||||||
|
+ if(!event.callEvent()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
io.papermc.paper.threadedregions.TeleportUtils.teleport(this.player, false, entity, null, null, Entity.TELEPORT_FLAG_LOAD_CHUNK, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE, null); // Folia - region threading
|
||||||
|
return;
|
||||||
|
}
|
@ -1,249 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Business Goose <arclicious@vivaldi.net>
|
|
||||||
Date: Mon, 18 Apr 2022 03:56:09 +0100
|
|
||||||
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 d02339a07e1da56fd5dc171a5e32b00d63fa555c..fe6cb52573ee50a2c02d7add38b5e8411d7177f4 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;
|
|
||||||
@@ -7,23 +8,28 @@ import com.google.gson.JsonParseException;
|
|
||||||
import com.mojang.brigadier.StringReader;
|
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|
||||||
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;
|
|
||||||
-import java.util.Objects;
|
|
||||||
-import java.util.Optional;
|
|
||||||
-import java.util.Random;
|
|
||||||
-import java.util.function.Consumer;
|
|
||||||
-import java.util.function.Predicate;
|
|
||||||
-import java.util.stream.Collectors;
|
|
||||||
-import javax.annotation.Nullable;
|
|
||||||
+import net.minecraft.ChatFormatting;
|
|
||||||
+import net.minecraft.Util;
|
|
||||||
+import net.minecraft.advancements.CriteriaTriggers;
|
|
||||||
+import net.minecraft.commands.arguments.blocks.BlockPredicateArgument;
|
|
||||||
+import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
|
||||||
+import net.minecraft.core.BlockPos;
|
|
||||||
+import net.minecraft.core.Direction;
|
|
||||||
+import net.minecraft.core.Registry;
|
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
|
||||||
+import net.minecraft.nbt.ListTag;
|
|
||||||
+import net.minecraft.nbt.NbtOps;
|
|
||||||
+import net.minecraft.network.chat.*;
|
|
||||||
+import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket;
|
|
||||||
+import net.minecraft.resources.ResourceLocation;
|
|
||||||
+import net.minecraft.server.MinecraftServer;
|
|
||||||
+import net.minecraft.server.level.ServerLevel;
|
|
||||||
+import net.minecraft.server.level.ServerPlayer;
|
|
||||||
+import net.minecraft.sounds.SoundEvent;
|
|
||||||
+import net.minecraft.sounds.SoundSource;
|
|
||||||
+import net.minecraft.stats.Stats;
|
|
||||||
import net.minecraft.tags.BlockTags;
|
|
||||||
import net.minecraft.tags.Tag;
|
|
||||||
import net.minecraft.tags.TagContainer;
|
|
||||||
@@ -31,11 +37,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;
|
|
||||||
@@ -51,50 +53,13 @@ import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
-import net.minecraft.world.level.block.BaseEntityBlock;
|
|
||||||
-import net.minecraft.world.level.block.Block;
|
|
||||||
-import org.apache.logging.log4j.LogManager;
|
|
||||||
-import org.apache.logging.log4j.Logger;
|
|
||||||
-
|
|
||||||
-// CraftBukkit start
|
|
||||||
-import com.mojang.serialization.Dynamic;
|
|
||||||
-import java.util.List;
|
|
||||||
-import java.util.Map;
|
|
||||||
-import net.minecraft.ChatFormatting;
|
|
||||||
-import net.minecraft.Util;
|
|
||||||
-import net.minecraft.advancements.CriteriaTriggers;
|
|
||||||
-import net.minecraft.commands.arguments.blocks.BlockPredicateArgument;
|
|
||||||
-import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
|
||||||
-import net.minecraft.core.BlockPos;
|
|
||||||
-import net.minecraft.core.Direction;
|
|
||||||
-import net.minecraft.core.Registry;
|
|
||||||
-import net.minecraft.nbt.CompoundTag;
|
|
||||||
-import net.minecraft.nbt.ListTag;
|
|
||||||
-import net.minecraft.nbt.NbtOps;
|
|
||||||
-import net.minecraft.network.chat.Component;
|
|
||||||
-import net.minecraft.network.chat.ComponentUtils;
|
|
||||||
-import net.minecraft.network.chat.HoverEvent;
|
|
||||||
-import net.minecraft.network.chat.MutableComponent;
|
|
||||||
-import net.minecraft.network.chat.Style;
|
|
||||||
-import net.minecraft.network.chat.TextComponent;
|
|
||||||
-import net.minecraft.network.chat.TranslatableComponent;
|
|
||||||
-import net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket;
|
|
||||||
-import net.minecraft.resources.ResourceLocation;
|
|
||||||
-import net.minecraft.server.MinecraftServer;
|
|
||||||
-import net.minecraft.server.level.ServerLevel;
|
|
||||||
-import net.minecraft.server.level.ServerPlayer;
|
|
||||||
-import net.minecraft.sounds.SoundEvent;
|
|
||||||
-import net.minecraft.sounds.SoundSource;
|
|
||||||
-import net.minecraft.stats.Stats;
|
|
||||||
-import net.minecraft.world.level.block.Blocks;
|
|
||||||
-import net.minecraft.world.level.block.JukeboxBlock;
|
|
||||||
-import net.minecraft.world.level.block.SaplingBlock;
|
|
||||||
-import net.minecraft.world.level.block.SoundType;
|
|
||||||
-import net.minecraft.world.level.block.WitherSkullBlock;
|
|
||||||
+import net.minecraft.world.level.block.*;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
import net.minecraft.world.level.block.entity.SignBlockEntity;
|
|
||||||
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
|
||||||
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
|
|
||||||
+import org.apache.logging.log4j.LogManager;
|
|
||||||
+import org.apache.logging.log4j.Logger;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.TreeType;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
@@ -106,6 +71,15 @@ import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.block.BlockFertilizeEvent;
|
|
||||||
import org.bukkit.event.player.PlayerItemDamageEvent;
|
|
||||||
import org.bukkit.event.world.StructureGrowEvent;
|
|
||||||
+
|
|
||||||
+import javax.annotation.Nullable;
|
|
||||||
+import java.text.DecimalFormat;
|
|
||||||
+import java.text.DecimalFormatSymbols;
|
|
||||||
+import java.util.*;
|
|
||||||
+import java.util.Map.Entry;
|
|
||||||
+import java.util.function.Consumer;
|
|
||||||
+import java.util.function.Predicate;
|
|
||||||
+import java.util.stream.Collectors;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public final class ItemStack {
|
|
||||||
@@ -245,6 +219,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)) {
|
|
||||||
@@ -485,7 +466,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;
|
|
||||||
@@ -815,6 +800,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;
|
|
||||||
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 14da2997b5fff4434b1fe8d5a1b3109dde143740..a4385cea2d472611cfc7ef43662367bb1d780333 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,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Business Goose <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 99a5074adbe2a254ae6115b3548f1fcd30ba2489..68ae4dfe3f4a77605b19607b5f04a2a6d07d6fc8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
||||||
@@ -623,7 +623,7 @@ public abstract class LivingEntity extends Entity {
|
|
||||||
|
|
||||||
protected void tickDeath() {
|
|
||||||
++this.deathTime;
|
|
||||||
- if (this.deathTime >= 20 && !this.isRemoved() && !this.level.isClientSide()) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
|
||||||
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.isRemoved() && !this.level.isClientSide()) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
|
||||||
this.level.broadcastEntityEvent(this, (byte) 60);
|
|
||||||
this.remove(Entity.RemovalReason.KILLED);
|
|
||||||
}
|
|
37
patches/server/0029-Prevent-invalid-container-events.patch
Normal file
37
patches/server/0029-Prevent-invalid-container-events.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
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 30339009c126fca8393ceed3c780c097b6c06ffd..bb5120b65e7394c134b69fbde8e880298397076b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -30,6 +30,7 @@ import java.util.function.UnaryOperator;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import net.kyori.adventure.text.format.NamedTextColor; // Scissors
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.CrashReport;
|
||||||
|
import net.minecraft.CrashReportCategory;
|
||||||
|
@@ -3114,6 +3115,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Do not call events when the slot/button number is invalid
|
||||||
|
+ final int sentSlotNum = packet.getSlotNum();
|
||||||
|
+ if((Mth.clamp(sentSlotNum, -1, this.player.containerMenu.slots.size() - 1) != sentSlotNum) && sentSlotNum != -999)
|
||||||
|
+ {
|
||||||
|
+ this.getCraftPlayer().kick(
|
||||||
|
+ net.kyori.adventure.text.Component.text("Invalid container click slot (Hacking?)")
|
||||||
|
+ .color(NamedTextColor.RED)
|
||||||
|
+ );
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
InventoryView inventory = this.player.containerMenu.getBukkitView();
|
||||||
|
SlotType type = inventory.getSlotType(packet.getSlotNum());
|
||||||
|
|
@ -0,0 +1,73 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 10:29:03 +0100
|
||||||
|
Subject: [PATCH] Disable running commands in books by default
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
index 31911c09fe15753ae32fa39417bdc9e9de552a88..b810a5afcb2343174e37efb7dd8a36b968b07c3a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
@@ -2,6 +2,7 @@ package net.minecraft.world.item;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -9,8 +10,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.StringTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
|
-import net.minecraft.network.chat.Component;
|
||||||
|
-import net.minecraft.network.chat.ComponentUtils;
|
||||||
|
+import net.minecraft.network.chat.*; // Scissors
|
||||||
|
import net.minecraft.stats.Stats;
|
||||||
|
import net.minecraft.util.StringUtil;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
@@ -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)
|
||||||
|
+ {
|
||||||
|
+ return Component.nullToEmpty("Sanitization function depth limit exceeded");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ MutableComponent component2 = component.copy();
|
||||||
|
+
|
||||||
|
+ final Style style = component2.getStyle();
|
||||||
|
+ final ClickEvent clickEvent = style.getClickEvent();
|
||||||
|
+
|
||||||
|
+ if (clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND))
|
||||||
|
+ {
|
||||||
|
+ final String clickEventValue = clickEvent.getValue();
|
||||||
|
+
|
||||||
|
+ component2 = component2.copy().setStyle(style
|
||||||
|
+ .withClickEvent(null)
|
||||||
|
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.nullToEmpty("Would've " + (clickEventValue.startsWith("/") ? "ran" : "said") + ": " + clickEvent.getValue())))
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ final List<Component> processedExtra = component2.getSiblings()
|
||||||
|
+ .stream()
|
||||||
|
+ .map(comp -> sanitize(comp, depth + 1))
|
||||||
|
+ .toList();
|
||||||
|
+ component2.getSiblings().clear();
|
||||||
|
+ component2.getSiblings().addAll(processedExtra);
|
||||||
|
+
|
||||||
|
+ return component2;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public boolean isFoil(ItemStack stack) {
|
||||||
|
return true;
|
@ -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/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 bb5120b65e7394c134b69fbde8e880298397076b..dc28a954a9ac0fa0615c7cf4797db5fca2e48989 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1410,7 +1410,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
if (this.player.hasPermissions(2)) {
|
||||||
|
Entity entity = this.player.level().getEntity(packet.getEntityId());
|
||||||
|
|
||||||
|
- if (entity != null) {
|
||||||
|
+ if (entity != null && this.player.distanceToSqr(entity.position().x, entity.position().y, entity.position().z) < 32 * 32) { // Scissors - Validate entity tag query positions
|
||||||
|
CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag());
|
||||||
|
|
||||||
|
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
|
||||||
|
@@ -1422,7 +1422,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
- if (this.player.hasPermissions(2)) {
|
||||||
|
+ // Scissors start - Validate block entity tag query positions
|
||||||
|
+ if (this.player.hasPermissions(2) && this.player.level().isLoadedAndInBounds(packet.getPos())
|
||||||
|
+ && this.player.distanceToSqr(packet.getPos().getX(), packet.getPos().getY(), packet.getPos().getZ()) < 32 * 32) {
|
||||||
|
+ // Scissors end
|
||||||
|
BlockEntity tileentity = this.player.level().getBlockEntity(packet.getPos());
|
||||||
|
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
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 f356196aaeb498a6d2c9ad2112329cef5a3103d6..a8d8445be1cfb67de1adcaf64847d0bfaf8c503d 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
@@ -8,8 +8,10 @@ import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.UnaryOperator;
|
||||||
|
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.nbt.NbtOps;
|
||||||
|
@@ -19,6 +21,7 @@ import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.ComponentUtils;
|
||||||
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.server.MinecraftServer; // Scissors
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.server.network.FilteredText;
|
||||||
|
@@ -30,6 +33,7 @@ import net.minecraft.world.level.block.SignBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.phys.Vec2;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity; // Scissors
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.bukkit.block.sign.Side;
|
||||||
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
|
@@ -37,6 +41,7 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
// CraftBukkit end
|
||||||
|
+import org.bukkit.craftbukkit.CraftServer; // Scissors
|
||||||
|
|
||||||
|
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
|
||||||
|
|
||||||
|
@@ -291,6 +296,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||||
|
}
|
||||||
|
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
||||||
|
// Paper end
|
||||||
|
+ // Scissors start - Add optional permissions to command signs
|
||||||
|
+ final MinecraftServer vanillaServer = player.getServer();
|
||||||
|
+ final CraftServer craftServer = vanillaServer.server;
|
||||||
|
+ final CraftHumanEntity craftPlayer = player.getBukkitEntity();
|
||||||
|
+ final Commands commands = vanillaServer.getCommands();
|
||||||
|
+
|
||||||
|
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||||
|
+ {
|
||||||
|
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
flag1 = true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 16 Aug 2022 17:13:02 +0100
|
||||||
|
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
index 0f70be614f8f5350ad558d0ae645cdf0027e1e76..c006ac8531cf2c029fd2fac449f96736a4afed0d 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
@@ -199,6 +199,7 @@ public final class CraftChatMessage {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
||||||
|
+ if (message.length() > 1_000) return new Component[]{Component.empty()}; // Scissors - Refuse to convert legacy messages over 1k characters
|
||||||
|
return new StringMessage(message, keepNewlines, plain).getOutput();
|
||||||
|
}
|
||||||
|
|
94
patches/server/0034-Prevent-velocity-freeze.patch
Normal file
94
patches/server/0034-Prevent-velocity-freeze.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 27 Nov 2022 05:14:18 +0000
|
||||||
|
Subject: [PATCH] Prevent velocity freeze
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
index 77f55bcb120295fa11140681f63175d37d8a78e2..fbdc893c2e8c3b668ad65d1304c889a2cc8eca27 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.entity.projectile;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.MathUtility; // 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) {
|
||||||
|
- this.xPower = d3 / d6 * 0.1D;
|
||||||
|
- this.yPower = d4 / d6 * 0.1D;
|
||||||
|
- this.zPower = d5 / d6 * 0.1D;
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = d3 / d6 * 0.1D;
|
||||||
|
+ //this.yPower = d4 / d6 * 0.1D;
|
||||||
|
+ //this.zPower = d5 / d6 * 0.1D;
|
||||||
|
+
|
||||||
|
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -146,6 +151,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ public void setPower(double xPower, double yPower, double zPower)
|
||||||
|
+ {
|
||||||
|
+ if (Double.isInfinite(xPower) || Double.isInfinite(yPower) || Double.isInfinite(zPower))
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (Double.isNaN(xPower) || Double.isNaN(yPower) || Double.isNaN(zPower))
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.xPower = MathUtility.clampDouble(xPower, -1024, 1024);
|
||||||
|
+ this.yPower = MathUtility.clampDouble(yPower, -1024, 1024);
|
||||||
|
+ this.zPower = MathUtility.clampDouble(zPower, -1024, 1024);
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
|
super.readAdditionalSaveData(nbt);
|
||||||
|
@@ -153,9 +177,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
ListTag nbttaglist = nbt.getList("power", 6);
|
||||||
|
|
||||||
|
if (nbttaglist.size() == 3) {
|
||||||
|
- this.xPower = nbttaglist.getDouble(0);
|
||||||
|
- this.yPower = nbttaglist.getDouble(1);
|
||||||
|
- this.zPower = nbttaglist.getDouble(2);
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = nbttaglist.getDouble(0);
|
||||||
|
+ //this.yPower = nbttaglist.getDouble(1);
|
||||||
|
+ //this.zPower = nbttaglist.getDouble(2);
|
||||||
|
+
|
||||||
|
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -189,9 +217,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
Vec3 vec3d = entity.getLookAngle();
|
||||||
|
|
||||||
|
this.setDeltaMovement(vec3d);
|
||||||
|
- this.xPower = vec3d.x * 0.1D;
|
||||||
|
- this.yPower = vec3d.y * 0.1D;
|
||||||
|
- this.zPower = vec3d.z * 0.1D;
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = vec3d.x * 0.1D;
|
||||||
|
+ //this.yPower = vec3d.y * 0.1D;
|
||||||
|
+ //this.zPower = vec3d.z * 0.1D;
|
||||||
|
+
|
||||||
|
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
||||||
|
+ // Scissors end
|
||||||
|
this.setOwner(entity);
|
||||||
|
}
|
||||||
|
|
@ -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 dc28a954a9ac0fa0615c7cf4797db5fca2e48989..38b60dde9ec9fcadc8e62ec25ae1646aecc10dfb 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;
|
||||||
|
@@ -2404,7 +2405,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));
|
||||||
|
@@ -2460,6 +2461,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
|
||||||
|
}
|
||||||
|
@@ -2691,6 +2693,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
|
||||||
|
}
|
||||||
|
@@ -3761,6 +3764,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
+ if (!ScissorsConfig.chatSignaturesEnabled) return; // Scissors
|
||||||
|
RemoteChatSession.Data remotechatsession_a = packet.chatSession();
|
||||||
|
ProfilePublicKey.Data profilepublickey_a = this.chatSession != null ? this.chatSession.profilePublicKey().data() : null;
|
||||||
|
ProfilePublicKey.Data profilepublickey_a1 = remotechatsession_a.profilePublicKey();
|
@ -0,0 +1,19 @@
|
|||||||
|
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 c3e587abaf61772f2a6872ece6ea65b18cf7cdee..a6bfdf0e95f3e7b1cf792d44340f308774ce7c00 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@@ -5411,7 +5411,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);
|
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 2b862066388cfede202a0c709f93ae89e2d17b30..465be29b3586dde779acfa44fe126850ccae3789 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
|
||||||
|
@@ -355,6 +355,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,25 @@
|
|||||||
|
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 cf8f93734121e5c1959959f0ba13ee4e6db31959..e9a7755ec85eef3e9cc05b4deb6dfe10954bcadd 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
@@ -1690,7 +1690,13 @@ 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 0cdf092d5c3f65a23e26f201768c0e2fea1ffe09..cfed22910f3b73c0dc115b7887bd5b117749a939 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
|
||||||
|
@@ -416,7 +416,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);
|
@ -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) {
|
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 38b60dde9ec9fcadc8e62ec25ae1646aecc10dfb..61000ef4e49050cd2f6f182423638bc00fa26561 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
|
||||||
|
@@ -1029,6 +1034,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) {
|
||||||
|
@@ -1060,7 +1075,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..b70bafe2766efcbcce00287e6511a588560564a6 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
||||||
|
@@ -169,9 +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('[');
|
||||||
|
this.reader.skipWhitespace();
|
||||||
|
@@ -203,7 +250,7 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect(']');
|
||||||
|
- return listTag;
|
||||||
|
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -228,7 +275,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 +288,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 +304,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 3b866e2c20ee7bfc981ff09b29065530de993778..cbffd654a25a5c498ea96059aa97ef0c012c923c 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;
|
||||||
|
@@ -424,6 +424,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 5ddd8108e077bc7c1a9524854ac591c6ab99c174..b6577352c043b44df2e32a35a6af2711339f15eb 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||||
|
@@ -57,7 +57,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 61000ef4e49050cd2f6f182423638bc00fa26561..4306f6fe53dcf73875bb68309bd1f037f71ee8c1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -994,7 +994,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();
|
||||||
|
@@ -1161,7 +1161,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
- if (this.player.canUseGameMasterBlocks()) {
|
||||||
|
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
||||||
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
|
@@ -1219,7 +1219,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
- if (this.player.canUseGameMasterBlocks()) {
|
||||||
|
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
||||||
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
|
@@ -1242,7 +1242,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||||
|
- if (this.player.canUseGameMasterBlocks()) {
|
||||||
|
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
||||||
|
|
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 55026e1731e41b4e3e4c6a8fef5d96a32051a556..4a8383d48da4fcf39ec528a00cd09417f8d08c57 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
|
@@ -227,8 +227,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 65cb385ab294e362d666a6d03c4496cdc3b64890..42c3e946e51f6dcb100078969a4fb46c77f42b2d 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 a3456b35db4e938f91d6bc32d4d202a011bf13c4..aad0b066e4fd63195aa117c5a03f64846bf46fbd 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()) {
|
@ -0,0 +1,62 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 28 Jul 2023 19:33:23 -0300
|
||||||
|
Subject: [PATCH] Don't return null Components in the Component codec
|
||||||
|
|
||||||
|
Found by Sk8kman
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||||
|
index 066d423dc908080157586555ba01053a2477d570..aa6e5de37ce69c9bc6b8e1e0b5ab0ee918fc27e2 100644
|
||||||
|
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||||
|
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
|
||||||
|
@@ -62,7 +62,10 @@ public class ExtraCodecs {
|
||||||
|
});
|
||||||
|
public static final Codec<Component> COMPONENT = JSON.flatXmap((element) -> {
|
||||||
|
try {
|
||||||
|
- return DataResult.success(Component.Serializer.fromJson(element));
|
||||||
|
+ // Scissors start
|
||||||
|
+ final Component component = Component.Serializer.fromJson(element);
|
||||||
|
+ return DataResult.success(component != null ? component : Component.empty());
|
||||||
|
+ // Scissors end
|
||||||
|
} catch (JsonParseException var2) {
|
||||||
|
return DataResult.error(var2::getMessage);
|
||||||
|
}
|
||||||
|
@@ -75,7 +78,10 @@ public class ExtraCodecs {
|
||||||
|
});
|
||||||
|
public static final Codec<Component> FLAT_COMPONENT = Codec.STRING.flatXmap((json) -> {
|
||||||
|
try {
|
||||||
|
- return DataResult.success(Component.Serializer.fromJson(json));
|
||||||
|
+ // Scissors start
|
||||||
|
+ final Component component = Component.Serializer.fromJson(json);
|
||||||
|
+ return DataResult.success(component != null ? component : Component.empty());
|
||||||
|
+ // Scissors end
|
||||||
|
} catch (JsonParseException var2) {
|
||||||
|
return DataResult.error(var2::getMessage);
|
||||||
|
}
|
||||||
|
@@ -246,7 +252,7 @@ public class ExtraCodecs {
|
||||||
|
}, (pair) -> {
|
||||||
|
return ImmutableList.of(leftFunction.apply(pair), rightFunction.apply(pair));
|
||||||
|
});
|
||||||
|
- Codec<I> codec3 = RecordCodecBuilder.<Pair>create((instance) -> {
|
||||||
|
+ Codec<I> codec3 = RecordCodecBuilder.<Pair<P,P>>create((instance) -> { // Scissors - Decompile error
|
||||||
|
return instance.group(codec.fieldOf(leftFieldName).forGetter(Pair::getFirst), codec.fieldOf(rightFieldName).forGetter(Pair::getSecond)).apply(instance, Pair::of);
|
||||||
|
}).comapFlatMap((pair) -> {
|
||||||
|
return combineFunction.apply((P)pair.getFirst(), (P)pair.getSecond());
|
||||||
|
@@ -278,7 +284,7 @@ public class ExtraCodecs {
|
||||||
|
Optional<Pair<A, T>> optional = dataResult.resultOrPartial(mutableObject::setValue);
|
||||||
|
return optional.isPresent() ? dataResult : DataResult.error(() -> {
|
||||||
|
return "(" + (String)mutableObject.getValue() + " -> using default)";
|
||||||
|
- }, Pair.of(object, object));
|
||||||
|
+ }, (Pair<A, T>) Pair.of(object, object)); // Scissors - Decompile error
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> DataResult<T> coApply(DynamicOps<T> dynamicOps, A objectx, DataResult<T> dataResult) {
|
||||||
|
@@ -565,7 +571,7 @@ public class ExtraCodecs {
|
||||||
|
|
||||||
|
static record LazyInitializedCodec<A>(Supplier<Codec<A>> delegate) implements Codec<A> {
|
||||||
|
LazyInitializedCodec {
|
||||||
|
- supplier = Suppliers.memoize(supplier::get);
|
||||||
|
+ delegate = Suppliers.memoize(delegate::get); // Scissors - Decompile error
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> DataResult<Pair<A, T>> decode(DynamicOps<T> dynamicOps, T object) {
|
@ -1,7 +1,7 @@
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven("https://papermc.io/repo/repository/maven-public/")
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user