mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 15:38:35 +00:00
Compare commits
3 Commits
slime/1.20
...
1.19.3
Author | SHA1 | Date | |
---|---|---|---|
4b69690c68 | |||
60ef55e21e | |||
1ce9a71b1e |
28
.github/workflows/build.yml
vendored
28
.github/workflows/build.yml
vendored
@ -1,10 +1,5 @@
|
|||||||
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
|
||||||
@ -12,21 +7,26 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Git Repository
|
- name: Checkout Git Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
submodules: 'true'
|
|
||||||
- name: Validate Gradle wrapper
|
- name: Validate Gradle wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
- name: Setup Gradle
|
- name: Cache Gradle
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: actions/cache@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@v3
|
uses: actions/setup-java@v2.3.0
|
||||||
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
|
run: ./gradlew applyPatches --stacktrace
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build
|
run: ./gradlew build --stacktrace
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -50,6 +50,3 @@ Scissors-Server
|
|||||||
Scissors-API
|
Scissors-API
|
||||||
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
aswm-api/src
|
|
||||||
aswm-core/src
|
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,4 +0,0 @@
|
|||||||
[submodule "submodules/AdvancedSlimePaper"]
|
|
||||||
path = submodules/AdvancedSlimePaper
|
|
||||||
url = https://github.com/InfernalSuite/AdvancedSlimePaper.git
|
|
||||||
branch = paper_upstream
|
|
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@ -1,15 +1,9 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
options { skipDefaultCheckout() }
|
|
||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
GITHUB_BRANCH = "${BRANCH_NAME}"
|
GITHUB_BRANCH = "${BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('checkout') {
|
|
||||||
steps {
|
|
||||||
checkout scmGit(branches: [[name: '*/slime/1.20.1']], extensions: [submodule(parentCredentials: true, recursiveSubmodules: true, reference: 'https://github.com/InfernalSuite/AdvancedSlimePaper')], userRemoteConfigs: [[url: 'https://github.com/AtlasMediaGroup/Scissors']])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('applyPatches') {
|
stage('applyPatches') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
|
@ -16,6 +16,5 @@ should submit a pull request to this project to add their name.
|
|||||||
|
|
||||||
```text
|
```text
|
||||||
Allink (allinkdev) <arclicious@vivaldi.net>
|
Allink (allinkdev) <arclicious@vivaldi.net>
|
||||||
Luna (LunaWasFlaggedAgain) <lunahatesgogle@gmail.com>
|
|
||||||
Telesphoreo <me@telesphoreo.me>
|
Telesphoreo <me@telesphoreo.me>
|
||||||
```
|
```
|
||||||
|
18
README.md
18
README.md
@ -1,24 +1,8 @@
|
|||||||
# Scissors [](https://ci.plex.us.org/job/Scissors/job/slime%252F1.20.1/)
|
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.19.3/)
|
||||||
|
|
||||||
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
|
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
|
||||||
Paper's own team has either refused to fix or would have.
|
Paper's own team has either refused to fix or would have.
|
||||||
|
|
||||||
All SWM patches/SWM API belongs to [AdvancedSlimePaper and InfernalSuite](https://github.com/InfernalSuite/AdvancedSlimePaper)
|
|
||||||
|
|
||||||
Note: This will not compile on Windows by default. To make it compile, you need to delete the `aswm-core/src`
|
|
||||||
and `aswm-api/src` files. Then open up Command Prompt as an administrator and run the following for the api project:
|
|
||||||
```mklink /D C:\full\path\to\project\aswm-api\src C:\full\path\to\project\submodules\AdvancedSlimePaper\api\src```. Now,
|
|
||||||
run the same thing again for the core
|
|
||||||
project: ```mklink /D C:\full\path\to\project\aswm-core\src C:\full\path\to\project\submodules\AdvancedSlimePaper\core\src```
|
|
||||||
Make sure you replace the placeholder `C:\full\path\to\project` with the actual full path to the root project on your
|
|
||||||
local machine. You do not need to do this if you are compiling on macOS or Linux.
|
|
||||||
|
|
||||||
## Links
|
|
||||||
### [Scissors Download](https://ci.plex.us.org/job/Scissors)
|
|
||||||
### [Scissors Javadoc](https://javadoc.scissors.gg/1.20.1)
|
|
||||||
### [Scissors Announcements](https://totalfreedom.tf/forums/scissors-announcements.55)
|
|
||||||
### [Scissors General Discussion](https://totalfreedom.tf/forums/scissors-discussion.56/)
|
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
```
|
```
|
||||||
Paperweight tasks
|
Paperweight tasks
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
plugins {
|
|
||||||
`java-library`
|
|
||||||
`maven-publish`
|
|
||||||
signing
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api("com.flowpowered:flow-nbt:2.0.2")
|
|
||||||
api("org.jetbrains:annotations:23.0.0")
|
|
||||||
|
|
||||||
compileOnly("io.papermc.paper:paper-api:1.20-R0.1-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
withSourcesJar()
|
|
||||||
withJavadocJar()
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
../submodules/AdvancedSlimePaper/api/src
|
|
@ -1,7 +0,0 @@
|
|||||||
plugins {
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly(project(":aswm-api"))
|
|
||||||
implementation("com.github.luben:zstd-jni:1.5.2-2")
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
../submodules/AdvancedSlimePaper/core/src
|
|
@ -1,8 +1,8 @@
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
id("com.github.johnrengelman.shadow") version "8.1.0" apply false
|
||||||
id("io.papermc.paperweight.patcher") version "1.5.7-SNAPSHOT"
|
id("io.papermc.paperweight.patcher") version "1.5.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||||
@ -15,9 +15,9 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
remapper("net.fabricmc:tiny-remapper:0.8.9:fat")
|
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||||
decompiler("net.minecraftforge:forgeflower:2.0.629.1")
|
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||||
paperclip("io.papermc:paperclip:3.0.4-SNAPSHOT")
|
paperclip("io.papermc:paperclip:3.0.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@ -49,7 +49,6 @@ subprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven(paperMavenPublicUrl)
|
maven(paperMavenPublicUrl)
|
||||||
maven("https://repo.rapture.pw/repository/maven-releases/")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
group=me.totalfreedom.scissors
|
group=me.totalfreedom.scissors
|
||||||
version=1.20.1-R0.1-SNAPSHOT
|
version=1.19.3-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion=1.20.1
|
mcVersion=1.19.3
|
||||||
paperRef=773dd724469bae89d0c2075edc3d1ddc8d5b0b18
|
paperRef=155aa36d89b260ef5841615899299756b5983c0a
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,7 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
12
gradlew
vendored
12
gradlew
vendored
@ -85,6 +85,9 @@ done
|
|||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|
||||||
@ -130,13 +133,10 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
if ! command -v java >/dev/null 2>&1
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
then
|
|
||||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
@ -197,10 +197,6 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# 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"'
|
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# Collect all arguments for the java command;
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add MasterBlockFireEvent
|
|||||||
|
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..812e6ae9f1c8eb9558e5109c522d3ce3a7deb35c
|
index 0000000000000000000000000000000000000000..a24cb52a5af62012c5d5acc29e4c3558e92ae572
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
@@ -0,0 +1,51 @@
|
@@ -0,0 +1,51 @@
|
@ -1,33 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
||||||
Date: Mon, 26 Dec 2022 12:08:15 -0500
|
|
||||||
Subject: [PATCH] AdvancedSlimePaper API Changes
|
|
||||||
|
|
||||||
AdvancedSlimePaper
|
|
||||||
Copyright (C) 2023 InfernalSuite
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
||||||
index 8045f92ffdfb4164bcbef99c41359590c45f9006..51e49260927f6840c3640275ff26e7398ec72b89 100644
|
|
||||||
--- a/build.gradle.kts
|
|
||||||
+++ b/build.gradle.kts
|
|
||||||
@@ -27,6 +27,7 @@ configurations.api {
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// api dependencies are listed transitively to API consumers
|
|
||||||
+ api(project(":aswm-api")) // ASWM
|
|
||||||
api("com.google.guava:guava:31.1-jre")
|
|
||||||
api("com.google.code.gson:gson:2.10")
|
|
||||||
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.14") // Paper
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Add spectator teleport event
|
|||||||
|
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..e4c9256c78f8b395aea86e9ea1a112f8e7426c1f
|
index 0000000000000000000000000000000000000000..d7efa63c316ed99c3eccfeadc1b0873b2ccb5d8a
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
@@ -0,0 +1,60 @@
|
@@ -0,0 +1,60 @@
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add Scissors configuration file
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 8d8fe04e6b09d2a5b1cc05002073df5c58cdcb96..9fd0d55bac867322e8c72dcf4a17bd18f7aa423c 100644
|
index 2204336d8800311b65e894739ab1b27273e7c6f2..766d0143290cfc5062c548c2361316dbddca9afe 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2121,6 +2121,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -1971,6 +1971,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
@ -1,173 +0,0 @@
|
|||||||
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;
|
|
||||||
+ }
|
|
||||||
+}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,34 +1,31 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sat, 12 Mar 2022 22:22:22 -0300
|
Date: Wed, 27 Jul 2022 22:09:00 -0500
|
||||||
Subject: [PATCH] Build changes
|
Subject: [PATCH] Build changes
|
||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index ad034c140f18518abc18244ca1f2fb853ca5897e..9a40d3d6bc3862814926e52cf61f46ee440d63fa 100644
|
index 1919a8e9cb7c995b2a9c876ff4980bdc98977133..c2e924b05178e2c6324a0f797897cd69422a89ef 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -14,8 +14,12 @@ val alsoShade: Configuration by configurations.creating
|
@@ -7,8 +7,10 @@ plugins {
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":aswm-core"))
|
|
||||||
- implementation(project(":paper-api"))
|
- implementation(project(":paper-api"))
|
||||||
- implementation(project(":paper-mojangapi"))
|
- implementation(project(":paper-mojangapi"))
|
||||||
+ // Scissors start
|
|
||||||
+ implementation(project(":Scissors-API"))
|
+ implementation(project(":Scissors-API"))
|
||||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.1-R0.1-SNAPSHOT") {
|
+ implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
|
||||||
+ exclude("io.papermc.paper", "paper-api")
|
+ exclude("io.papermc.paper", "paper-api")
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
// Paper start
|
// Paper start
|
||||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
@@ -69,11 +73,19 @@ tasks.jar {
|
@@ -58,11 +60,17 @@ tasks.jar {
|
||||||
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||||
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
||||||
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
||||||
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||||
+ // Scissors start
|
|
||||||
+ var gitBranch: String;
|
+ var gitBranch: String;
|
||||||
+ if (System.getenv("JENKINS_URL") == null)
|
+ if (System.getenv("JENKINS_URL") == null)
|
||||||
+ {
|
+ {
|
||||||
@ -36,26 +33,25 @@ index ad034c140f18518abc18244ca1f2fb853ca5897e..9a40d3d6bc3862814926e52cf61f46ee
|
|||||||
+ } else {
|
+ } else {
|
||||||
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "CraftBukkit",
|
"Implementation-Title" to "CraftBukkit",
|
||||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||||
+ "Implementation-Version" to "git-Scissors-$implementationVersion", // Scissors
|
+ "Implementation-Version" to "git-Scissors-$implementationVersion",
|
||||||
"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,
|
||||||
@@ -150,7 +162,7 @@ fun TaskContainer.registerRunTask(
|
@@ -134,7 +142,7 @@ fun TaskContainer.registerRunTask(
|
||||||
name: String,
|
name: String,
|
||||||
block: JavaExec.() -> Unit
|
block: JavaExec.() -> Unit
|
||||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||||
- group = "paper"
|
- group = "paper"
|
||||||
+ group = "paperweight" // Scissors
|
+ group = "paperweight"
|
||||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||||
standardInput = System.`in`
|
standardInput = System.`in`
|
||||||
workingDir = rootProject.layout.projectDirectory
|
workingDir = rootProject.layout.projectDirectory
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..87fd35ad9c7364124286fa5e9ef1d4b7efa73990 100644
|
index 4b002e8b75d117b726b0de274a76d3596fce015b..5ff11b9bcef76cb767f0b03ffc326d3f7a361371 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
@@ -593,7 +593,7 @@ public class Metrics {
|
@@ -593,7 +593,7 @@ public class Metrics {
|
||||||
@ -63,7 +59,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..87fd35ad9c7364124286fa5e9ef1d4b7
|
|||||||
// Only start Metrics, if it's enabled in the config
|
// Only start Metrics, if it's enabled in the config
|
||||||
if (config.getBoolean("enabled", true)) {
|
if (config.getBoolean("enabled", true)) {
|
||||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||||
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger()); // Scissors
|
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||||
|
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||||
String minecraftVersion = Bukkit.getVersion();
|
String minecraftVersion = Bukkit.getVersion();
|
||||||
@ -72,33 +68,20 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..87fd35ad9c7364124286fa5e9ef1d4b7
|
|||||||
if (implVersion != null) {
|
if (implVersion != null) {
|
||||||
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
||||||
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
||||||
+ paperVersion = "git-ScissorsASWM-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Scissors
|
+ paperVersion = "git-Scissors-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
|
||||||
} else {
|
} else {
|
||||||
paperVersion = "unknown";
|
paperVersion = "unknown";
|
||||||
}
|
}
|
||||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
|
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
|
||||||
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> paperVersion)); // Scissors
|
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> paperVersion));
|
||||||
|
|
||||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
|
||||||
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 e62ebbb2e69df4a79b87cac542482ca913681b02..f0eb2e518cf618dfec7af602d8a77ce4bbf4389e 100644
|
index 753a917d34a1e1c1521a8916bc8e44a6acd90a46..b289da2fc7c2053415365505f830aaa045f70ff2 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
|
||||||
@@ -1695,7 +1695,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1654,7 +1654,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
public String getServerModName() {
|
public String getServerModName() {
|
||||||
@ -108,20 +91,20 @@ index e62ebbb2e69df4a79b87cac542482ca913681b02..f0eb2e518cf618dfec7af602d8a77ce4
|
|||||||
|
|
||||||
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 74d06790de674cbd230a0b14ac9a6b614c9f84ef..26937b8dd0411b0c96e461c57eeee6ae8595211e 100644
|
index bbb8335dae0a3e2761e6bbb8dc723bcf28cd82ba..3fa8a282e4511e79def2470f1abc34f3bf6527a3 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
|
||||||
@@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper
|
@@ -261,7 +261,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 = "Paper"; // Paper
|
||||||
+ private final String serverName = "Scissors"; // Scissors // Paper
|
+ private final String serverName = "Scissors"; // Scissors > // 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..741c76c4dfa0bb34cc23bd795c194bdea10418cc 100644
|
index 774556a62eb240da42e84db4502e2ed43495be17..5e6cce78e7987b4aa1c0052262ab8c4563905372 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||||
@ -129,7 +112,7 @@ index 774556a62eb240da42e84db4502e2ed43495be17..741c76c4dfa0bb34cc23bd795c194bde
|
|||||||
String result = "Unknown-Version";
|
String result = "Unknown-Version";
|
||||||
|
|
||||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/me.totalfreedom.scissors/Scissors-API/pom.properties"); // Scissors
|
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/me.totalfreedom.scissors/Scissors-API/pom.properties");
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
||||||
if (stream != null) {
|
if (stream != null) {
|
@ -1,26 +1,9 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sat, 12 Mar 2022 19:34:59 -0700
|
Date: Sat, 10 Dec 2022 22:25:38 -0600
|
||||||
Subject: [PATCH] UUID validation
|
Subject: [PATCH] Return null when a show_entity hover event's UUID isn't valid
|
||||||
|
|
||||||
|
|
||||||
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 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 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
|
@ -0,0 +1,46 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Fri, 10 Jun 2022 22:55:01 -0500
|
||||||
|
Subject: [PATCH] Fixes invalid LootTables causing problems when applied to
|
||||||
|
Minecart entities
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
|
index d4a8c1bbb8fef27ac42bdf27dde495b4c649e6cb..865c61accf211d28be3c82dcf158fec9778b50c1 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperContainerEntityLootableInventory.java
|
||||||
|
@@ -17,7 +17,7 @@ public class PaperContainerEntityLootableInventory implements PaperLootableEntit
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.bukkit.loot.LootTable getLootTable() {
|
||||||
|
- return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null;
|
||||||
|
+ return entity.getLootTable() != null && !entity.getLootTable().getPath().isEmpty() && entity.getLootTable().toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(entity.getLootTable())) : null; // Scissors - Validate length of loot tables before even trying
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||||
|
index 2ee4ee14ab3345486dad6b24fd9a4fcc6c746b99..c5ac6cda91a81d3075f5c763e30dc009b6be7936 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java
|
||||||
|
@@ -15,7 +15,7 @@ public class PaperTileEntityLootableInventory implements PaperLootableBlockInven
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.bukkit.loot.LootTable getLootTable() {
|
||||||
|
- return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null;
|
||||||
|
+ return tileEntityLootable.lootTable != null && !tileEntityLootable.lootTable.getPath().isEmpty() && tileEntityLootable.lootTable.toString().length() < 256 ? Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(tileEntityLootable.lootTable)) : null; // Scissors - Validate length of loot tables before even trying
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
|
||||||
|
index d559f93a9a09bac414dd5d58afccad42c127f09b..8ac4e76bf9acf2f99539c4f874ac5c8605573604 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
|
||||||
|
@@ -45,7 +45,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
|
@ -5,14 +5,14 @@ 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 41c9f074203915c31c1ae7a160ce509c13383f84..8b4989593da43fc2fd661ac66bfe5ae1eb5e2780 100644
|
index 41c9f074203915c31c1ae7a160ce509c13383f84..79a7fff759f062b783a540079cb43f2942799715 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; // Scissors
|
+import net.minecraft.resources.ResourceLocation;
|
||||||
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;
|
||||||
@ -25,7 +25,7 @@ index 41c9f074203915c31c1ae7a160ce509c13383f84..8b4989593da43fc2fd661ac66bfe5ae1
|
|||||||
+ 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;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissor 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"));
|
||||||
|
|
@ -1,200 +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] 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 e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..0bb87ca2556ca41e0b14503d3ae62e0fc133a209 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
|
||||||
@@ -618,7 +618,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
|
||||||
|
|
||||||
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
|
|
||||||
if (nbt.contains("DeathLootTable", 8)) {
|
|
||||||
- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable"));
|
|
||||||
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); // 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 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf11cf046fb 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
|
||||||
@@ -33,8 +33,14 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
|
||||||
return null; // return empty loot table?
|
|
||||||
}
|
|
||||||
|
|
||||||
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
|
||||||
- return Bukkit.getLootTable(key);
|
|
||||||
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
||||||
+ try {
|
|
||||||
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
|
||||||
+ return Bukkit.getLootTable(key);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
index 18b9b0dc70f6872a9d71c120bcd2edca531b0ac4..4732fff6d1198e5fc4875b4d4523aa2d152817ea 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
|
||||||
@@ -80,8 +80,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LootTable getLootTable() {
|
|
||||||
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
|
||||||
- return Bukkit.getLootTable(key);
|
|
||||||
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
|
||||||
+ try {
|
|
||||||
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
|
||||||
+ return Bukkit.getLootTable(key);
|
|
||||||
+ } catch (Exception ex) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
@ -1,27 +1,31 @@
|
|||||||
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: Sun, 13 Mar 2022 03:01:29 -0600
|
Date: Fri, 22 Apr 2022 00:59:00 -0500
|
||||||
Subject: [PATCH] Fixes the Blank SkullOwner exploit
|
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 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..48fce864be2a92c9665b9eeb85e3193eaed4133d 100644
|
index deed77a3d44bc55681483d7f47f148b5220135f2..053cb78362006a94ee0d82b9b1f665c5f86a4458 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
|
||||||
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
|
@@ -11,6 +11,9 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtUtils;
|
import net.minecraft.nbt.NbtUtils;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
import net.minecraft.world.level.block.entity.SkullBlockEntity;
|
||||||
+import org.apache.commons.lang3.StringUtils; // Scissors
|
+// Scissors start
|
||||||
|
+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.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
@@ -74,7 +75,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
@@ -73,7 +76,9 @@ 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()) {
|
||||||
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) { // Scissors
|
+ // Scissors start
|
||||||
|
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) {
|
||||||
|
+ // Scissors end
|
||||||
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {} // Paper
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Sun, 13 Mar 2022 07:47:20 -0600
|
Date: Fri, 10 Jun 2022 23:26:03 -0500
|
||||||
Subject: [PATCH] Removes useless spammy error logging
|
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 3df1822b55358a9bdf41bcacd5b7fecfd8f05dfa..f9741039dada19391e80d9623f2d8cabc1089506 100644
|
index 58c1d07f41fc382b23df17739090f5031fd41aad..92be52c3d193878ef9a3ed0e938c10d59247b256 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
|
||||||
@@ -1813,8 +1813,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -1794,8 +1794,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
resource = CraftNamespacedKey.fromMinecraft(key);
|
resource = CraftNamespacedKey.fromMinecraft(key);
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
@ -6,18 +6,19 @@ 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 272095d7a09ab41227d741172735f66fd2798ce1..757ae1773ba35c2348483dddbb231060afafc602 100644
|
index b8fb7b5a347298ada16bc8b818edf1863e3f6040..7ec912bfec20d6b5d91f23341c4e9e3188d1236b 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
|
||||||
@@ -139,7 +139,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -139,7 +139,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
@Override
|
@Override
|
||||||
public void remove(Entity.RemovalReason reason) {
|
public void remove(Entity.RemovalReason reason) {
|
||||||
if (!this.level().isClientSide && reason.shouldDestroy()) {
|
if (!this.level.isClientSide && reason.shouldDestroy()) {
|
||||||
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
- Containers.dropContents(this.level, (Entity) this, (Container) this);
|
||||||
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
||||||
+ try {
|
+ try {
|
||||||
+ Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
+ Containers.dropContents(this.level, (Entity) this, (Container) this);
|
||||||
+ } catch (Exception ignored) {}
|
+ } catch (Exception ignored) {
|
||||||
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
@ -5,10 +5,10 @@ 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 52196431a6538872755344859a0454a0e50c3b6e..2312881cdd925ec538fff3df7cdc7e04770453eb 100644
|
index f0ccdfbd7d7be8c6e302609accf8fe9cac8885c4..2dad46159fb1653aff0ecdd907535ac0c59deeed 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
|
||||||
@@ -425,11 +425,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
@@ -407,11 +407,15 @@ public class ItemEntity extends Entity {
|
||||||
|
|
||||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||||
|
|
@ -31,10 +31,10 @@ index b79f4ce38a42e4dba8ebdfc97dadc531b7245c7a..9c49be7c53a1f2a8c203341b8ded9cd2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||||
index 50fdb086ffec84edc5138737c95f08ed4757a6f3..da312b4670fc0ac07e4ab798d4793025e362783e 100644
|
index 50fdb086ffec84edc5138737c95f08ed4757a6f3..bb0f673a619810850df0d78bb4abd9d7c49ecbe4 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
|
||||||
@@ -41,7 +41,11 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
@@ -41,7 +41,12 @@ 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,7 +42,8 @@ index 50fdb086ffec84edc5138737c95f08ed4757a6f3..da312b4670fc0ac07e4ab798d4793025
|
|||||||
+ // 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
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Sun, 13 Mar 2022 21:56:29 -0600
|
Date: Sat, 10 Dec 2022 22:46:24 -0600
|
||||||
Subject: [PATCH] Validate BlockState and SoundEvent values
|
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
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
index efa800402413202d190926610d8264dfbf5019e7..1b3229128771adb85a7d007989891ef073a80278 100644
|
index c33a6d3d5700a7ec1dae2434d00cf0f480a5f0e5..1ccf1d22ac77b669fffd2a1bd7b1331cf0fa281a 100644
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
+++ b/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 {
|
@@ -234,7 +234,7 @@ public final class NbtUtils {
|
||||||
@ -18,7 +18,7 @@ index efa800402413202d190926610d8264dfbf5019e7..1b3229128771adb85a7d007989891ef0
|
|||||||
if (optional.isEmpty()) {
|
if (optional.isEmpty()) {
|
||||||
return Blocks.AIR.defaultBlockState();
|
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
|
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 fa885337085348308604e50049ecc5bb52023884..366f70bfe6559e4d43844473a2c080c3ec52a4fc 100644
|
index 9788e477ff1446ad2ea3669922cc7dfc09900ce8..809c9b9dfb29c8ce177ade8be980e1d8e94de31e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||||
@@ -541,7 +541,7 @@ public abstract class AbstractArrow extends Projectile {
|
@@ -541,7 +541,7 @@ public abstract class AbstractArrow extends Projectile {
|
@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Mon, 9 May 2022 23:40:59 -0500
|
||||||
|
Subject: [PATCH] Even more ResourceLocation validation and log spam fixes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
index 11a6f5b9e726453979d4c718c32a44024e1b8a08..c4810371c00eb92dc8574841c74a89203d586c78 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
@@ -422,7 +422,7 @@ public class AreaEffectCloud extends Entity {
|
||||||
|
try {
|
||||||
|
this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle")), (HolderLookup) BuiltInRegistries.PARTICLE_TYPE.asLookup()));
|
||||||
|
} catch (CommandSyntaxException commandsyntaxexception) {
|
||||||
|
- AreaEffectCloud.LOGGER.warn("Couldn't load custom particle {}", nbt.getString("Particle"), commandsyntaxexception);
|
||||||
|
+ // Scissors - Don't log custom particle errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||||
|
index e49eece9bff3a53469673d03a7bbf8f9cf8776b8..a49f32e9649155b6af4b1f236e4e8142d730e7e8 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
|
||||||
|
@@ -30,8 +30,14 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- ResourceLocation key = getSnapshot().lootTable;
|
||||||
|
- return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
||||||
|
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
||||||
|
+ try {
|
||||||
|
+ ResourceLocation key = getSnapshot().lootTable;
|
||||||
|
+ return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key));
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
index 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf11cf046fb 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
|
@@ -33,8 +33,14 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
||||||
|
return null; // return empty loot table?
|
||||||
|
}
|
||||||
|
|
||||||
|
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
||||||
|
- return Bukkit.getLootTable(key);
|
||||||
|
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
||||||
|
+ try {
|
||||||
|
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
|
||||||
|
+ return Bukkit.getLootTable(key);
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
index 620d918e302a00d5a6640648e3096988d15535a0..ac6831248b7c4f25d48391432afb613f25d7e23a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||||
|
@@ -80,8 +80,18 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LootTable getLootTable() {
|
||||||
|
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
||||||
|
- return Bukkit.getLootTable(key);
|
||||||
|
+ if (this.getHandle().lootTable == null) {
|
||||||
|
+ this.getHandle().lootTable = this.getHandle().getDefaultLootTable();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors start - Return a null loot table if the specified loot table is not valid
|
||||||
|
+ try {
|
||||||
|
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
|
||||||
|
+ return Bukkit.getLootTable(key);
|
||||||
|
+ } catch (Exception ex) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
@ -27,10 +27,10 @@ index c0633f9553fb5aa52e8ffc863159521d09cb3bd5..7449a024265c42f28a6c9a1ed8d8f4b9
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 759ecd79534a7706f7d4a63eb9dacbefcfe54674..9afda54ad70d446672749506822c6abd729b8f1b 100644
|
index 428523feaa4f30260e32ba03937e88200246c693..21e6053a62409784c175ea6cf1ada6b5557097a8 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
|
||||||
@@ -441,7 +441,7 @@ public class ItemFrame extends HangingEntity {
|
@@ -428,7 +428,7 @@ public class ItemFrame extends HangingEntity {
|
||||||
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
ItemStack itemstack = ItemStack.of(nbttagcompound1);
|
||||||
|
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 23:02:48 -0600
|
||||||
|
Subject: [PATCH] Even more resource location validation
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
index c4810371c00eb92dc8574841c74a89203d586c78..929f05c8692223959282f68bf68c4467e4167a80 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
|
||||||
|
@@ -145,7 +145,7 @@ public class AreaEffectCloud extends Entity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPotionType(String string) {
|
||||||
|
- this.setPotion(BuiltInRegistries.POTION.get(new ResourceLocation(string)));
|
||||||
|
+ this.setPotion(BuiltInRegistries.POTION.get(ResourceLocation.tryParse(string))); // Scissors - Validate resource locations
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
index 4589f7db68f7a72065c85c0a50216c6d02658f1e..5c23608e20e243eb844c73f713c39bf3e5ab05dd 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||||
|
@@ -580,7 +580,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
|
}), (entity) -> {
|
||||||
|
entity.load(nbt);
|
||||||
|
}, () -> {
|
||||||
|
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||||
|
+ /*EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));*/ // Scissors - Don't log invalid entities
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -599,7 +599,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Optional<EntityType<?>> by(CompoundTag nbt) {
|
||||||
|
- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
|
||||||
|
+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id")));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
index 49b983064ea810382b6112f5dc7f93ba4e5710bd..4dd32f38ebf06d868a37c8e4ae667ac14a774b8d 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
|
@@ -585,7 +585,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"));
|
||||||
|
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
|
||||||
|
}
|
||||||
|
|
@ -5,46 +5,45 @@ 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 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..bc5ed619e05f24f3ad50a6a81306d120869f57a1 100644
|
index bf42969859545a8a520923ef1836ffa4a5cc24a0..31d0624fcaf1998383eebde7fbd3a1033e6c80aa 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,11 +4,13 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
@@ -4,6 +4,8 @@ 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; // Scissors
|
+import io.papermc.paper.util.JarManifests;
|
||||||
|
+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;
|
@@ -16,11 +18,12 @@ import java.io.*;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import java.net.HttpURLConnection;
|
||||||
+import org.bukkit.Bukkit; // Scissors
|
import java.net.URL;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
import javax.annotation.Nonnull;
|
+import org.bukkit.Bukkit;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
@@ -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/paper";
|
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||||
+ private static final String GITHUB_BRANCH_NAME = getBranch(); // Scissors
|
+ private static final String GITHUB_BRANCH_NAME = getBranch();
|
||||||
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME; // Scissors
|
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME;
|
||||||
private static @Nullable String mcVer;
|
private static @Nullable String mcVer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -31,8 +33,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
@@ -31,8 +34,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
@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-Paper-".length()).split("[-\\s]");
|
||||||
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
|
||||||
+ String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]"); // Scissors
|
+ String[] parts = serverVersion.substring("git-Scissors-".length()).split("[-\\s]");
|
||||||
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]); // Scissors
|
+ final Component updateMessage = getUpdateStatusMessage("AtlasMediaGroup/Scissors", GITHUB_BRANCH_NAME, parts[0]);
|
||||||
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;
|
||||||
@@ -54,15 +56,24 @@ public class PaperVersionFetcher implements VersionFetcher {
|
@@ -54,15 +57,24 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||||
return mcVer;
|
return mcVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,14 +76,14 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..bc5ed619e05f24f3ad50a6a81306d120
|
|||||||
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
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 7c29d92362a82330440dff151bcf421f15c68f71..d1c8671ba5ca95c425e4c679445d55c4bbba217e 100644
|
index e072a5475a64d110f25ebcc871aa7703c2fc1e70..21db4153a9eb5e52ff357b4146ae4302029d5cd5 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -300,7 +300,7 @@ public class Main {
|
@@ -278,7 +278,7 @@ public class Main {
|
||||||
if (buildDate.before(deadline.getTime())) {
|
if (buildDate.before(deadline.getTime())) {
|
||||||
// Paper start - This is some stupid bullshit
|
// Paper start - This is some stupid bullshit
|
||||||
System.err.println("*** Warning, you've not updated in a while! ***");
|
System.err.println("*** Warning, you've not updated in a while! ***");
|
||||||
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
|
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads ***"); // Paper
|
||||||
+ System.err.println("*** Please download a new build from https://ci.scissors.gg/job/Scissors ***"); // Scissors > // 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 ***");
|
//System.err.println("*** Server will start in 20 seconds ***");
|
||||||
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
@ -1,173 +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 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();
|
|
@ -6,18 +6,18 @@ Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
index f9741039dada19391e80d9623f2d8cabc1089506..38238d9e6d464990caf10557997c6ca88ee100c0 100644
|
index 92be52c3d193878ef9a3ed0e938c10d59247b256..fe50f9a7771dd2085dc6f3f76d15b735961958a1 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
|
||||||
@@ -46,6 +46,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.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
+import net.minecraft.resources.ResourceLocation; // Scissors
|
+import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.apache.commons.lang3.EnumUtils;
|
import org.apache.commons.lang3.EnumUtils;
|
||||||
@@ -486,7 +487,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -482,7 +483,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
|
@ -0,0 +1,25 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Wed, 30 Mar 2022 02:01:55 -0600
|
||||||
|
Subject: [PATCH] Validate String UUIDs during the CompoundTag -> GameProfile
|
||||||
|
conversion process
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
index 1ccf1d22ac77b669fffd2a1bd7b1331cf0fa281a..6b31a32f9dac31b587693ed8001bf190786ceae8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
||||||
|
@@ -81,7 +81,12 @@ public final class NbtUtils {
|
||||||
|
}
|
||||||
|
// Paper start - support string UUID's
|
||||||
|
if (nbt.contains("Id", 8)) {
|
||||||
|
- uUID = UUID.fromString(nbt.getString("Id"));
|
||||||
|
+ // Scissors start - Validate String UUIDs in game profiles
|
||||||
|
+ try {
|
||||||
|
+ uUID = UUID.fromString(nbt.getString("Id"));
|
||||||
|
+ } catch (Exception ignored) {
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
@ -5,34 +5,23 @@ Subject: [PATCH] Don't query player data in the `nbt` component
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
index 8a6799b50062c1b7b141ee1568dc523f9ee7ecfd..80e7b0889235288b60d813a569daecb7e08e108e 100644
|
index 8a6799b50062c1b7b141ee1568dc523f9ee7ecfd..e5a2bb129100f0f935c8f10682204e7cb6277142 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -11,6 +11,7 @@ import net.minecraft.commands.arguments.selector.EntitySelector;
|
||||||
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.commands.arguments.selector.EntitySelectorParser;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
+import net.minecraft.world.entity.player.Player; // Scissors
|
+import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
|
||||||
public EntityDataSource(String rawPath) {
|
public EntityDataSource(String rawPath) {
|
||||||
@@ -31,7 +33,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
@@ -31,7 +32,7 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
|
||||||
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
|
||||||
if (this.compiledSelector != null) {
|
if (this.compiledSelector != null) {
|
||||||
List<? extends Entity> list = this.compiledSelector.findEntities(source);
|
List<? extends Entity> list = this.compiledSelector.findEntities(source);
|
||||||
- return list.stream().map(NbtPredicate::getEntityTagToCompare);
|
- return list.stream().map(NbtPredicate::getEntityTagToCompare);
|
||||||
+ // Scissors start
|
+ return list.stream().filter((entity) -> !(entity instanceof Player)).map(NbtPredicate::getEntityTagToCompare); // Scissors - Don't query NBT from players
|
||||||
+ Stream<? extends Entity> stream = list.stream();
|
|
||||||
+ if (ScissorsConfig.excludePlayersFromNbtComponents) stream = stream.filter((entity) -> !(entity instanceof Player));
|
|
||||||
+ return stream.map(NbtPredicate::getEntityTagToCompare);
|
|
||||||
+ // Scissors end
|
|
||||||
} else {
|
} else {
|
||||||
return Stream.empty();
|
return Stream.empty();
|
||||||
}
|
}
|
18
patches/server/0018-Limit-ListTags-to-1024-elements.patch
Normal file
18
patches/server/0018-Limit-ListTags-to-1024-elements.patch
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 8 Apr 2022 23:38:12 -0300
|
||||||
|
Subject: [PATCH] Limit ListTags to 1024 elements
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||||
|
index 749d3e67a877d7d1ed47b5fef511a604ee6589b6..fe7a7fd77c7dd1750144fb57e181c51ccda26329 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/ListTag.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
|
||||||
|
@@ -31,6 +31,7 @@ public class ListTag extends CollectionTag<Tag> {
|
||||||
|
list.add(tagType.load(dataInput, i + 1, nbtAccounter));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if(j > 1024) return new ListTag(Lists.newArrayListWithCapacity(0), b);
|
||||||
|
return new ListTag(list, b);
|
||||||
|
}
|
||||||
|
}
|
@ -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 53cc6befb752affcfec65e18365f6d369448d407..181f5aa262689617ff3ad766dae485c36b88c9aa 100644
|
index e708b2c987fac150c22b3367cec2e3e2bcb9914c..06872ee2d0eb9ea847568d328a95f60db7373be8 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
|
||||||
@@ -57,6 +57,7 @@ public class MobEffect {
|
@@ -59,6 +59,7 @@ public class MobEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
public void applyEffectTick(LivingEntity entity, int amplifier) {
|
||||||
@ -17,7 +17,7 @@ index 53cc6befb752affcfec65e18365f6d369448d407..181f5aa262689617ff3ad766dae485c3
|
|||||||
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
|
||||||
@@ -83,17 +84,31 @@ public class MobEffect {
|
@@ -87,17 +88,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 53cc6befb752affcfec65e18365f6d369448d407..181f5aa262689617ff3ad766dae485c3
|
|||||||
+ // 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())) {
|
||||||
+ // Scissors end
|
entity.hurt(DamageSource.MAGIC, (float) (6 << amplifier));
|
||||||
entity.hurt(entity.damageSources().magic(), (float) (6 << amplifier));
|
|
||||||
}
|
}
|
||||||
|
+ // Scissors end
|
||||||
} 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
|
@ -1,19 +1,19 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 18 Apr 2022 16:55:19 +0100
|
Date: Sat, 10 Dec 2022 23:23:52 -0600
|
||||||
Subject: [PATCH] Fix negative death times
|
Subject: [PATCH] Fix negative death times
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index e11d7283662834047b2ff81a2fd25a4263792deb..4bd7eea49a0720063db2a8ed10f53bd19e9499ad 100644
|
index 9e075de3542bda8ae086c9ca68bcd00b16d565d0..2012c147f60f39ae7dbae74641fd00b3b282a991 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -629,7 +629,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -622,7 +622,7 @@ public abstract class LivingEntity extends Entity {
|
||||||
|
|
||||||
protected void tickDeath() {
|
protected void tickDeath() {
|
||||||
++this.deathTime;
|
++this.deathTime;
|
||||||
- if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
- if (this.deathTime >= 20 && !this.level.isClientSide() && !this.isRemoved()) {
|
||||||
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved()) { // Scissors
|
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level.isClientSide() && !this.isRemoved()) {
|
||||||
this.level().broadcastEntityEvent(this, (byte) 60);
|
this.level.broadcastEntityEvent(this, (byte) 60);
|
||||||
this.remove(Entity.RemovalReason.KILLED);
|
this.remove(Entity.RemovalReason.KILLED);
|
||||||
}
|
}
|
@ -1,142 +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 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("{");
|
|
@ -41,10 +41,10 @@ index 0000000000000000000000000000000000000000..754b578b575137a9c48cb20dee965a93
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/NbtUtility.java b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/NbtUtility.java b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..b3efac47ee700d5a7ff26452d6bcbf2f687a32cf
|
index 0000000000000000000000000000000000000000..b724baaef8d565e41db1af6393d0890e919a5aa8
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
+++ b/src/main/java/me/totalfreedom/scissors/NbtUtility.java
|
||||||
@@ -0,0 +1,75 @@
|
@@ -0,0 +1,74 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+import java.nio.charset.StandardCharsets;
|
+import java.nio.charset.StandardCharsets;
|
||||||
@ -75,7 +75,6 @@ index 0000000000000000000000000000000000000000..b3efac47ee700d5a7ff26452d6bcbf2f
|
|||||||
+ CompoundTag compoundTag = (CompoundTag) tag;
|
+ CompoundTag compoundTag = (CompoundTag) tag;
|
||||||
+ for (String key : compoundTag.getAllKeys())
|
+ for (String key : compoundTag.getAllKeys())
|
||||||
+ {
|
+ {
|
||||||
+ size += key.getBytes(StandardCharsets.UTF_8).length;
|
|
||||||
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -122,10 +121,10 @@ index 0000000000000000000000000000000000000000..b3efac47ee700d5a7ff26452d6bcbf2f
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/PositionUtility.java b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/PositionUtility.java b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..c5dcc833d6f2c0daa1d0c2a7ab81430f25e0b2f3
|
index 0000000000000000000000000000000000000000..9e33ad84e50c7e2491aa883f905323f3ad2b070c
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
+++ b/src/main/java/me/totalfreedom/scissors/PositionUtility.java
|
||||||
@@ -0,0 +1,53 @@
|
@@ -0,0 +1,83 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+import net.minecraft.core.BlockPos;
|
+import net.minecraft.core.BlockPos;
|
||||||
@ -136,6 +135,36 @@ index 0000000000000000000000000000000000000000..c5dcc833d6f2c0daa1d0c2a7ab81430f
|
|||||||
+
|
+
|
||||||
+public class PositionUtility
|
+public class PositionUtility
|
||||||
+{
|
+{
|
||||||
|
+ public static Vec3 getValidVec3(double x, double y, double z, Entity entity)
|
||||||
|
+ {
|
||||||
|
+ final Level level = entity.level;
|
||||||
|
+
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ if (level.isInWorldBounds(new BlockPos(Math.floor(MathUtility.safeDoubleToInt(x)), Math.floor(MathUtility.safeDoubleToInt(y)), Math.floor(MathUtility.safeDoubleToInt(z)))))
|
||||||
|
+ {
|
||||||
|
+ return new Vec3(x, y, z);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ final WorldBorder worldBorder = level.getWorldBorder();
|
||||||
|
+
|
||||||
|
+ final double maxX = worldBorder.getMaxX();
|
||||||
|
+ final double maxY = level.getMaxBuildHeight();
|
||||||
|
+ final double maxZ = worldBorder.getMaxZ();
|
||||||
|
+
|
||||||
|
+ final double minX = worldBorder.getMinX();
|
||||||
|
+ final double minY = level.getMinBuildHeight();
|
||||||
|
+ final double minZ = worldBorder.getMinZ();
|
||||||
|
+
|
||||||
|
+ return new Vec3(MathUtility.clampDouble(x, minX, maxX), MathUtility.clampDouble(y, minY, maxY), MathUtility.clampDouble(z, minZ, maxZ));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ catch (Exception e)
|
||||||
|
+ { // If we throw some sort of exception due to the position being crazy, catch it
|
||||||
|
+ return new Vec3(0, 0, 0);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
+ public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
||||||
+ {
|
+ {
|
||||||
@ -146,7 +175,7 @@ index 0000000000000000000000000000000000000000..c5dcc833d6f2c0daa1d0c2a7ab81430f
|
|||||||
+
|
+
|
||||||
+ public static BlockPos getValidBlockPos(BlockPos blockPos, Entity entity)
|
+ public static BlockPos getValidBlockPos(BlockPos blockPos, Entity entity)
|
||||||
+ {
|
+ {
|
||||||
+ final Level level = entity.level();
|
+ final Level level = entity.level;
|
||||||
+
|
+
|
||||||
+ try
|
+ try
|
||||||
+ {
|
+ {
|
@ -0,0 +1,64 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Wed, 27 Jul 2022 22:30:39 -0500
|
||||||
|
Subject: [PATCH] Validate coordinates before attempting to get block entities
|
||||||
|
when handling Creative Inventory packets
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 9b0b42add71172bd154226e51d62cebd8de3542e..9e093d3001a57b577a7c93d8b721235617656e15 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1922,6 +1922,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
}
|
||||||
|
// Spigot end
|
||||||
|
|
||||||
|
+ // Scissors start - Readd the following Paper code
|
||||||
|
+ // Paper start
|
||||||
|
+ private static final int SURVIVAL_PLACE_DISTANCE_SQUARED = 6 * 6;
|
||||||
|
+ private static final int CREATIVE_PLACE_DISTANCE_SQUARED = 7 * 7;
|
||||||
|
+ private boolean isOutsideOfReach(double x, double y, double z) {
|
||||||
|
+ Location eyeLoc = this.getCraftPlayer().getEyeLocation();
|
||||||
|
+ double reachDistance = org.bukkit.util.NumberConversions.square(eyeLoc.getX() - x) + org.bukkit.util.NumberConversions.square(eyeLoc.getY() - y) + org.bukkit.util.NumberConversions.square(eyeLoc.getZ() - z);
|
||||||
|
+ return reachDistance > (this.getCraftPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void handleUseItemOn(ServerboundUseItemOnPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
@@ -3314,17 +3326,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
|
||||||
|
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
|
||||||
|
|
||||||
|
- if (this.player.level.isLoaded(blockposition)) {
|
||||||
|
- // Paper start
|
||||||
|
- BlockEntity tileentity = null;
|
||||||
|
- if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) {
|
||||||
|
- tileentity = this.player.level.getBlockEntity(blockposition);
|
||||||
|
- }
|
||||||
|
- // Paper end
|
||||||
|
+ if (this.player.level.isLoaded(blockposition))
|
||||||
|
+ {
|
||||||
|
+ // Scissors start - Validate coordinates and whether the player can reach them
|
||||||
|
+ if (Level.isInSpawnableBounds(blockposition) && !isOutsideOfReach(blockposition.getX(), blockposition.getY(), blockposition.getZ()))
|
||||||
|
+ {
|
||||||
|
+ BlockEntity tileentity = null;
|
||||||
|
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition))
|
||||||
|
+ {
|
||||||
|
+ tileentity = this.player.level.getBlockEntity(blockposition);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
|
||||||
|
- if (tileentity != null) {
|
||||||
|
- tileentity.saveToItem(itemstack);
|
||||||
|
+ if (tileentity != null)
|
||||||
|
+ {
|
||||||
|
+ tileentity.saveToItem(itemstack);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
54
patches/server/0023-Reset-large-tags.patch
Normal file
54
patches/server/0023-Reset-large-tags.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 10 Dec 2022 23:38:53 -0600
|
||||||
|
Subject: [PATCH] Reset large tags
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
index 6860096cb8c0deecc9c1d87543d1128fb95fd2d4..d7b02676c646db61a5351b72c1c929e8dd80795c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
|
@@ -20,6 +20,7 @@ import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
|
@@ -255,6 +256,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)) {
|
||||||
|
@@ -516,7 +523,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;
|
||||||
|
@@ -847,6 +858,9 @@ public final class ItemStack {
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
public void setTag(@Nullable CompoundTag nbt) {
|
||||||
|
+ // Scissors start - Ignore large tags
|
||||||
|
+ if (NbtUtility.isTooLarge(nbt)) return;
|
||||||
|
+ // Scissors end
|
||||||
|
this.tag = nbt;
|
||||||
|
this.processEnchantOrder(this.tag); // Paper
|
||||||
|
if (this.getItem().canBeDepleted()) {
|
@ -1,26 +1,27 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
Date: Mon, 18 Apr 2022 03:56:09 +0100
|
Date: Sat, 11 Jun 2022 23:33:13 -0500
|
||||||
Subject: [PATCH] Reset large tags
|
Subject: [PATCH] Account for items inside containers
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee14f6dfb7 100644
|
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..9e0ab51dd7a4f9fed8f9edde962d42d4bbf604c1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
+++ b/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;
|
@@ -2,6 +2,7 @@ package net.minecraft.world;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@@ -22,10 +23,12 @@ public class ContainerHelper {
|
@@ -22,10 +23,13 @@ public class ContainerHelper {
|
||||||
|
|
||||||
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
|
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
|
||||||
ListTag listTag = new ListTag();
|
ListTag listTag = new ListTag();
|
||||||
+ long total = 0; // Scissors
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
|
||||||
for(int i = 0; i < stacks.size(); ++i) {
|
for(int i = 0; i < stacks.size(); ++i) {
|
||||||
ItemStack itemStack = stacks.get(i);
|
ItemStack itemStack = stacks.get(i);
|
||||||
@ -29,7 +30,7 @@ index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee
|
|||||||
CompoundTag compoundTag = new CompoundTag();
|
CompoundTag compoundTag = new CompoundTag();
|
||||||
compoundTag.putByte("Slot", (byte)i);
|
compoundTag.putByte("Slot", (byte)i);
|
||||||
itemStack.save(compoundTag);
|
itemStack.save(compoundTag);
|
||||||
@@ -33,7 +36,7 @@ public class ContainerHelper {
|
@@ -33,7 +37,7 @@ public class ContainerHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,89 +39,42 @@ index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee
|
|||||||
nbt.put("Items", listTag);
|
nbt.put("Items", listTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,11 +45,19 @@ public class ContainerHelper {
|
@@ -42,11 +46,18 @@ public class ContainerHelper {
|
||||||
|
|
||||||
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
||||||
ListTag listTag = nbt.getList("Items", 10);
|
ListTag listTag = nbt.getList("Items", 10);
|
||||||
+ long total = 0; // Scissors - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
|
||||||
for(int i = 0; i < listTag.size(); ++i) {
|
for(int i = 0; i < listTag.size(); ++i) {
|
||||||
CompoundTag compoundTag = listTag.getCompound(i);
|
CompoundTag compoundTag = listTag.getCompound(i);
|
||||||
int j = compoundTag.getByte("Slot") & 255;
|
int j = compoundTag.getByte("Slot") & 255;
|
||||||
if (j >= 0 && j < stacks.size()) {
|
if (j >= 0 && j < stacks.size()) {
|
||||||
+ // Scissors start
|
|
||||||
+ total += NbtUtility.getTagSize(compoundTag);
|
+ total += NbtUtility.getTagSize(compoundTag);
|
||||||
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ stacks.clear();
|
+ stacks.clear();
|
||||||
+ break;
|
+ break;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
stacks.set(j, ItemStack.of(compoundTag));
|
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 d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..8c5fe0166a5442a2fa4f212d7c53343c937f53f1 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
|
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
|
index cac2768fe520b591990c7bc943ae7e95f49efb31..f734cba350ed85dbbf52ff527c9bb14b9eb04c86 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
+++ b/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;
|
@@ -9,6 +9,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -212,6 +213,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
@@ -211,6 +212,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||||
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.items) {
|
+ for (ItemStack item : this.items) {
|
||||||
@ -130,26 +84,25 @@ index 40e59b8db83aec1143e3c394427e916beea7c01f..f292aa0016e6f741b36ddc1417f6f63d
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.items.clear();
|
+ this.items.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
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
|
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
|
index 416aa989ebb18a8741cc9d605a1180ab830f6643..893cf89dd2b022e2b785318e7e86eb5d75be8ed8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||||
+++ b/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 @@
|
@@ -1,5 +1,6 @@
|
||||||
package net.minecraft.world.level.block.entity;
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
@@ -34,6 +35,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
@@ -34,6 +35,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.items) {
|
+ for (ItemStack item : this.items) {
|
||||||
@ -159,27 +112,26 @@ index 416aa989ebb18a8741cc9d605a1180ab830f6643..a9a8c9e68e5b767dec2c26495685da88
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.items.clear();
|
+ this.items.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
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
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
index c57efcb9a79337ec791e4e8f6671612f0a82b441..2cbb8170953cb555411db8c171a3d1d91eb799bb 100644
|
index 0bab2693b91d5bab222c7db8bc6965ccde954003..4a02d8f4d99d2d0e6cac4e40cd0e6350d03c0cd0 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
+++ b/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;
|
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
@@ -73,6 +74,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
@@ -72,6 +73,16 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.items) {
|
+ for (ItemStack item : this.items) {
|
||||||
@ -189,26 +141,25 @@ index c57efcb9a79337ec791e4e8f6671612f0a82b441..2cbb8170953cb555411db8c171a3d1d9
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.items.clear();
|
+ this.items.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
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
|
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
|
index a71414397bd45ee7bcacfeef0041d80dfa25f114..1b6f91055eb01627761e83e5e99e1731029b32ab 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||||
+++ b/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 @@
|
@@ -1,5 +1,6 @@
|
||||||
package net.minecraft.world.level.block.entity;
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
@@ -40,6 +41,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
@@ -40,6 +41,16 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||||
private int maxStack = MAX_STACK;
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.items) {
|
+ for (ItemStack item : this.items) {
|
||||||
@ -218,26 +169,25 @@ index a71414397bd45ee7bcacfeef0041d80dfa25f114..f51abf1722e98d7ce9e616d84472d847
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.items.clear();
|
+ this.items.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
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
|
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
|
index 881379681c39230a00b3a1f11cd87498984396c7..1be5d600573f7632e6630224530dd76522e1b191 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||||
+++ b/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 @@
|
@@ -1,5 +1,6 @@
|
||||||
package net.minecraft.world.level.block.entity;
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@@ -28,6 +29,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
@@ -28,6 +29,16 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
private int maxStack = MAX_STACK;
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.items) {
|
+ for (ItemStack item : this.items) {
|
||||||
@ -247,27 +197,26 @@ index 881379681c39230a00b3a1f11cd87498984396c7..d0513b72cdaec3b67b9341d251367b19
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.items.clear();
|
+ this.items.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
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
|
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 b11f51762ca289d99eaa49e66e31e58595bcea4e..06adfdc61f1064c1ec0db34632a8740fc09a1782 100644
|
index d76603c4172aa10889949c6c2acff05fee02a13d..b82fde14db232e63748dddd74d85f5a41359ae41 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
+++ b/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;
|
@@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
@@ -56,6 +57,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -54,6 +55,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
private int maxStack = MAX_STACK;
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.items) {
|
+ for (ItemStack item : this.items) {
|
||||||
@ -277,27 +226,26 @@ index b11f51762ca289d99eaa49e66e31e58595bcea4e..06adfdc61f1064c1ec0db34632a8740f
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.items.clear();
|
+ this.items.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.items;
|
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
|
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
|
index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..c2904048625bb4439c7f0ba8a2605d3194b66070 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||||
+++ b/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;
|
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import me.totalfreedom.scissors.NbtUtility; // Scissors
|
+import me.totalfreedom.scissors.NbtUtility;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
@@ -60,6 +61,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
@@ -60,6 +61,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||||
public boolean opened;
|
public boolean opened;
|
||||||
|
|
||||||
public List<ItemStack> getContents() {
|
public List<ItemStack> getContents() {
|
||||||
+ // Scissors start - Account for items inside containers
|
+ // Scissors - Account for items inside containers
|
||||||
+ long total = 0;
|
+ long total = 0;
|
||||||
+
|
+
|
||||||
+ for (ItemStack item : this.itemStacks) {
|
+ for (ItemStack item : this.itemStacks) {
|
||||||
@ -307,7 +255,6 @@ index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..db3a4a8cd19da9775bb0884c33494f1e
|
|||||||
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
+ this.itemStacks.clear();
|
+ this.itemStacks.clear();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
return this.itemStacks;
|
return this.itemStacks;
|
||||||
}
|
}
|
||||||
|
|
@ -1,23 +1,23 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Thu, 21 Apr 2022 13:52:32 +0100
|
Date: Sat, 10 Dec 2022 23:44:05 -0600
|
||||||
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
||||||
vehicles if they collide with more than 15 other entities
|
vehicles if they collide with more than 15 other entities
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
index 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce032ece6b 100644
|
index eec7d7a5b558830111831792c42665724613af23..79f296388a7f86944f33b9a783ab81b3a9e4d4dc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
@@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair;
|
@@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
+import java.util.concurrent.TimeUnit; // Scissors
|
+import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.BlockUtil;
|
import net.minecraft.BlockUtil;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
@@ -107,6 +108,7 @@ public abstract class AbstractMinecart extends Entity {
|
@@ -105,6 +106,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
|
private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
private double flyingY = 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 double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
@ -25,47 +25,49 @@ index 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce
|
|||||||
public double maxSpeed = 0.4D;
|
public double maxSpeed = 0.4D;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@@ -434,8 +436,10 @@ public abstract class AbstractMinecart extends Entity {
|
@@ -431,8 +433,10 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
|
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
|
||||||
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||||
|
|
||||||
- if (!list.isEmpty()) {
|
- if (!list.isEmpty()) {
|
||||||
- for (int l = 0; l < list.size(); ++l) {
|
- for (int l = 0; l < list.size(); ++l) {
|
||||||
+ // Scissors start
|
+ // Scissors - Add a collision debounce
|
||||||
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
|
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||||
+ for (int l = 0; l < Math.min(3, list.size()); ++l) {
|
+ for (int l = 0; l < Math.min(3, list.size()); ++l) {
|
||||||
+ // Scissors end
|
|
||||||
Entity entity = (Entity) list.get(l);
|
Entity entity = (Entity) list.get(l);
|
||||||
|
|
||||||
if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) {
|
if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) {
|
||||||
@@ -462,6 +466,14 @@ public abstract class AbstractMinecart extends Entity {
|
@@ -459,6 +463,16 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
entity.push(this);
|
entity.push(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Scissors start - Add a collision debounce
|
+ // Scissors - Add a collision debounce
|
||||||
+ if (list.size() > 15) {
|
+ if (list.size() > 3) {
|
||||||
+ this.discard();
|
|
||||||
+ } else if (list.size() > 3) {
|
|
||||||
+ lastLargeCollision = System.currentTimeMillis();
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+
|
||||||
|
+ // Scissors - Delete entity if the collision amount is over 15
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Iterator iterator = this.level().getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
|
Iterator iterator = this.level.getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
index 35aeba4e8430e6419caa9db4a0b931a994228618..289eb39b15a283b0d9dbc33823f3a73f87202907 100644
|
index 85e1892866cd2ee0cec1552b8541c1f800bdf68c..2950f60e068cbeb945cfe38972eaf65b79e3a4f1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
|
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.IntFunction;
|
import java.util.function.IntFunction;
|
||||||
+import java.util.concurrent.TimeUnit; // Scissors
|
+import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.BlockUtil;
|
import net.minecraft.BlockUtil;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -109,6 +110,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
@@ -108,6 +109,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
public double unoccupiedDeceleration = -1;
|
public double unoccupiedDeceleration = -1;
|
||||||
public boolean landBoats = false;
|
public boolean landBoats = false;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -73,31 +75,35 @@ index 35aeba4e8430e6419caa9db4a0b931a994228618..289eb39b15a283b0d9dbc33823f3a73f
|
|||||||
|
|
||||||
public Boat(EntityType<? extends Boat> type, Level world) {
|
public Boat(EntityType<? extends Boat> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
@@ -421,10 +423,10 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
@@ -417,10 +419,12 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
this.checkInsideBlocks();
|
this.checkInsideBlocks();
|
||||||
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||||
|
|
||||||
- if (!list.isEmpty()) {
|
- if (!list.isEmpty()) {
|
||||||
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Scissors - add collision debounce, using TimeUnit for better code readability
|
+ // Scissors - Add collision debounce
|
||||||
boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player);
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
|
boolean flag = !this.level.isClientSide && !(this.getControllingPassenger() instanceof Player);
|
||||||
|
|
||||||
- for (int j = 0; j < list.size(); ++j) {
|
- 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
|
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||||
|
+ for (int j = 0; j < Math.min(3, list.size()); ++j) {
|
||||||
Entity entity = (Entity) list.get(j);
|
Entity entity = (Entity) list.get(j);
|
||||||
|
|
||||||
if (!entity.hasPassenger((Entity) this)) {
|
if (!entity.hasPassenger((Entity) this)) {
|
||||||
@@ -435,6 +437,14 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
@@ -431,6 +435,16 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Scissors start - Add collision debounce
|
+ // Scissors - Add collision debounce
|
||||||
+ if (list.size() > 15) {
|
+ if (list.size() > 3) {
|
||||||
+ this.discard();
|
|
||||||
+ } else if (list.size() > 3) {
|
|
||||||
+ lastLargeCollision = System.currentTimeMillis();
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+
|
||||||
|
+ // Scissors - Delete entity if the collision amount is over 15
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,15 +5,17 @@ Subject: [PATCH] Don't log invalid teams to console
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 4bd7eea49a0720063db2a8ed10f53bd19e9499ad..953c2702880b358c0da4b8117c77b76bae849271 100644
|
index 2012c147f60f39ae7dbae74641fd00b3b282a991..d828b838216083192d9a344ca978f6a7360e0363 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -861,7 +861,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -850,7 +850,9 @@ public abstract class LivingEntity extends Entity {
|
||||||
boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
- LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
- LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
||||||
+ // Scissors - Prevent log spam possible with this error message, easily provokable by players in creative.
|
+ // Scissors start - Prevent log spam possible with this error message, easily provokable by players in creative.
|
||||||
|
+ // LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
||||||
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,41 +1,22 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 28 Mar 2022 13:19:43 -0600
|
Date: Sat, 10 Dec 2022 23:48:28 -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 c69088a2ec374b2d236fec61e267f42afa2967b1..7ca1ece926b0ef4598d4fa913b96d1e7a0e5bba4 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
|
||||||
@@ -559,13 +559,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 37fc353c3e59dd5af2fd6c58ac084fb0e6e155d7..2873ed7c443ed8c8c57a8b1d3e444d229f10f07b 100644
|
index 3ca733528acb40354b308019a84436ea67e05751..76932c683153c7dcbf46de78cccc14772babc5fc 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
|
||||||
@@ -26,6 +26,7 @@ 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.network.chat.contents.BlockDataSource;
|
import net.minecraft.network.chat.contents.BlockDataSource;
|
||||||
import net.minecraft.network.chat.contents.DataSource;
|
import net.minecraft.network.chat.contents.DataSource;
|
||||||
@@ -522,6 +523,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
@@ -506,6 +507,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
return GsonHelper.toStableString(Serializer.toJsonTree(text));
|
return GsonHelper.toStableString(Serializer.toJsonTree(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,18 +84,18 @@ index 7449a024265c42f28a6c9a1ed8d8f4b9e3096aac..487c68abc3eb5c18dc7fee762b216400
|
|||||||
// Scissors start
|
// Scissors start
|
||||||
UUID uUID;
|
UUID uUID;
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
index 97a2657bc98d41c3c1e376b266d2c85f685acc88..9d20f3f1af8e663a8c13714c8928d4a91653daa4 100644
|
index 97a2657bc98d41c3c1e376b266d2c85f685acc88..7b6476455e095eed15c92797ce3a3e1146dbdc3f 100644
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
|
||||||
@@ -8,6 +8,7 @@ import java.util.Optional;
|
@@ -8,6 +8,7 @@ import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import net.kyori.adventure.text.TextComponent; // Scissors
|
+import net.kyori.adventure.text.TextComponent;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.arguments.NbtPathArgument;
|
import net.minecraft.commands.arguments.NbtPathArgument;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
@@ -107,10 +108,10 @@ public class NbtContents implements ComponentContents {
|
@@ -107,10 +108,11 @@ public class NbtContents implements ComponentContents {
|
||||||
Component component = DataFixUtils.orElse(ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR);
|
Component component = DataFixUtils.orElse(ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR);
|
||||||
return stream.flatMap((text) -> {
|
return stream.flatMap((text) -> {
|
||||||
try {
|
try {
|
||||||
@ -124,14 +105,15 @@ index 97a2657bc98d41c3c1e376b266d2c85f685acc88..9d20f3f1af8e663a8c13714c8928d4a9
|
|||||||
} 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
|
+ // Scissors - don't log
|
||||||
|
+ // LOGGER.warn("Failed to parse component: {}", text, var5);
|
||||||
return Stream.of();
|
return Stream.of();
|
||||||
}
|
}
|
||||||
}).reduce((accumulator, current) -> {
|
}).reduce((accumulator, current) -> {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index e8485fb900b25e911a858678a833852731cb2ace..842f8af14b2bd694a48ee6573d98e6cfcf910e16 100644
|
index 7555b04dcf274bb624b89f2eb9ff80da0056de4e..f052ebb7758017dabc7e336898065231a6e4e4fb 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
|
||||||
@@ -2487,12 +2487,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
@@ -2340,12 +2340,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");
|
||||||
@ -145,6 +127,32 @@ index e8485fb900b25e911a858678a833852731cb2ace..842f8af14b2bd694a48ee6573d98e6cf
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 928625b5ab054ffa412be8a438f58291cc7a3cc0..54e74f39c960daa1f7ebd1d435281b5cc93e59c0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
@@ -410,7 +410,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
|
this.levels = nbt.getInt("Levels"); // SPIGOT-5053, use where available
|
||||||
|
// CraftBukkit end
|
||||||
|
if (nbt.contains("CustomName", 8)) {
|
||||||
|
- this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException
|
||||||
|
+ this.name = Component.Serializer.fromJsonSafe(nbt.getString("CustomName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lockKey = LockCode.fromTag(nbt);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||||
|
index 65e1381bb2d10bd212463feb602c60f8fdb9ade1..3e23451066894ebd88cad7022970cb2c0e9b75db 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
||||||
|
@@ -42,7 +42,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
||||||
|
public void load(CompoundTag nbt) {
|
||||||
|
super.load(nbt);
|
||||||
|
if (nbt.contains("CustomName", 8)) {
|
||||||
|
- this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException
|
||||||
|
+ this.name = Component.Serializer.fromJsonSafe(nbt.getString("CustomName")); // Scissors - Use safer method for getting Components from JSON
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
||||||
index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1a2417616 100644
|
index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1a2417616 100644
|
||||||
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
|
@ -1,32 +1,35 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Mon, 28 Mar 2022 16:49:17 -0600
|
Date: Fri, 25 Nov 2022 22:25:24 -0600
|
||||||
Subject: [PATCH] Reject oversized components from updating
|
Subject: [PATCH] Reject oversized components from updating
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
|
||||||
index 584a58659fae6ba3d8b53858890bc6ec509ffb0e..54a7dae26854d320d9e53f63eb411a85a2d78159 100644
|
index 9d0d5a44c5948bde037165147d18aaabe21ce50a..c42b8b4daa1ffa6f3ae89b35056edbf61ae47283 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
|
||||||
@@ -39,8 +39,9 @@ public class ComponentUtils {
|
@@ -39,8 +39,10 @@ public class ComponentUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
||||||
+ MutableComponent result; // Scissors
|
+ // Scissors start - Reject oversized components
|
||||||
|
+ MutableComponent result;
|
||||||
if (depth > 100) {
|
if (depth > 100) {
|
||||||
- return text.copy();
|
- return text.copy();
|
||||||
+ result = text.copy(); // Scissors
|
+ result = text.copy();
|
||||||
} else {
|
} else {
|
||||||
// Paper start
|
// Paper start
|
||||||
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
|
||||||
@@ -53,8 +54,9 @@ public class ComponentUtils {
|
@@ -53,8 +55,11 @@ public class ComponentUtils {
|
||||||
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
mutableComponent.append(updateForEntity(source, component, sender, depth + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
- return mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||||
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth)); // Scissors
|
+ result = mutableComponent.withStyle(resolveStyle(source, text.getStyle(), sender, depth));
|
||||||
}
|
}
|
||||||
+ 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 ? Component.empty() : result;
|
||||||
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
private static Style resolveStyle(@Nullable CommandSourceStack source, Style style, @Nullable Entity sender, int depth) throws CommandSyntaxException {
|
193
patches/server/0029-Block-server-side-chunkbans.patch
Normal file
193
patches/server/0029-Block-server-side-chunkbans.patch
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: ayunami2000 <spwilliamsiam@gmail.com>
|
||||||
|
Date: Fri, 17 Jun 2022 15:28:43 -0500
|
||||||
|
Subject: [PATCH] Block server side chunkbans
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
index 5fce1177e7198d791d4ab1c64b394c5b1c145782..25d483a4792cf159ff691521cd32382d0f7fe931 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
@@ -6,9 +6,18 @@ import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
|
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||||
|
import java.io.IOException;
|
||||||
|
+import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.PacketFlow;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundMapItemDataPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||||
|
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
||||||
|
+import net.minecraft.world.item.ItemStack;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
||||||
|
@@ -41,30 +50,101 @@ 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);
|
||||||
|
+ // Scissors end
|
||||||
|
} else {
|
||||||
|
int k = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get().getId();
|
||||||
|
JvmProfiler.INSTANCE.onPacketSent(k, integer, channelHandlerContext.channel().remoteAddress(), j);
|
||||||
|
}
|
||||||
|
} catch (Throwable var10) {
|
||||||
|
- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var10); // Paper - Give proper error message
|
||||||
|
- if (packet.isSkippable()) {
|
||||||
|
- throw new SkipPacketException(var10);
|
||||||
|
- } else {
|
||||||
|
- throw var10;
|
||||||
|
- }
|
||||||
|
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ private static void noKicking(FriendlyByteBuf friendlyByteBuf, Packet packet, Integer integer, ChannelHandlerContext channelHandlerContext)
|
||||||
|
+ {
|
||||||
|
+ 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 ClientboundLevelChunkPacketData chunkPacket)
|
||||||
|
+ {
|
||||||
|
+ chunkPacket.clearNBT();
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundSetEntityDataPacket entityDataPacket)
|
||||||
|
+ {
|
||||||
|
+ friendlyByteBuf.writeVarInt(entityDataPacket.id());
|
||||||
|
+ 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)
|
||||||
|
+ {
|
||||||
|
+ 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();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ 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/ClientboundBlockEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java
|
||||||
|
index 3944852921335c78a04a9dc301882ab5b152b1ed..0d88828bc0bbd68328da4d0e7d3b880006d2c775 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,8 @@ public class ClientboundBlockEntityDataPacket implements Packet<ClientGamePacket
|
||||||
|
return create(blockEntity, BlockEntity::getUpdateTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) {
|
||||||
|
+ // Scissors - make this public
|
||||||
|
+ public ClientboundBlockEntityDataPacket(BlockPos pos, BlockEntityType<?> blockEntityType, CompoundTag nbt) {
|
||||||
|
this.pos = pos;
|
||||||
|
this.type = blockEntityType;
|
||||||
|
this.tag = nbt.isEmpty() ? null : nbt;
|
||||||
|
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..24e0f4ee1dc9b5a46ed063e087d4b7bcd2a7fe46 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,15 @@ 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/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
|
index f3fa2678796c33f3a408a02a1995ad117eac9169..c8dd976240aa4f640bb2d223d472f81fdd8dcf7c 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,14 @@ 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) {
|
@ -5,29 +5,34 @@ Subject: [PATCH] Add MasterBlockFireEvent
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
index 2e7c03b00bc941b86df6a7f1b2b188c9f0aede22..0ae03d3934ad7b2b38afa45a65c7753dcbe796d2 100644
|
index 2e7c03b00bc941b86df6a7f1b2b188c9f0aede22..333f9bcccbe9ecd88c1fd13e2956f69414d6e295 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
||||||
package net.minecraft.world.level.block;
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
@@ -25,6 +26,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
@@ -25,10 +26,10 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
+import org.bukkit.Location; // Scissors
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
|
+import org.bukkit.Location;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
-import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
@@ -117,6 +119,15 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
-
|
||||||
|
public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
@@ -117,6 +118,15 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - Add master block fire event
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
+
|
+
|
||||||
+ if (!event.callEvent())
|
+ if (!event.callEvent())
|
||||||
@ -39,31 +44,44 @@ index 2e7c03b00bc941b86df6a7f1b2b188c9f0aede22..0ae03d3934ad7b2b38afa45a65c7753d
|
|||||||
if (hasCommand) {
|
if (hasCommand) {
|
||||||
executor.performCommand(world);
|
executor.performCommand(world);
|
||||||
} else {
|
} else {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/StructureBlock.java b/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
index a3dac53b07618819b322b48339d850d80a1c55ba..4dd21b7ea247b3ced3d3ee6c67746cc6811d5bb8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
index 182e16c1d968707a11329150d71b7d01df6c6e52..8582a9369cffe0eebeb82a81fc413d0bf4ad28ed 100644
|
index 182e16c1d968707a11329150d71b7d01df6c6e52..fa5cade3f5f2fecc37cc065b96403d0a1c1a2553 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity;
|
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
+
|
||||||
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
@@ -17,6 +18,7 @@ import net.minecraft.world.level.block.JigsawBlock;
|
@@ -17,6 +19,7 @@ import net.minecraft.world.level.block.JigsawBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement;
|
import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement;
|
||||||
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
|
||||||
+import org.bukkit.Location; // Scissors
|
+import org.bukkit.Location;
|
||||||
|
|
||||||
public class JigsawBlockEntity extends BlockEntity {
|
public class JigsawBlockEntity extends BlockEntity {
|
||||||
public static final String TARGET = "target";
|
public static final String TARGET = "target";
|
||||||
@@ -107,6 +109,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
@@ -107,6 +110,16 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - Add master block fire event
|
||||||
+ final BlockPos pos = this.getBlockPos();
|
+ final BlockPos pos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
+
|
+
|
||||||
@ -77,31 +95,31 @@ index 182e16c1d968707a11329150d71b7d01df6c6e52..8582a9369cffe0eebeb82a81fc413d0b
|
|||||||
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
|
||||||
// Paper start - Replace getHolderOrThrow with a null check
|
// Paper start - Replace getHolderOrThrow with a null check
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616fd3f73eb 100644
|
index 9792bf3ee083f571f1f4089d30beb586839f5f6b..e9d584b0ca984f9b7c70f99e1665cdedecb710e1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
@@ -5,6 +5,8 @@ import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
|
+
|
||||||
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
import net.minecraft.ResourceLocationException;
|
import net.minecraft.ResourceLocationException;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -29,6 +30,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
@@ -29,6 +31,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||||
+import org.bukkit.Location; // Scissors
|
+import org.bukkit.Location;
|
||||||
|
|
||||||
public class StructureBlockEntity extends BlockEntity {
|
public class StructureBlockEntity extends BlockEntity {
|
||||||
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
||||||
@@ -264,7 +266,7 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -264,7 +267,6 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
BlockPos blockPos = this.getBlockPos();
|
BlockPos blockPos = this.getBlockPos();
|
||||||
- int i = 80;
|
- int i = 80;
|
||||||
+ // Scissors - Obfuscation fixes
|
|
||||||
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
||||||
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
||||||
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
||||||
@ -109,7 +127,7 @@ index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616
|
|||||||
|
|
||||||
public boolean saveStructure(boolean bl) {
|
public boolean saveStructure(boolean bl) {
|
||||||
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - Add master block fire event
|
||||||
+ final BlockPos pos = this.getBlockPos();
|
+ final BlockPos pos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
+
|
+
|
||||||
@ -126,7 +144,7 @@ index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616
|
|||||||
|
|
||||||
public boolean loadStructure(ServerLevel world, boolean bl) {
|
public boolean loadStructure(ServerLevel world, boolean bl) {
|
||||||
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - Add master block fire event
|
||||||
+ final BlockPos blockPos = this.getBlockPos();
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
+
|
+
|
||||||
@ -143,7 +161,7 @@ index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unloadStructure() {
|
public void unloadStructure() {
|
||||||
+ // Scissors start - Add master block fire event
|
+ // Scissors - Add master block fire event
|
||||||
+ final BlockPos blockPos = this.getBlockPos();
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
+
|
+
|
@ -5,17 +5,17 @@ Subject: [PATCH] Add spectator teleport event
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index 3c0651fa5a5db880202c9a3805a6455269c5f16d..d7ddd44fb9b571850515edc6ee2e6801092f6446 100644
|
index da47e84dffd3518b84eeeb80ab4f17073fed9a9c..028d41c22ec5d67434dc42926cd875fe576768ea 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
||||||
package net.minecraft.server.network;
|
package net.minecraft.server.network;
|
||||||
|
|
||||||
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
|
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.primitives.Floats;
|
import com.google.common.primitives.Floats;
|
||||||
import com.mojang.brigadier.ParseResults;
|
import com.mojang.brigadier.ParseResults;
|
||||||
@@ -2113,6 +2114,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -2068,6 +2069,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
Entity entity = packet.getEntity(worldserver);
|
Entity entity = packet.getEntity(worldserver);
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
@ -5,18 +5,27 @@ Subject: [PATCH] Prevent invalid container events
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index bf7cf2108c0273552a41a9734dfd66b6a68a24d4..1c102fa91711ed595626633e127c89a83ed6b6c5 100644
|
index c8760e58589cd574e9debd29f7e728b482ec1daf..f780dc437741db42da07241c94f1458aa2654cb1 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -30,6 +30,7 @@ import java.util.function.UnaryOperator;
|
@@ -29,6 +29,8 @@ import java.util.function.UnaryOperator;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import net.kyori.adventure.text.format.NamedTextColor; // Scissors
|
+
|
||||||
|
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.CrashReport;
|
import net.minecraft.CrashReport;
|
||||||
import net.minecraft.CrashReportCategory;
|
import net.minecraft.CrashReportCategory;
|
||||||
@@ -3037,6 +3038,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
@@ -2956,6 +2958,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
public void handleContainerClick(ServerboundContainerClickPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
if (this.player.isImmobile()) return; // CraftBukkit
|
||||||
|
+
|
||||||
|
this.player.resetLastActionTime();
|
||||||
|
if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit
|
||||||
|
boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
|
||||||
|
@@ -2977,6 +2980,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
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 3c4825e295eefc7fcd628ba804fcc7dd5f160f28..280ebeee9bfae3059b6681873fa5633a9e929161 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -1376,7 +1376,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));
|
|
||||||
@@ -1388,7 +1388,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,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 02:55:33 +0100
|
||||||
|
Subject: [PATCH] Do not attempt to cast items to recipes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
index f734cba350ed85dbbf52ff527c9bb14b9eb04c86..68912cc2bd670944465e6819d82c4aad6b7b324a 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
|
||||||
|
@@ -642,6 +642,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||||
|
Entry<ResourceLocation> entry = (Entry) objectiterator.next();
|
||||||
|
|
||||||
|
worldserver.getRecipeManager().byKey((ResourceLocation) entry.getKey()).ifPresent((irecipe) -> {
|
||||||
|
+ // Scissors start - Do not attempt to cast items to recipes
|
||||||
|
+ if (!(irecipe instanceof AbstractCookingRecipe))
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
list.add(irecipe);
|
||||||
|
AbstractFurnaceBlockEntity.createExperience(worldserver, vec3d, entry.getIntValue(), ((AbstractCookingRecipe) irecipe).getExperience(), blockposition, entityplayer, itemstack, amount); // CraftBukkit
|
||||||
|
});
|
@ -1,67 +0,0 @@
|
|||||||
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 38cde466714e5663cd416b6afd5d2558e139ec09..ed48eaae75e709361a260421934b6b925ae9b427 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Allink <arclicious@vivaldi.net>
|
From: Allink <arclicious@vivaldi.net>
|
||||||
Date: Sun, 10 Jul 2022 10:12:04 +0100
|
Date: Sun, 10 Jul 2022 10:15:20 +0100
|
||||||
Subject: [PATCH] Add Scissors configuration file & command
|
Subject: [PATCH] Add Scissors configuration file & command
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..f83b2c4298bd1a5f65487f64bd6a11fb190a622d 100644
|
index 06bff37e4c1fddd3be6343049a66787c63fb420c..1c1cb20190e8edb7f55a60fc662c28e204690223 100644
|
||||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
@@ -25,6 +25,7 @@ package co.aikar.timings;
|
@@ -25,6 +25,7 @@ package co.aikar.timings;
|
||||||
@ -16,7 +16,7 @@ index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..f83b2c4298bd1a5f65487f64bd6a11fb
|
|||||||
import net.kyori.adventure.text.event.ClickEvent;
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
@@ -242,7 +243,8 @@ public class TimingsExport extends Thread {
|
@@ -241,7 +242,8 @@ public class TimingsExport extends Thread {
|
||||||
parent.put("config", createObject(
|
parent.put("config", createObject(
|
||||||
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
||||||
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
||||||
@ -184,10 +184,10 @@ index 0000000000000000000000000000000000000000..797677d892d83cf54d9a60af1e277b67
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b025b3c52
|
index 0000000000000000000000000000000000000000..b14ecf820880dca72f55cadfba337f725eaeb464
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
@@ -0,0 +1,225 @@
|
@@ -0,0 +1,199 @@
|
||||||
+package me.totalfreedom.scissors;
|
+package me.totalfreedom.scissors;
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
@ -226,7 +226,7 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b
|
|||||||
+
|
+
|
||||||
+ Discord: https://discord.com/invite/mtVQcHn58h
|
+ Discord: https://discord.com/invite/mtVQcHn58h
|
||||||
+ Website: https://scissors.gg/\s
|
+ Website: https://scissors.gg/\s
|
||||||
+ Docs: https://javadoc.scissors.gg/1.20.1/\s
|
+ Docs: https://scissors.gg/javadoc/1.19.3/\s
|
||||||
+ """;
|
+ """;
|
||||||
+ private static final Pattern SPACE = Pattern.compile(" ");
|
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||||
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||||
@ -277,8 +277,8 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b
|
|||||||
+ config.options().header(HEADER);
|
+ config.options().header(HEADER);
|
||||||
+ config.options().copyDefaults(true);
|
+ config.options().copyDefaults(true);
|
||||||
+
|
+
|
||||||
+ version = getInt("config-version", 5);
|
+ version = getInt("config-version", 1);
|
||||||
+ set("config-version", 5);
|
+ set("config-version", 1);
|
||||||
+ readConfig(ScissorsConfig.class, null);
|
+ readConfig(ScissorsConfig.class, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -341,36 +341,10 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b
|
|||||||
+
|
+
|
||||||
+ public static boolean runCommandsInBooks = false;
|
+ public static boolean runCommandsInBooks = false;
|
||||||
+
|
+
|
||||||
+ private static void runCommandsInBooks()
|
+ private static void runCommandsInBooks() {
|
||||||
+ {
|
|
||||||
+ runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
+ 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)
|
+ private static void set(String path, Object val)
|
||||||
+ {
|
+ {
|
||||||
+ config.set(path, val);
|
+ config.set(path, val);
|
||||||
@ -414,25 +388,26 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..641fe69cb2131413654c39a32a73c62e2bc092f6 100644
|
index 781b72fd88149642c9fceaecfbfe7546273fb749..7eb60d218a55cea6723955c8cad62af7acc10eb1 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -147,6 +147,7 @@ public class Main {
|
@@ -122,6 +122,7 @@ public class Main {
|
||||||
// Paper start - load config files for access below if needed
|
// Paper start - load config files for access below if needed
|
||||||
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
|
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
|
||||||
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
|
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
|
||||||
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors - TODO Change this
|
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors - TODO Change this
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
if (optionset.has("initSettings")) { // CraftBukkit
|
Path path1 = Paths.get("eula.txt");
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index c49802c936ae8e3f4dc1badd98414d96714ecd60..c9725f2df7a66eba3d5994a2b4b16b07ff0f696d 100644
|
index a7e133f3495e9132a5fdae2c24f225e7b026295a..d4f0d596d30ef20d70c9f86d33288c78bdb5e6a0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -221,7 +221,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
|
||||||
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||||
// Paper end
|
// Paper end
|
||||||
|
-
|
||||||
+ // Scissors start
|
+ // Scissors start
|
||||||
+ try {
|
+ try {
|
||||||
+ me.totalfreedom.scissors.ScissorsConfig.init((java.io.File) options.valueOf("scissors-settings"));
|
+ me.totalfreedom.scissors.ScissorsConfig.init((java.io.File) options.valueOf("scissors-settings"));
|
||||||
@ -442,23 +417,23 @@ index c49802c936ae8e3f4dc1badd98414d96714ecd60..c9725f2df7a66eba3d5994a2b4b16b07
|
|||||||
+ }
|
+ }
|
||||||
+ me.totalfreedom.scissors.ScissorsConfig.registerCommands();
|
+ me.totalfreedom.scissors.ScissorsConfig.registerCommands();
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
|
||||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||||
this.setMotd(dedicatedserverproperties.motd);
|
this.setMotd(dedicatedserverproperties.motd);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 26937b8dd0411b0c96e461c57eeee6ae8595211e..bf8ade78a771b0295811f48cba96aeb05a39524e 100644
|
index 3fa8a282e4511e79def2470f1abc34f3bf6527a3..1b75855eece59aa6d3a0e3999c66d220daf99ff2 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
|
||||||
@@ -1036,6 +1036,7 @@ public final class CraftServer implements Server {
|
@@ -960,6 +960,8 @@ public final class CraftServer implements Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||||
+ me.totalfreedom.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors
|
+ me.totalfreedom.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors
|
||||||
|
+
|
||||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||||
for (ServerLevel world : this.console.getAllLevels()) {
|
for (ServerLevel world : this.console.getAllLevels()) {
|
||||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
@@ -1067,6 +1068,7 @@ public final class CraftServer implements Server {
|
@@ -991,6 +993,7 @@ public final class CraftServer implements Server {
|
||||||
this.reloadData();
|
this.reloadData();
|
||||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||||
@ -466,26 +441,24 @@ index 26937b8dd0411b0c96e461c57eeee6ae8595211e..bf8ade78a771b0295811f48cba96aeb0
|
|||||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||||
|
|
||||||
@@ -2912,6 +2914,14 @@ public final class CraftServer implements Server {
|
@@ -2746,6 +2749,12 @@ public final class CraftServer implements Server {
|
||||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public YamlConfiguration getScissorsConfig()
|
+ public YamlConfiguration getScissorsConfig()
|
||||||
+ {
|
+ {
|
||||||
+ return me.totalfreedom.scissors.ScissorsConfig.config;
|
+ return me.totalfreedom.scissors.ScissorsConfig.config;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public void restart() {
|
public void restart() {
|
||||||
org.spigotmc.RestartCommand.restart();
|
org.spigotmc.RestartCommand.restart();
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index d1c8671ba5ca95c425e4c679445d55c4bbba217e..3be40632c70f5a7994ada3e61616dca632cef2da 100644
|
index a4bb8e91302e6dfdfa35a7d6a62c9e36a9043bcb..ebf71612ddc17074e7956cf6becbe81ba8c80e30 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -180,6 +180,20 @@ public class Main {
|
@@ -173,6 +173,22 @@ public class Main {
|
||||||
.defaultsTo("Unknown Server")
|
.defaultsTo("Unknown Server")
|
||||||
.describedAs("Name");
|
.describedAs("Name");
|
||||||
// Paper end
|
// Paper end
|
||||||
@ -496,12 +469,14 @@ index d1c8671ba5ca95c425e4c679445d55c4bbba217e..3be40632c70f5a7994ada3e61616dca6
|
|||||||
+ .ofType(File.class)
|
+ .ofType(File.class)
|
||||||
+ .defaultsTo(new File(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR))
|
+ .defaultsTo(new File(io.papermc.paper.configuration.PaperConfigurations.CONFIG_DIR))
|
||||||
+ .describedAs("Config directory");
|
+ .describedAs("Config directory");
|
||||||
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
+ acceptsAll(asList("scissors", "scissors-settings"), "File for Scissors settings")
|
+ // Scissors start
|
||||||
+ .withRequiredArg()
|
+ acceptsAll(asList("scissors", "scissors-settings"), "File for scissors settings")
|
||||||
+ .ofType(File.class)
|
+ .withRequiredArg()
|
||||||
+ .defaultsTo(new File("scissors.yml"))
|
+ .ofType(File.class)
|
||||||
+ .describedAs("YAML file");
|
+ .defaultsTo(new File("scissors.yml"))
|
||||||
|
+ .describedAs("Yml file");
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,18 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
@ -4,41 +4,64 @@ Date: Sun, 10 Jul 2022 10:29:03 +0100
|
|||||||
Subject: [PATCH] Disable running commands in books by default
|
Subject: [PATCH] Disable running commands in books by default
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
index e08f502fc7165f9f466217910210edb5059d39a8..1aa418ef5e400aabdf17dbe81da6cee6a1f63d96 100644
|
||||||
|
--- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
@@ -151,7 +151,8 @@ public class ScissorsConfig
|
||||||
|
|
||||||
|
public static boolean runCommandsInBooks = false;
|
||||||
|
|
||||||
|
- private static void runCommandsInBooks() {
|
||||||
|
+ private static void runCommandsInBooks()
|
||||||
|
+ {
|
||||||
|
runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
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
|
index 31911c09fe15753ae32fa39417bdc9e9de552a88..8ef33e2e2374c456cb9d4aab8ed6f1742951f402 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
+++ b/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;
|
@@ -2,6 +2,8 @@ package net.minecraft.world.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
+
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
@@ -9,8 +10,7 @@ import net.minecraft.nbt.CompoundTag;
|
@@ -9,8 +11,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
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.Component;
|
-import net.minecraft.network.chat.Component;
|
||||||
-import net.minecraft.network.chat.ComponentUtils;
|
-import net.minecraft.network.chat.ComponentUtils;
|
||||||
+import net.minecraft.network.chat.*; // Scissors
|
+import net.minecraft.network.chat.*;
|
||||||
import net.minecraft.stats.Stats;
|
import net.minecraft.stats.Stats;
|
||||||
import net.minecraft.util.StringUtil;
|
import net.minecraft.util.StringUtil;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
@@ -161,9 +161,43 @@ public class WrittenBookItem extends Item {
|
@@ -111,8 +112,7 @@ public class WrittenBookItem extends Item {
|
||||||
|
|
||||||
|
public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) {
|
||||||
|
CompoundTag compoundTag = book.getTag();
|
||||||
|
- if (io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper
|
||||||
|
- compoundTag.putBoolean("resolved", true);
|
||||||
|
+ if (compoundTag != null) { // Paper
|
||||||
|
if (!makeSureTagIsValid(compoundTag)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
@@ -161,8 +161,41 @@ public class WrittenBookItem extends Item {
|
||||||
component2 = Component.literal(text);
|
component2 = Component.literal(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
- return Component.Serializer.toJson(component2);
|
- 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
|
+ 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
|
+ // Scissors start - Allow server owners to disable run command in books
|
||||||
+ public static Component sanitize(Component component, int depth)
|
+ public static Component sanitize(Component component, int depth) {
|
||||||
+ {
|
+ if (depth > 128) {
|
||||||
+ if (depth > 128)
|
|
||||||
+ {
|
|
||||||
+ return Component.nullToEmpty("Sanitization function depth limit exceeded");
|
+ return Component.nullToEmpty("Sanitization function depth limit exceeded");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@ -47,27 +70,27 @@ index 31911c09fe15753ae32fa39417bdc9e9de552a88..b810a5afcb2343174e37efb7dd8a36b9
|
|||||||
+ final Style style = component2.getStyle();
|
+ final Style style = component2.getStyle();
|
||||||
+ final ClickEvent clickEvent = style.getClickEvent();
|
+ final ClickEvent clickEvent = style.getClickEvent();
|
||||||
+
|
+
|
||||||
+ if (clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND))
|
+ if(clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND))
|
||||||
+ {
|
+ {
|
||||||
+ final String clickEventValue = clickEvent.getValue();
|
+ final String clickEventValue = clickEvent.getValue();
|
||||||
+
|
+
|
||||||
+ component2 = component2.copy().setStyle(style
|
+ component2 = component2.copy().setStyle(style
|
||||||
+ .withClickEvent(null)
|
+ .withClickEvent(null)
|
||||||
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.nullToEmpty("Would've " + (clickEventValue.startsWith("/") ? "ran" : "said") + ": " + clickEvent.getValue())))
|
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.nullToEmpty("Would've " + (clickEventValue.startsWith("/") ? "ran": "said") + ": " + clickEvent.getValue())))
|
||||||
+ );
|
+ );
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ final List<Component> processedExtra = component2.getSiblings()
|
+ final List<Component> processedExtra = component2.getSiblings()
|
||||||
+ .stream()
|
+ .stream()
|
||||||
+ .map(comp -> sanitize(comp, depth + 1))
|
+ .map(comp -> sanitize(comp, depth + 1))
|
||||||
+ .toList();
|
+ .toList();
|
||||||
|
+
|
||||||
+ component2.getSiblings().clear();
|
+ component2.getSiblings().clear();
|
||||||
+ component2.getSiblings().addAll(processedExtra);
|
+ component2.getSiblings().addAll(processedExtra);
|
||||||
+
|
+
|
||||||
+ return component2;
|
+ return component2;
|
||||||
+ }
|
}
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFoil(ItemStack stack) {
|
public boolean isFoil(ItemStack stack) {
|
||||||
return true;
|
|
@ -1,105 +0,0 @@
|
|||||||
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 562289bbe08b8d8e75436ad94cfc02e7c0e95d2e..a98134b3b59e194c03bb8110652a9208263c420d 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;
|
|
||||||
@@ -2368,7 +2369,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));
|
|
||||||
@@ -2424,6 +2425,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
|
|
||||||
}
|
|
||||||
@@ -2632,6 +2634,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
|
|
||||||
}
|
|
||||||
@@ -3673,6 +3676,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: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 11 Jul 2022 17:29:12 -0300
|
||||||
|
Subject: [PATCH] Validate block entity tag query positions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 5086fc9f81e9ae894b6fa64819e77267812cae17..ca2b1affa23faf7153fad9e97afbb3b55f1e85d4 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1360,7 +1360,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@Override
|
||||||
|
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (this.player.hasPermissions(2)) {
|
||||||
|
+ if (this.player.hasPermissions(2) && Level.isInSpawnableBounds(packet.getPos())) { // Scissors - Validate block entity tag query positions
|
||||||
|
BlockEntity tileentity = this.player.getLevel().getBlockEntity(packet.getPos());
|
||||||
|
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
||||||
|
|
@ -0,0 +1,93 @@
|
|||||||
|
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/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
index 1aa418ef5e400aabdf17dbe81da6cee6a1f63d96..9cd5ffca69df27f794f5a72e687fc6b3ae0f1656 100644
|
||||||
|
--- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
@@ -87,8 +87,8 @@ public class ScissorsConfig
|
||||||
|
config.options().header(HEADER);
|
||||||
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
|
- version = getInt("config-version", 1);
|
||||||
|
- set("config-version", 1);
|
||||||
|
+ version = getInt("config-version", 2);
|
||||||
|
+ set("config-version", 2);
|
||||||
|
readConfig(ScissorsConfig.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -156,6 +156,13 @@ public class ScissorsConfig
|
||||||
|
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);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
index 4da4edae517a0efec6e03a719ec47b700509dab1..1ec83cbfc2860e1153be301eefb628e209bf9186 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
@@ -1,11 +1,13 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
+import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.chat.ClickEvent;
|
||||||
|
@@ -15,6 +17,7 @@ import net.minecraft.network.chat.ComponentUtils;
|
||||||
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
|
@@ -24,6 +27,8 @@ import net.minecraft.world.item.DyeColor;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.phys.Vec2;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
+import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
|
|
||||||
|
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
|
||||||
|
private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper
|
||||||
|
@@ -270,7 +275,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||||
|
if (!event.callEvent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
- player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add optional permissions to command signs
|
||||||
|
+ final MinecraftServer vanillaServer = player.getServer();
|
||||||
|
+ final CraftServer craftServer = vanillaServer.server;
|
||||||
|
+ final CraftPlayer craftPlayer = player.getBukkitEntity();
|
||||||
|
+ final Commands commands = vanillaServer.getCommands();
|
||||||
|
+
|
||||||
|
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||||
|
+ {
|
||||||
|
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
// Paper end
|
||||||
|
}
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
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 842f8af14b2bd694a48ee6573d98e6cfcf910e16..e9e98f09e13d7f21333450d892cdc80b0667c915 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -4617,7 +4617,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;
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
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,37 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 16 Aug 2022 17:13:02 +0100
|
||||||
|
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
index 0f70be614f8f5350ad558d0ae645cdf0027e1e76..6f036df37609daf33db3884174406e1ccd339735 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
@@ -3,12 +3,14 @@ package org.bukkit.craftbukkit.util;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.ImmutableMap.Builder;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
+
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
+
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.network.chat.ClickEvent;
|
||||||
|
import net.minecraft.network.chat.ClickEvent.Action;
|
||||||
|
@@ -199,6 +201,11 @@ public final class CraftChatMessage {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
||||||
|
+ // Scissors start - Refuse to convert legacy messages over 1k characters
|
||||||
|
+ if (message.length() > 1_000) {
|
||||||
|
+ return new Component[]{Component.empty()};
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return new StringMessage(message, keepNewlines, plain).getOutput();
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Video <videogamesm12@gmail.com>
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
Date: Fri, 19 Aug 2022 00:49:38 -0600
|
Date: Mon, 22 Aug 2022 21:33:37 -0500
|
||||||
Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
|
Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
index 66cf0a6cd1525ecf2615809210a26d55f445d07d..74fb79d4ea11f88f2c0de65b492a5fecc49684f1 100644
|
index 334a47b5e0d205c57dfcbb17168cbd3f21d15606..0227f4ed153d229747722ab709932741e0998dc1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
@@ -270,6 +270,13 @@ public abstract class HangingEntity extends Entity {
|
@@ -270,6 +270,13 @@ public abstract class HangingEntity extends Entity {
|
||||||
@ -13,7 +13,7 @@ index 66cf0a6cd1525ecf2615809210a26d55f445d07d..74fb79d4ea11f88f2c0de65b492a5fec
|
|||||||
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||||
|
|
||||||
+ // Scissors start - Fixes exploit where bad TileX, TileY, and TileZ coordinates can crash servers
|
+ // Scissors start - Fixes exploit where bad TileX, TileY, and TileZ coordinates can crash servers
|
||||||
+ if (level().isLoadedAndInBounds(blockposition))
|
+ if (level.isLoadedAndInBounds(blockposition))
|
||||||
+ {
|
+ {
|
||||||
+ this.pos = blockposition;
|
+ this.pos = blockposition;
|
||||||
+ }
|
+ }
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Mon, 10 Apr 2023 13:56:18 -0300
|
|
||||||
Subject: [PATCH] Limit sculk catalyst cursor positions
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
|
||||||
index de90a216321f7d82310a0d1c915fefe64360534c..7e52f6c26234cf6fa092151d51c0c6b70dc22ca8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
|
|
||||||
@@ -181,7 +181,7 @@ public class SculkSpreader {
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
SculkSpreader.ChargeCursor sculkspreader_a = (SculkSpreader.ChargeCursor) iterator.next();
|
|
||||||
-
|
|
||||||
+ if (!world.getMinecraftWorld().isLoadedAndInBounds(sculkspreader_a.getPos())) continue; // Scissors
|
|
||||||
sculkspreader_a.update(world, pos, random, this, shouldConvertToBlock);
|
|
||||||
if (sculkspreader_a.charge <= 0) {
|
|
||||||
world.levelEvent(3006, sculkspreader_a.getPos(), 0);
|
|
@ -1,46 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Fri, 28 Apr 2023 16:29:23 -0300
|
|
||||||
Subject: [PATCH] Limit map decorations
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/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 50713f03c783c63f93710d986d94af544be0615a..feaf252eda57739fe012b865db8c03476a5b4d1a 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
|
|
||||||
@@ -354,6 +354,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;
|
|
@ -5,17 +5,10 @@ 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
|
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 6c9a8f062f989db022154155e8a05b334a0510da..978fad27ad17de03d108ade2c2bfa464b7d83491 100644
|
index 97231f7328f0eebffcacdae5469027be8aeec3ae..cca792cfabedcc72be99a334f1c2a303217484d7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
+++ b/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 @@
|
@@ -41,9 +41,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
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);
|
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||||
|
|
||||||
if (d6 != 0.0D) {
|
if (d6 != 0.0D) {
|
||||||
@ -26,13 +19,13 @@ index 6c9a8f062f989db022154155e8a05b334a0510da..978fad27ad17de03d108ade2c2bfa464
|
|||||||
+ //this.xPower = d3 / d6 * 0.1D;
|
+ //this.xPower = d3 / d6 * 0.1D;
|
||||||
+ //this.yPower = d4 / d6 * 0.1D;
|
+ //this.yPower = d4 / d6 * 0.1D;
|
||||||
+ //this.zPower = d5 / d6 * 0.1D;
|
+ //this.zPower = d5 / d6 * 0.1D;
|
||||||
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
||||||
+ // Scissors end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -141,6 +146,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -141,6 +145,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,16 +42,16 @@ index 6c9a8f062f989db022154155e8a05b334a0510da..978fad27ad17de03d108ade2c2bfa464
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ this.xPower = MathUtility.clampDouble(xPower, -1024, 1024);
|
+ this.xPower = xPower;
|
||||||
+ this.yPower = MathUtility.clampDouble(yPower, -1024, 1024);
|
+ this.yPower = yPower;
|
||||||
+ this.zPower = MathUtility.clampDouble(zPower, -1024, 1024);
|
+ this.zPower = zPower;
|
||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
super.readAdditionalSaveData(nbt);
|
super.readAdditionalSaveData(nbt);
|
||||||
@@ -148,9 +172,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -148,9 +171,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
ListTag nbttaglist = nbt.getList("power", 6);
|
ListTag nbttaglist = nbt.getList("power", 6);
|
||||||
|
|
||||||
if (nbttaglist.size() == 3) {
|
if (nbttaglist.size() == 3) {
|
||||||
@ -69,13 +62,13 @@ index 6c9a8f062f989db022154155e8a05b334a0510da..978fad27ad17de03d108ade2c2bfa464
|
|||||||
+ //this.xPower = nbttaglist.getDouble(0);
|
+ //this.xPower = nbttaglist.getDouble(0);
|
||||||
+ //this.yPower = nbttaglist.getDouble(1);
|
+ //this.yPower = nbttaglist.getDouble(1);
|
||||||
+ //this.zPower = nbttaglist.getDouble(2);
|
+ //this.zPower = nbttaglist.getDouble(2);
|
||||||
|
+ // Scissors end
|
||||||
+
|
+
|
||||||
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
||||||
+ // Scissors end
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,9 +212,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
@@ -184,9 +211,12 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
Vec3 vec3d = entity.getLookAngle();
|
Vec3 vec3d = entity.getLookAngle();
|
||||||
|
|
||||||
this.setDeltaMovement(vec3d);
|
this.setDeltaMovement(vec3d);
|
||||||
@ -86,7 +79,6 @@ index 6c9a8f062f989db022154155e8a05b334a0510da..978fad27ad17de03d108ade2c2bfa464
|
|||||||
+ //this.xPower = vec3d.x * 0.1D;
|
+ //this.xPower = vec3d.x * 0.1D;
|
||||||
+ //this.yPower = vec3d.y * 0.1D;
|
+ //this.yPower = vec3d.y * 0.1D;
|
||||||
+ //this.zPower = vec3d.z * 0.1D;
|
+ //this.zPower = vec3d.z * 0.1D;
|
||||||
+
|
|
||||||
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
this.setOwner(entity);
|
this.setOwner(entity);
|
@ -0,0 +1,102 @@
|
|||||||
|
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/me/totalfreedom/scissors/ScissorsConfig.java b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
index 37b8ce4fe8913fd1097c552609c9eddb2751555e..5f46c6e93048a237e25ad84b8839a2945cc88e81 100644
|
||||||
|
--- a/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/ScissorsConfig.java
|
||||||
|
@@ -87,8 +87,8 @@ public class ScissorsConfig
|
||||||
|
config.options().header(HEADER);
|
||||||
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
|
- version = getInt("config-version", 2);
|
||||||
|
- set("config-version", 2);
|
||||||
|
+ version = getInt("config-version", 3);
|
||||||
|
+ set("config-version", 3);
|
||||||
|
readConfig(ScissorsConfig.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -163,6 +163,12 @@ public class ScissorsConfig
|
||||||
|
commandSignsBypassPermissions = getBoolean("commandSignsBypassPermissions", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static boolean chatSignaturesEnabled = true;
|
||||||
|
+ private static void chatSignaturesEnabled()
|
||||||
|
+ {
|
||||||
|
+ chatSignaturesEnabled = getBoolean("chatSignaturesEnabled", true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
|
index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..182f68359a7a8c0b331acd103ed3952ea3c33b93 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.network.chat;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public interface OutgoingChatMessage {
|
||||||
|
@@ -42,12 +43,16 @@ public interface OutgoingChatMessage {
|
||||||
|
}
|
||||||
|
public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params, @javax.annotation.Nullable Component unsigned) {
|
||||||
|
// Paper end
|
||||||
|
+ // Scissors start - Add configuration option to disable chat signatures
|
||||||
|
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
|
||||||
|
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
|
||||||
|
- if (!playerChatMessage.isFullyFiltered()) {
|
||||||
|
+ if (!playerChatMessage.isFullyFiltered() && /* Scissors */ ScissorsConfig.chatSignaturesEnabled) {
|
||||||
|
sender.connection.sendPlayerChatMessage(playerChatMessage, params);
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ sender.connection.sendDisguisedChatMessage(playerChatMessage.decoratedContent(), params);
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 7d160cdc01d85c4fdc78342051c92be26e394a7f..b55d78ae48ebc18b857f28084fe86ea41e574cd9 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;
|
||||||
|
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
@@ -2366,6 +2367,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
|
||||||
|
|
||||||
|
if (optional.isEmpty()) {
|
||||||
|
+ // Scissors start - Add configuration option to disable chat signatures
|
||||||
|
+ if (!ScissorsConfig.chatSignaturesEnabled)
|
||||||
|
+ {
|
||||||
|
+ return optional;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
||||||
|
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
||||||
|
}
|
||||||
|
@@ -2601,6 +2609,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
|
||||||
|
synchronized (this.lastSeenMessages) {
|
||||||
|
if (!this.lastSeenMessages.applyOffset(packet.offset())) {
|
||||||
|
+ // Scissors start - Add configuration option to disable chat signatures
|
||||||
|
+ if (!ScissorsConfig.chatSignaturesEnabled)
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
|
||||||
|
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
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 20099425babf5325005d11bf25faa783e3bc2715..cf02fc7199c893db66bebba6051bc10dbff859ac 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
@@ -1628,7 +1628,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
|
|
@ -1,19 +0,0 @@
|
|||||||
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 ff7198a03ab0da79c98513f4a1507e854484f4c2..e7060fce4ba3583cf5be5f6503fd861a24704d6d 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
|
|
||||||
@@ -372,7 +372,7 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.entityByUUID.containsKey(entity.getUUID())) {
|
|
||||||
- LOGGER.warn("Entity uuid already exists: " + entity.getUUID() + ", mapped to " + this.entityByUUID.get(entity.getUUID()) + ", can't add " + entity);
|
|
||||||
+ // Scissors - Don't warn on duplicate entity UUIDs
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.entityById.put(entity.getId(), entity);
|
|
@ -1,18 +0,0 @@
|
|||||||
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();
|
|
@ -1,125 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Wed, 31 May 2023 18:14:00 -0300
|
|
||||||
Subject: [PATCH] Add depth limit to Component deserializer
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
index a2149452ee461002ea74189c5aa49cddd943d0cf..f1d1501211a923c0ccab6b5982887c3a9262889b 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
@@ -26,6 +26,7 @@ import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Optional;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
|
|
||||||
import net.minecraft.ChatFormatting; // Scissors
|
|
||||||
import net.minecraft.Util;
|
|
||||||
import net.minecraft.network.chat.contents.BlockDataSource;
|
|
||||||
@@ -44,6 +45,7 @@ import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.util.LowerCaseEnumTypeAdapterFactory;
|
|
||||||
// CraftBukkit start
|
|
||||||
import com.google.common.collect.Streams;
|
|
||||||
+import java.util.regex.Pattern; // Scissors
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
@@ -254,10 +256,16 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
throw new IllegalStateException("Couldn't get field 'lineStart' for JsonReader", nosuchfieldexception);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
+ private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s"); // Scissors
|
|
||||||
|
|
||||||
public Serializer() {}
|
|
||||||
|
|
||||||
- public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
|
||||||
+ // Scissors start
|
|
||||||
+ private MutableComponent deserialize(JsonElement jsonelement, JsonDeserializationContext jsondeserializationcontext, int depth) throws JsonParseException {
|
|
||||||
+ if (depth > ScissorsConfig.componentDepthLimit) {
|
|
||||||
+ throw new JsonParseException("Depth limit exceeded");
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
if (jsonelement.isJsonPrimitive()) {
|
|
||||||
return Component.literal(jsonelement.getAsString());
|
|
||||||
} else {
|
|
||||||
@@ -273,7 +281,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
JsonElement jsonelement1 = (JsonElement) iterator.next();
|
|
||||||
- MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext);
|
|
||||||
+ MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsondeserializationcontext, depth + 1); // Scissors
|
|
||||||
|
|
||||||
if (ichatmutablecomponent == null) {
|
|
||||||
ichatmutablecomponent = ichatmutablecomponent1;
|
|
||||||
@@ -297,12 +305,17 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
s = GsonHelper.getAsString(jsonobject, "translate");
|
|
||||||
String s1 = GsonHelper.getAsString(jsonobject, "fallback", (String) null);
|
|
||||||
|
|
||||||
+ // Scissors start - Penalize depth for placeholders in translate & fallback
|
|
||||||
+ long translate_placeholders = PLACEHOLDER_PATTERN.matcher(s).results().count();
|
|
||||||
+ long fallback_placeholders = s1 != null ? PLACEHOLDER_PATTERN.matcher(s1).results().count() : 0;
|
|
||||||
+ int penalty = (int)Math.max(translate_placeholders, fallback_placeholders) * 12;
|
|
||||||
+ // Scissors end
|
|
||||||
if (jsonobject.has("with")) {
|
|
||||||
JsonArray jsonarray1 = GsonHelper.getAsJsonArray(jsonobject, "with");
|
|
||||||
Object[] aobject = new Object[jsonarray1.size()];
|
|
||||||
|
|
||||||
for (int i = 0; i < aobject.length; ++i) {
|
|
||||||
- aobject[i] = Serializer.unwrapTextArgument(this.deserialize(jsonarray1.get(i), type, jsondeserializationcontext));
|
|
||||||
+ aobject[i] = Serializer.unwrapTextArgument(this.deserialize(jsonarray1.get(i), jsondeserializationcontext, depth + 1 + penalty)); // Scissors
|
|
||||||
}
|
|
||||||
|
|
||||||
ichatmutablecomponent = Component.translatableWithFallback(s, s1, aobject);
|
|
||||||
@@ -318,7 +331,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
|
|
||||||
ichatmutablecomponent = Component.score(GsonHelper.getAsString(jsonobject1, "name"), GsonHelper.getAsString(jsonobject1, "objective"));
|
|
||||||
} else if (jsonobject.has("selector")) {
|
|
||||||
- Optional<Component> optional = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
|
|
||||||
+ Optional<Component> optional = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1); // Scissors
|
|
||||||
|
|
||||||
ichatmutablecomponent = Component.selector(GsonHelper.getAsString(jsonobject, "selector"), optional);
|
|
||||||
} else if (jsonobject.has("keybind")) {
|
|
||||||
@@ -329,7 +342,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
}
|
|
||||||
|
|
||||||
s = GsonHelper.getAsString(jsonobject, "nbt");
|
|
||||||
- Optional<Component> optional1 = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
|
|
||||||
+ Optional<Component> optional1 = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1); // Scissors
|
|
||||||
boolean flag = GsonHelper.getAsBoolean(jsonobject, "interpret", false);
|
|
||||||
Object object;
|
|
||||||
|
|
||||||
@@ -356,7 +369,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 0; j < jsonarray2.size(); ++j) {
|
|
||||||
- ichatmutablecomponent.append((Component) this.deserialize(jsonarray2.get(j), type, jsondeserializationcontext));
|
|
||||||
+ ichatmutablecomponent.append((Component) this.deserialize(jsonarray2.get(j), jsondeserializationcontext, depth + 1)); // Scissors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -366,6 +379,12 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
|
||||||
+ return this.deserialize(jsonelement, jsondeserializationcontext, 1);
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
private static Object unwrapTextArgument(Object text) {
|
|
||||||
if (text instanceof Component) {
|
|
||||||
Component ichatbasecomponent = (Component) text;
|
|
||||||
@@ -384,8 +403,10 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
- private Optional<Component> parseSeparator(Type type, JsonDeserializationContext context, JsonObject json) {
|
|
||||||
- return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), type, context)) : Optional.empty();
|
|
||||||
+ // Scissors start
|
|
||||||
+ private Optional<Component> parseSeparator(JsonDeserializationContext context, JsonObject json, int depth) {
|
|
||||||
+ return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), context, depth + 1)) : Optional.empty();
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
private void serializeStyle(Style style, JsonObject json, JsonSerializationContext context) {
|
|
@ -1,86 +0,0 @@
|
|||||||
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 08390409bbaf9f3ae8260ab36ea5e0580e93b3e3..e2f7cef0edf2775083eb87b1cb5984ec8b25c76f 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
|
|
||||||
@@ -1007,6 +1012,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) {
|
|
||||||
@@ -1038,7 +1053,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);
|
|
@ -1,110 +0,0 @@
|
|||||||
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>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
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 5c951ef93fe4cf4f085df86b0cefc02bc2610ab9..1d08e3a9493154e075a289d2eb9a8772289534af 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;
|
|
||||||
@@ -428,6 +428,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
|
|
@ -1,18 +0,0 @@
|
|||||||
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());
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
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 ec81be70cd6f92bbf9011395cb361f0ce54c5ad0..97da1db83dca24759b52fc2d0a360187dbef86f1 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
|
||||||
@@ -56,7 +56,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
|
||||||
this.stack.push(entry);
|
|
||||||
}
|
|
||||||
} else if (this.count - 1 == this.maxChainedNeighborUpdates) {
|
|
||||||
- LOGGER.error("Too many chained neighbor updates. Skipping the rest. First skipped position: " + pos.toShortString());
|
|
||||||
+ // Scissors - don't log
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bl) {
|
|
@ -1,46 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Luna <lunahatesgogle@gmail.com>
|
|
||||||
Date: Tue, 4 Jul 2023 18:49:34 -0300
|
|
||||||
Subject: [PATCH] Fix packet-related lag exploits
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
index e2f7cef0edf2775083eb87b1cb5984ec8b25c76f..c645e05ec6c309448460c7e983931b9dc79a7f7e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
||||||
@@ -972,7 +972,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();
|
|
||||||
@@ -1139,7 +1139,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);
|
|
||||||
@@ -1197,7 +1197,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);
|
|
||||||
@@ -1220,7 +1220,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);
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
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")) {
|
|
@ -1,32 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Thu, 6 Jul 2023 23:01:12 +0100
|
|
||||||
Subject: [PATCH] Mute invalid attributes
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
|
||||||
index 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
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()) {
|
|
@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Allink <arclicious@vivaldi.net>
|
|
||||||
Date: Fri, 25 Aug 2023 11:51:47 +0100
|
|
||||||
Subject: [PATCH] Add length limit to note block sound
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
||||||
index a2fc2c0437999dd09f080eafe8ea466b16cdf57b..0dcf1d7e041477fe31dce4b4ee707399520d30f2 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
|
||||||
@@ -80,7 +80,7 @@ public class SkullBlockEntity extends BlockEntity {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nbt.contains("note_block_sound", 8)) {
|
|
||||||
- this.noteBlockSound = ResourceLocation.tryParse(nbt.getString("note_block_sound"));
|
|
||||||
+ this.noteBlockSound = ResourceLocation.tryParse(StringUtil.truncateStringIfNecessary(nbt.getString("note_block_sound"), 32767, false)); // Scissors - Add length limit to note block sound
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
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) {
|
|
@ -7,4 +7,4 @@ pluginManagement {
|
|||||||
|
|
||||||
rootProject.name = "Scissors"
|
rootProject.name = "Scissors"
|
||||||
|
|
||||||
include("aswm-api", "aswm-core", "Scissors-API", "Scissors-Server")
|
include("Scissors-API", "Scissors-Server")
|
||||||
|
Submodule submodules/AdvancedSlimePaper deleted from 59df833a4e
Reference in New Issue
Block a user