mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 11:28:35 +00:00
Compare commits
59 Commits
archive/1.
...
archive/1.
Author | SHA1 | Date | |
---|---|---|---|
fb286351e1 | |||
d487ca64dc | |||
a4ede7dc64 | |||
5af8738efc | |||
ece466de42 | |||
1a5d2bf22a | |||
671bf4bd18 | |||
76155af1ed | |||
f33f6d2de8 | |||
7b8d2ee804 | |||
b72d5ec8fc | |||
7e6bd02e17 | |||
79f013c021 | |||
2073436f76 | |||
43213a0e43 | |||
1b4d65a1e6 | |||
020afc9e99 | |||
92a9dd9634 | |||
661bd58103 | |||
494829e797 | |||
4c31b7f9ac | |||
b75232882c | |||
f21a7fb408 | |||
ae3dc6aa18 | |||
8f07c9e142 | |||
1cd49aebf7 | |||
3a4b3ffd34 | |||
c48a56ac01 | |||
fb17ef58f1 | |||
aba21aaf49 | |||
dcf6dab4ee | |||
cb464a0b3a | |||
71804a2e65 | |||
611e77e503 | |||
3b8ad1a45d | |||
c2b2427622 | |||
a877b648d5 | |||
f66a491861 | |||
bca6da00e8 | |||
c4afa459b5 | |||
55ec369c40 | |||
6b0f19780f | |||
2907ef1436 | |||
b2f423c4ec | |||
7885894176 | |||
4d16aa5d43 | |||
61bcac75e9 | |||
9bfd719cb6 | |||
7f0374c24f | |||
10d6b02984 | |||
638bd93702 | |||
106edf19b7 | |||
236e8a95a3 | |||
9e244f52c9 | |||
61fd911106 | |||
21f493bcf8 | |||
ac37ce16dd | |||
6f32742d79 | |||
dc1a5399f7 |
15
Jenkinsfile
vendored
15
Jenkinsfile
vendored
@ -1,21 +1,26 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
options {
|
environment {
|
||||||
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')
|
GITHUB_BRANCH = "${BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('applyPatches') {
|
stage('applyPatches') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
sh './gradlew applyPatches --no-daemon'
|
sh './gradlew applyPatches --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('paperclipJar') {
|
stage('paperclipJar') {
|
||||||
steps {
|
steps {
|
||||||
withGradle {
|
withGradle {
|
||||||
sh './gradlew paperclipJar --no-daemon'
|
sh './gradlew paperclipJar --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
|
sh """
|
||||||
|
#!/bin/sh
|
||||||
|
BRANCH=\$(echo "\${BRANCH_NAME}" | sed 's/\\//_/g')
|
||||||
|
mv \${WORKSPACE}/build/libs/Scissors-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH}-\${BUILD_NUMBER}.jar
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('test') {
|
stage('test') {
|
||||||
@ -34,4 +39,4 @@ pipeline {
|
|||||||
cleanWs()
|
cleanWs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
LICENSE.md
Normal file
20
LICENSE.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Scissors inherits its licensing from upstream projects.
|
||||||
|
|
||||||
|
As such, Scissors is licensed under the
|
||||||
|
[GNU General Public License version 3](licenses/GPL.md); as it inherits it from Paper and Spigot,
|
||||||
|
who in turn inherits it from the original Bukkit and Craftbukkit projects.
|
||||||
|
|
||||||
|
Any author who is _not_ listed below should be presumed to have released their work
|
||||||
|
under the original [GPL](licenses/GPL.md) license.
|
||||||
|
|
||||||
|
In the interest of promoting a better Minecraft platform for everyone, contributors
|
||||||
|
may choose to release their code under the more permissive [MIT License](licenses/MIT.md).
|
||||||
|
|
||||||
|
The authors listed below have chosen to release their code under that more permissive
|
||||||
|
[MIT License](licenses/MIT.md). Any contributor who wants their name added below
|
||||||
|
should submit a pull request to this project to add their name.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Allink (allinkdev) <arclicious@vivaldi.net>
|
||||||
|
Telesphoreo <me@telesphoreo.me>
|
||||||
|
```
|
@ -1,2 +1,8 @@
|
|||||||
# Scissors
|
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.17.1/)
|
||||||
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that Paper's own team has either refused to fix or would have.
|
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that Paper's own team has either refused to fix or would have.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
### [Scissors Download](https://ci.plex.us.org/job/Scissors)
|
||||||
|
### [Scissors Javadoc](https://javadoc.scissors.gg/1.17.1)
|
||||||
|
### [Scissors Announcements](https://totalfreedom.me/forum/board/139)
|
||||||
|
### [Scissors General Discussion](https://totalfreedom.me/forum/board/140)
|
||||||
|
@ -8,3 +8,4 @@
|
|||||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||||
|
minecraft net/minecraft/nbt/TagParser.java
|
@ -11,7 +11,7 @@ val spigotDecompiler: Configuration by configurations.creating
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
maven("https://repo.papermc.io/repository/maven-public/") {
|
||||||
content {
|
content {
|
||||||
onlyForConfigurations(
|
onlyForConfigurations(
|
||||||
configurations.paperclip.name,
|
configurations.paperclip.name,
|
||||||
@ -53,7 +53,7 @@ subprojects {
|
|||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://papermc.io/repo/repository/maven-public/")
|
maven("https://repo.papermc.io/repository/maven-public/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,3 +73,32 @@ paperweight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.generateDevelopmentBundle {
|
||||||
|
apiCoordinates.set("me.totalfreedom.scissors:scissors-api")
|
||||||
|
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||||
|
libraryRepositories.set(
|
||||||
|
listOf(
|
||||||
|
"https://repo.maven.apache.org/maven2/",
|
||||||
|
"https://repo.papermc.io/repository/maven-public/",
|
||||||
|
"https://repo.scissors.gg/repository/scissors-snapshot/",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
// Publishing API:
|
||||||
|
// ./gradlew :Scissors-API:publish[ToMavenLocal]
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "scissors-snapshots"
|
||||||
|
url = uri("https://repo.scissors.gg/repository/scissors-snapshot/")
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("scissorsUser")
|
||||||
|
password = System.getenv("scissorsPassword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
675
licenses/GPL.md
Normal file
675
licenses/GPL.md
Normal file
@ -0,0 +1,675 @@
|
|||||||
|
### GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
### Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom
|
||||||
|
to share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users. We, the Free Software Foundation, use
|
||||||
|
the GNU General Public License for most of our software; it applies
|
||||||
|
also to any other work released this way by its authors. You can apply
|
||||||
|
it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you
|
||||||
|
have certain responsibilities if you distribute copies of the
|
||||||
|
software, or if you modify it: responsibilities to respect the freedom
|
||||||
|
of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the
|
||||||
|
manufacturer can do so. This is fundamentally incompatible with the
|
||||||
|
aim of protecting users' freedom to change the software. The
|
||||||
|
systematic pattern of such abuse occurs in the area of products for
|
||||||
|
individuals to use, which is precisely where it is most unacceptable.
|
||||||
|
Therefore, we have designed this version of the GPL to prohibit the
|
||||||
|
practice for those products. If such problems arise substantially in
|
||||||
|
other domains, we stand ready to extend this provision to those
|
||||||
|
domains in future versions of the GPL, as needed to protect the
|
||||||
|
freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish
|
||||||
|
to avoid the special danger that patents applied to a free program
|
||||||
|
could make it effectively proprietary. To prevent this, the GPL
|
||||||
|
assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
### TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
#### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
#### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
#### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
#### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
#### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
#### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
#### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
#### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
#### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
#### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
#### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
#### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
#### 13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
#### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in
|
||||||
|
detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU General Public
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that numbered version or
|
||||||
|
of any later version published by the Free Software Foundation. If the
|
||||||
|
Program does not specify a version number of the GNU General Public
|
||||||
|
License, you may choose any version ever published by the Free
|
||||||
|
Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU General Public License can be used, that proxy's public
|
||||||
|
statement of acceptance of a version permanently authorizes you to
|
||||||
|
choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
#### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
#### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
#### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands \`show w' and \`show c' should show the
|
||||||
|
appropriate parts of the General Public License. Of course, your
|
||||||
|
program's commands might be different; for a GUI interface, you would
|
||||||
|
use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your
|
||||||
|
program into proprietary programs. If your program is a subroutine
|
||||||
|
library, you may consider it more useful to permit linking proprietary
|
||||||
|
applications with the library. If this is what you want to do, use the
|
||||||
|
GNU Lesser General Public License instead of this License. But first,
|
||||||
|
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
23
licenses/MIT.md
Normal file
23
licenses/MIT.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the “Software”), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
63
patches/api/0001-Add-MasterBlockFireEvent.patch
Normal file
63
patches/api/0001-Add-MasterBlockFireEvent.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 4 Jul 2022 16:44:35 +0100
|
||||||
|
Subject: [PATCH] Add MasterBlockFireEvent
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/com/github/atlasmediagroup/scissors/event/block/MasterBlockFireEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..a24cb52a5af62012c5d5acc29e4c3558e92ae572
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/event/block/MasterBlockFireEvent.java
|
||||||
|
@@ -0,0 +1,51 @@
|
||||||
|
+package com.github.atlasmediagroup.scissors.event.block;
|
||||||
|
+
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a GameMasterBlock is fired (i.e. command block, structure block, jigsaw block)
|
||||||
|
+ */
|
||||||
|
+public class MasterBlockFireEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Location at;
|
||||||
|
+
|
||||||
|
+ public MasterBlockFireEvent(@NotNull Location at)
|
||||||
|
+ {
|
||||||
|
+ this.at = at;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Location getAt()
|
||||||
|
+ {
|
||||||
|
+ return this.at;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancelled)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancelled;
|
||||||
|
+ }
|
||||||
|
+}
|
72
patches/api/0002-Add-spectator-teleport-event.patch
Normal file
72
patches/api/0002-Add-spectator-teleport-event.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 5 Jul 2022 03:28:49 +0100
|
||||||
|
Subject: [PATCH] Add spectator teleport event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/event/player/SpectatorTeleportEvent.java b/src/main/java/com/github/atlasmediagroup/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..504f02ac89ea0ed3569cbc4ff67292041c9f408e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
|
@@ -0,0 +1,60 @@
|
||||||
|
+package com.github.atlasmediagroup.scissors.event.player;
|
||||||
|
+
|
||||||
|
+import org.bukkit.entity.Entity;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called whenever a spectator attempts to teleport to an entity
|
||||||
|
+ */
|
||||||
|
+public class SpectatorTeleportEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlerList = new HandlerList();
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final Entity target;
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+
|
||||||
|
+ public SpectatorTeleportEvent(@NotNull Player player, @NotNull Entity target)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.target = target;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public Player getPlayer() {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public Entity getTarget() {
|
||||||
|
+ return this.target;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancelled)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ @Override
|
||||||
|
+ public HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlerList;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public static org.bukkit.event.HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlerList;
|
||||||
|
+ }
|
||||||
|
+}
|
24
patches/api/0003-Add-Scissors-configuration-file.patch
Normal file
24
patches/api/0003-Add-Scissors-configuration-file.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 07:27:37 +0100
|
||||||
|
Subject: [PATCH] Add Scissors configuration file
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
|
index c34cfba8f9ed7e9dbd0b6b8ffef9fba46abff046..416bdfccc6cae51a584f29949a32172fb10f78a6 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
|
@@ -1715,6 +1715,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ @NotNull
|
||||||
|
+ public org.bukkit.configuration.file.YamlConfiguration getScissorsConfig() {
|
||||||
|
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Sends the component to the player
|
||||||
|
*
|
173
patches/api/0004-Add-command-block-player-edit-event.patch
Normal file
173
patches/api/0004-Add-command-block-player-edit-event.patch
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 23:40:13 +0100
|
||||||
|
Subject: [PATCH] Add command block player edit event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/event/block/CommandBlockPlayerEditEvent.java b/src/main/java/com/github/atlasmediagroup/scissors/event/block/CommandBlockPlayerEditEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..983dd3b25800d5f1fcc61415051bf7c28d0147bd
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/event/block/CommandBlockPlayerEditEvent.java
|
||||||
|
@@ -0,0 +1,77 @@
|
||||||
|
+package com.github.atlasmediagroup.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/com/github/atlasmediagroup/scissors/event/block/CommandMinecartPlayerEditEvent.java b/src/main/java/com/github/atlasmediagroup/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..2ecaad3d67d3a028a50e998d791de3a829197117
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||||
|
@@ -0,0 +1,78 @@
|
||||||
|
+package com.github.atlasmediagroup.scissors.event.block;
|
||||||
|
+
|
||||||
|
+import org.bukkit.block.CommandBlock;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.entity.minecart.CommandMinecart;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a command block is modified by a player
|
||||||
|
+ */
|
||||||
|
+public class CommandMinecartPlayerEditEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final String oldCommand;
|
||||||
|
+ private String newCommand;
|
||||||
|
+ private final CommandMinecart commandMinecart;
|
||||||
|
+
|
||||||
|
+ public CommandMinecartPlayerEditEvent(@NotNull Player player, @NotNull String oldCommand, @NotNull String newCommand, @NotNull CommandMinecart commandMinecart)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.oldCommand = oldCommand;
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ this.commandMinecart = commandMinecart;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getNewCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getOldCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.oldCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setNewCommand(@NotNull String newCommand)
|
||||||
|
+ {
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Player getPlayer()
|
||||||
|
+ {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull CommandMinecart getCommandMinecart()
|
||||||
|
+ {
|
||||||
|
+ return this.commandMinecart;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return this.cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancel)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancel;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
@ -5,7 +5,7 @@ Subject: [PATCH] Build changes
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2858823a1 100644
|
index c236fe5dc388f8bc0a929f1de04af94c63514208..722e2aefa279e02bfef23cda8d98210072b0ed3d 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -13,8 +13,8 @@ plugins {
|
@@ -13,8 +13,8 @@ plugins {
|
||||||
@ -19,7 +19,18 @@ index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2
|
|||||||
// Paper start
|
// Paper start
|
||||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
@@ -66,7 +66,7 @@ tasks.jar {
|
@@ -62,11 +62,17 @@ tasks.jar {
|
||||||
|
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
|
||||||
|
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
|
||||||
|
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
|
||||||
|
- val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||||
|
+ var gitBranch: String;
|
||||||
|
+ if (System.getenv("JENKINS_URL") == null)
|
||||||
|
+ {
|
||||||
|
+ gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||||
|
+ } else {
|
||||||
|
+ gitBranch = System.getenv("GITHUB_BRANCH")
|
||||||
|
+ }
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
"Implementation-Title" to "CraftBukkit",
|
"Implementation-Title" to "CraftBukkit",
|
||||||
@ -28,7 +39,7 @@ index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2
|
|||||||
"Implementation-Vendor" to date, // Paper
|
"Implementation-Vendor" to date, // Paper
|
||||||
"Specification-Title" to "Bukkit",
|
"Specification-Title" to "Bukkit",
|
||||||
"Specification-Version" to project.version,
|
"Specification-Version" to project.version,
|
||||||
@@ -193,7 +193,7 @@ tasks.test {
|
@@ -193,7 +199,7 @@ tasks.test {
|
||||||
fun TaskContainer.registerRunTask(
|
fun TaskContainer.registerRunTask(
|
||||||
name: String, block: JavaExec.() -> Unit
|
name: String, block: JavaExec.() -> Unit
|
||||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||||
@ -37,6 +48,41 @@ index c236fe5dc388f8bc0a929f1de04af94c63514208..c7c8b00a34cbc39f1003b618097bc1e2
|
|||||||
standardInput = System.`in`
|
standardInput = System.`in`
|
||||||
workingDir = rootProject.layout.projectDirectory.dir(
|
workingDir = rootProject.layout.projectDirectory.dir(
|
||||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
|
index 218f5bafeed8551b55b91c7fccaf6935c8b631ca..1434060d64bca5931749278d72c3eca6b0cd5189 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
|
@@ -593,7 +593,7 @@ public class Metrics {
|
||||||
|
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||||
|
// Only start Metrics, if it's enabled in the config
|
||||||
|
if (config.getBoolean("enabled", true)) {
|
||||||
|
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||||
|
+ Metrics metrics = new Metrics("Scissors", serverUUID, logFailedRequests, Bukkit.getLogger());
|
||||||
|
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||||
|
String minecraftVersion = Bukkit.getVersion();
|
||||||
|
@@ -603,7 +603,7 @@ public class Metrics {
|
||||||
|
|
||||||
|
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
|
||||||
|
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline"));
|
||||||
|
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"));
|
||||||
|
+ metrics.addCustomChart(new Metrics.SimplePie("scissors_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"));
|
||||||
|
|
||||||
|
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||||
|
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||||
|
index e0b1f0671d16ddddcb6725acd25a1d1d69e42701..3a3d1d22e105ec2c68a06512434540a81c889685 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")
|
||||||
|
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
||||||
|
.completer(new ConsoleCommandCompleter(this.server))
|
||||||
|
.option(LineReader.Option.COMPLETE_IN_WORD, true);
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 8091a901106a1085da9dfd8627dadcbe50f00872..e6da0f7e755e6b0225afbced2c7a14e9df83b09d 100644
|
index 8091a901106a1085da9dfd8627dadcbe50f00872..e6da0f7e755e6b0225afbced2c7a14e9df83b09d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Change version fetcher to AMG
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab60919ee955a 100644
|
index ece77f5ea4b14bbed7c070131b3251ea86764538..74e5c5194580c6b65f3b4e657237fef7ef005ec2 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||||
@@ -4,6 +4,8 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
@@ -4,6 +4,8 @@ import com.destroystokyo.paper.util.VersionFetcher;
|
||||||
@ -24,7 +24,7 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab609
|
|||||||
- private static final String GITHUB_BRANCH_NAME = "master";
|
- private static final String GITHUB_BRANCH_NAME = "master";
|
||||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads";
|
||||||
+ private static final String GITHUB_BRANCH_NAME = getBranch();
|
+ private static final String GITHUB_BRANCH_NAME = getBranch();
|
||||||
+ private static final String DOWNLOAD_PAGE = "https://ci.plex.us.org/job/Scissors/job/" + GITHUB_BRANCH_NAME;
|
+ private static final String DOWNLOAD_PAGE = "https://ci.scissors.gg/job/Scissors/job/" + GITHUB_BRANCH_NAME;
|
||||||
private static @Nullable String mcVer;
|
private static @Nullable String mcVer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -71,3 +71,16 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..f92610edcfb724374c69e66443eab609
|
|||||||
|
|
||||||
switch (distance) {
|
switch (distance) {
|
||||||
case -1:
|
case -1:
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
index 22e9dd17f62103c5061435099ce96a3d70d54808..d033caf5dabbd2a240286c5623b3d287ae5cbdd9 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -269,7 +269,7 @@ public class Main {
|
||||||
|
if (buildDate.before(deadline.getTime())) {
|
||||||
|
// Paper start - This is some stupid bullshit
|
||||||
|
System.err.println("*** Warning, you've not updated in a while! ***");
|
||||||
|
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads ***"); // Paper
|
||||||
|
+ System.err.println("*** Please download a new build from https://ci.scissors.gg/job/Scissors ***"); // Scissors > // Paper
|
||||||
|
//System.err.println("*** Server will start in 20 seconds ***");
|
||||||
|
//Thread.sleep(TimeUnit.SECONDS.toMillis(20));
|
||||||
|
// Paper End
|
||||||
|
165
patches/server/0019-Block-server-side-chunkbans.patch
Normal file
165
patches/server/0019-Block-server-side-chunkbans.patch
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: ayunami2000 <spwilliamsiam@gmail.com>
|
||||||
|
Date: Mon, 28 Mar 2022 17:02:21 -0400
|
||||||
|
Subject: [PATCH] Block server-side chunkbans
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
index b039a32b805fc02033fa862a1c40c4a51639e69a..b2227f01bc90351a4a3f73fa835dd89bde15632e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
|
@@ -5,8 +5,22 @@ import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
|
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||||
|
import java.io.IOException;
|
||||||
|
+import java.util.Collections;
|
||||||
|
+import net.minecraft.ChatFormatting;
|
||||||
|
+import net.minecraft.core.NonNullList;
|
||||||
|
+import net.minecraft.nbt.CompoundTag;
|
||||||
|
+import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.PacketFlow;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundChatPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundMapItemDataPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
|
||||||
|
+import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
|
||||||
|
+import net.minecraft.world.item.ItemStack;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.logging.log4j.Marker;
|
||||||
|
@@ -21,6 +35,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
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
|
||||||
|
ConnectionProtocol connectionProtocol = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get();
|
||||||
|
@@ -36,35 +67,68 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
||||||
|
throw new IOException("Can't serialize unregistered packet");
|
||||||
|
} else {
|
||||||
|
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
|
||||||
|
- friendlyByteBuf.writeVarInt(integer);
|
||||||
|
- friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
|
||||||
|
-
|
||||||
|
+ // Scissors start
|
||||||
|
+ int k;
|
||||||
|
try {
|
||||||
|
- int i = friendlyByteBuf.writerIndex();
|
||||||
|
- 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);
|
||||||
|
- }
|
||||||
|
+ k = tryWrite(packet, friendlyByteBuf, channelHandlerContext, integer);
|
||||||
|
} catch (Throwable var9) {
|
||||||
|
- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var9); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE?
|
||||||
|
- if (packet.isSkippable()) {
|
||||||
|
- throw new SkipPacketException(var9);
|
||||||
|
- } else {
|
||||||
|
- throw var9;
|
||||||
|
+ packet = capPacket(packet, integer);
|
||||||
|
+ if (packet == null) {
|
||||||
|
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
|
||||||
|
}
|
||||||
|
+ friendlyByteBuf.clear();
|
||||||
|
+ k = tryWrite(packet, friendlyByteBuf, channelHandlerContext, integer);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- // Paper start
|
||||||
|
- int packetLength = friendlyByteBuf.readableBytes();
|
||||||
|
- if (packetLength > MAX_PACKET_SIZE) {
|
||||||
|
- throw new PacketTooLargeException(packet, packetLength);
|
||||||
|
- }
|
||||||
|
- // Paper end
|
||||||
|
+ // 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 ClientboundLevelChunkPacket chunkPacket)
|
||||||
|
+ {
|
||||||
|
+ chunkPacket.clearNBT();
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundSetEntityDataPacket)
|
||||||
|
+ {
|
||||||
|
+ return null; // Skip
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket)
|
||||||
|
+ {
|
||||||
|
+ packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY);
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket)
|
||||||
|
+ {
|
||||||
|
+ packet = new ClientboundSetEquipmentPacket(setEquipmentPacket.getEntity(), Collections.emptyList());
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket)
|
||||||
|
+ {
|
||||||
|
+ packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY);
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket)
|
||||||
|
+ {
|
||||||
|
+ packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(), mapItemDataPacket.getScale(), mapItemDataPacket.isLocked(), null, null);
|
||||||
|
+ }
|
||||||
|
+ else if (packet instanceof ClientboundChatPacket chatPacket)
|
||||||
|
+ {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ LOGGER.error("Packet with ID {} was too large and was not caught. Please report this to the Scissors developers.", i);
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return packet;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
// Paper start
|
||||||
|
private static int MAX_PACKET_SIZE = 2097152;
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
||||||
|
index 60d72e488bc77cd913328be400ca374a873b4561..1af2260e7bab81fca24784172dd31e06e9adb1e1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
||||||
|
@@ -50,6 +50,13 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
+ // Scissors start
|
||||||
|
+ public void clearNBT() {
|
||||||
|
+ this.blockEntitiesTags.clear();
|
||||||
|
+ this.extraPackets.clear();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
// Paper start - Anti-Xray - Add chunk packet info
|
||||||
|
@Deprecated public ClientboundLevelChunkPacket(LevelChunk chunk) { this(chunk, true); } // Notice for updates: Please make sure this constructor isn't used anywhere
|
||||||
|
public ClientboundLevelChunkPacket(LevelChunk chunk, boolean modifyBlocks) {
|
@ -1,162 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: ayunami2000 <spwilliamsiam@gmail.com>
|
|
||||||
Date: Mon, 28 Mar 2022 17:02:21 -0400
|
|
||||||
Subject: [PATCH] block server-side chunkbans
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
index b039a32b805fc02033fa862a1c40c4a51639e69a..1d407ebea9ff2932f93b7d6842b0e2a4e801b48c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
|
|
||||||
@@ -4,9 +4,17 @@ import io.netty.buffer.ByteBuf;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
|
||||||
import io.papermc.paper.adventure.PaperAdventure; // Paper
|
|
||||||
+
|
|
||||||
import java.io.IOException;
|
|
||||||
+
|
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.protocol.Packet;
|
|
||||||
import net.minecraft.network.protocol.PacketFlow;
|
|
||||||
+import net.minecraft.network.protocol.game.*;
|
|
||||||
+import net.minecraft.network.syncher.SynchedEntityData;
|
|
||||||
+import net.minecraft.server.MinecraftServer;
|
|
||||||
+import net.minecraft.world.item.ItemStack;
|
|
||||||
+import net.minecraft.world.level.chunk.LevelChunk;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.apache.logging.log4j.Marker;
|
|
||||||
@@ -44,27 +52,93 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
|
||||||
packet.write(friendlyByteBuf);
|
|
||||||
int j = friendlyByteBuf.writerIndex() - i;
|
|
||||||
if (j > 8388608) {
|
|
||||||
- throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
|
|
||||||
+ // Scissors start
|
|
||||||
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
|
||||||
+ //throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
} catch (Throwable var9) {
|
|
||||||
+ // Scissors start
|
|
||||||
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
|
||||||
+ /*
|
|
||||||
LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var9); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE?
|
|
||||||
if (packet.isSkippable()) {
|
|
||||||
throw new SkipPacketException(var9);
|
|
||||||
} else {
|
|
||||||
throw var9;
|
|
||||||
}
|
|
||||||
+ */
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paper start
|
|
||||||
int packetLength = friendlyByteBuf.readableBytes();
|
|
||||||
if (packetLength > MAX_PACKET_SIZE) {
|
|
||||||
- throw new PacketTooLargeException(packet, packetLength);
|
|
||||||
+ // Scissors start
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ noKicking(friendlyByteBuf, packet, integer, channelHandlerContext);
|
|
||||||
+ packetLength = friendlyByteBuf.readableBytes();
|
|
||||||
+ if (packetLength > MAX_PACKET_SIZE) {
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ //throw new PacketTooLargeException(packet, packetLength);
|
|
||||||
+ }
|
|
||||||
+ //throw new PacketTooLargeException(packet, packetLength);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ private static void noKicking(FriendlyByteBuf friendlyByteBuf, Packet packet, Integer integer, ChannelHandlerContext channelHandlerContext) {
|
|
||||||
+ // no kicking!!
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ friendlyByteBuf.writeVarInt(integer);
|
|
||||||
+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
|
|
||||||
+ boolean didIt = true;
|
|
||||||
+ if (packet instanceof ClientboundBlockEntityDataPacket blockEntityDataPacket) {
|
|
||||||
+ packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag());
|
|
||||||
+ } else if (packet instanceof ClientboundLevelChunkPacket chunkPacket) {
|
|
||||||
+ chunkPacket.clearNbt();
|
|
||||||
+ } else if (packet instanceof ClientboundSetEntityDataPacket entityDataPacket) {
|
|
||||||
+ friendlyByteBuf.writeVarInt(entityDataPacket.getId());
|
|
||||||
+ friendlyByteBuf.writeByte(255);
|
|
||||||
+ didIt = false;//prevent default packet writing
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) {
|
|
||||||
+ containerSetContentPacket.clearNbt();
|
|
||||||
+ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) {
|
|
||||||
+ friendlyByteBuf.writeVarInt(setEquipmentPacket.getEntity());
|
|
||||||
+ didIt = false;//prevent default
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket) {
|
|
||||||
+ //i really would rather cancel this packet entirely buuut idk how sOOOOoooo
|
|
||||||
+ friendlyByteBuf.writeByte(containerSetSlotPacket.getContainerId());
|
|
||||||
+ friendlyByteBuf.writeVarInt(containerSetSlotPacket.getStateId());
|
|
||||||
+ friendlyByteBuf.writeShort(containerSetSlotPacket.getSlot());
|
|
||||||
+ friendlyByteBuf.writeItem(ItemStack.EMPTY);
|
|
||||||
+ didIt = false;//prevent default
|
|
||||||
+ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) {
|
|
||||||
+ packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(),mapItemDataPacket.getScale(),mapItemDataPacket.isLocked(),null,null);
|
|
||||||
+ } else {
|
|
||||||
+ didIt = false;
|
|
||||||
+ LOGGER.info(packet.getClass().getName() + " overflowed/errored and was not caught!!");
|
|
||||||
+ }
|
|
||||||
+ if (didIt) {
|
|
||||||
+ try {
|
|
||||||
+ int i = friendlyByteBuf.writerIndex();
|
|
||||||
+ packet.write(friendlyByteBuf);
|
|
||||||
+ int j = friendlyByteBuf.writerIndex() - i;
|
|
||||||
+ if (j > 8388608) {
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ //throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet);
|
|
||||||
+ }
|
|
||||||
+ } catch (Throwable var69) {
|
|
||||||
+ friendlyByteBuf.clear();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start
|
|
||||||
private static int MAX_PACKET_SIZE = 2097152;
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
||||||
index dbd8b9b09b82c1b75e8be9dc7416d9f0863c8c87..f71f68d1482f7e0481a95533e42e8ee5089f15ff 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
||||||
@@ -10,7 +10,14 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
|
|
||||||
private final int containerId;
|
|
||||||
private final int stateId;
|
|
||||||
private final List<ItemStack> items;
|
|
||||||
- private final ItemStack carriedItem;
|
|
||||||
+ private ItemStack carriedItem; // Scissors - removed "final"
|
|
||||||
+
|
|
||||||
+ // Scissors start
|
|
||||||
+ public void clearNbt(){
|
|
||||||
+ this.items.clear();
|
|
||||||
+ this.carriedItem = ItemStack.EMPTY;
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
|
|
||||||
public ClientboundContainerSetContentPacket(int syncId, int revision, NonNullList<ItemStack> contents, ItemStack cursorStack) {
|
|
||||||
this.containerId = syncId;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
|
||||||
index 60d72e488bc77cd913328be400ca374a873b4561..89c385c5ec88c8b51f9e118b65f3b9c2a58c7d9b 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
|
|
||||||
@@ -50,6 +50,13 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
|
|
||||||
+ // Scissors start
|
|
||||||
+ public void clearNbt() {
|
|
||||||
+ this.blockEntitiesTags.clear();
|
|
||||||
+ this.extraPackets.clear();
|
|
||||||
+ }
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start - Anti-Xray - Add chunk packet info
|
|
||||||
@Deprecated public ClientboundLevelChunkPacket(LevelChunk chunk) { this(chunk, true); } // Notice for updates: Please make sure this constructor isn't used anywhere
|
|
||||||
public ClientboundLevelChunkPacket(LevelChunk chunk, boolean modifyBlocks) {
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
index 2e3220cbbea5f6cb9acb7f8fbaf2ff8f91b09234..8018709dfce483a9000ada93cf47812fd49458a8 100644
|
index 2e3220cbbea5f6cb9acb7f8fbaf2ff8f91b09234..3ea83a093f698a055566f45a7927c289ff9a6955 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
@@ -45,6 +45,7 @@ import net.minecraft.nbt.NbtIo;
|
@@ -45,6 +45,7 @@ import net.minecraft.nbt.NbtIo;
|
||||||
@ -22,7 +22,7 @@ index 2e3220cbbea5f6cb9acb7f8fbaf2ff8f91b09234..8018709dfce483a9000ada93cf47812f
|
|||||||
|
|
||||||
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
||||||
- if (attributeName == null || attributeName.isEmpty()) {
|
- if (attributeName == null || attributeName.isEmpty()) {
|
||||||
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() < 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ index d02339a07e1da56fd5dc171a5e32b00d63fa555c..fe6cb52573ee50a2c02d7add38b5e841
|
|||||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
||||||
package net.minecraft.world.item;
|
package net.minecraft.world.item;
|
||||||
|
|
||||||
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@ -175,10 +175,10 @@ index d02339a07e1da56fd5dc171a5e32b00d63fa555c..fe6cb52573ee50a2c02d7add38b5e841
|
|||||||
+import java.util.function.Predicate;
|
+import java.util.function.Predicate;
|
||||||
+import java.util.stream.Collectors;
|
+import java.util.stream.Collectors;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public final class ItemStack {
|
public final class ItemStack {
|
||||||
@@ -245,6 +219,13 @@ public final class ItemStack {
|
@@ -245,6 +219,13 @@ public final class ItemStack {
|
||||||
|
|
||||||
// CraftBukkit - break into own method
|
// CraftBukkit - break into own method
|
||||||
private void load(CompoundTag nbttagcompound) {
|
private void load(CompoundTag nbttagcompound) {
|
||||||
+ // Scissors start - Reset large tags
|
+ // Scissors start - Reset large tags
|
||||||
@ -202,7 +202,7 @@ index d02339a07e1da56fd5dc171a5e32b00d63fa555c..fe6cb52573ee50a2c02d7add38b5e841
|
|||||||
+ }
|
+ }
|
||||||
+ // Scissors end
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
|
|
||||||
return nbt;
|
return nbt;
|
||||||
@@ -815,6 +800,9 @@ public final class ItemStack {
|
@@ -815,6 +800,9 @@ public final class ItemStack {
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ index 14da2997b5fff4434b1fe8d5a1b3109dde143740..a4385cea2d472611cfc7ef43662367bb
|
|||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||||
@@ -1,16 +1,12 @@
|
@@ -1,16 +1,12 @@
|
||||||
package org.bukkit.craftbukkit.inventory;
|
package org.bukkit.craftbukkit.inventory;
|
||||||
|
|
||||||
-import static org.bukkit.craftbukkit.inventory.CraftMetaItem.*;
|
-import static org.bukkit.craftbukkit.inventory.CraftMetaItem.*;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
-import java.util.Map;
|
-import java.util.Map;
|
||||||
@ -238,7 +238,7 @@ index 14da2997b5fff4434b1fe8d5a1b3109dde143740..a4385cea2d472611cfc7ef43662367bb
|
|||||||
@@ -19,6 +15,11 @@ import org.bukkit.inventory.ItemStack;
|
@@ -19,6 +15,11 @@ import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
+import java.util.Map;
|
+import java.util.Map;
|
||||||
+
|
+
|
||||||
+import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS_ID;
|
+import static org.bukkit.craftbukkit.inventory.CraftMetaItem.ENCHANTMENTS_ID;
|
||||||
@ -246,4 +246,4 @@ index 14da2997b5fff4434b1fe8d5a1b3109dde143740..a4385cea2d472611cfc7ef43662367bb
|
|||||||
+
|
+
|
||||||
@DelegateDeserialization(ItemStack.class)
|
@DelegateDeserialization(ItemStack.class)
|
||||||
public final class CraftItemStack extends ItemStack {
|
public final class CraftItemStack extends ItemStack {
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ index 99a5074adbe2a254ae6115b3548f1fcd30ba2489..68ae4dfe3f4a77605b19607b5f04a2a6
|
|||||||
--- 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
|
||||||
@@ -623,7 +623,7 @@ public abstract class LivingEntity extends Entity {
|
@@ -623,7 +623,7 @@ public abstract class LivingEntity extends Entity {
|
||||||
|
|
||||||
protected void tickDeath() {
|
protected void tickDeath() {
|
||||||
++this.deathTime;
|
++this.deathTime;
|
||||||
- if (this.deathTime >= 20 && !this.isRemoved() && !this.level.isClientSide()) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
- if (this.deathTime >= 20 && !this.isRemoved() && !this.level.isClientSide()) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
||||||
|
@ -0,0 +1,109 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
|
Date: Thu, 21 Apr 2022 13:52:32 +0100
|
||||||
|
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
||||||
|
vehicles if they collide with more than 15 other entities
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
|
index 309bafd257d4932cfd69c2c212b32306938cd234..17c6aef70089730d9ca3d20d242f6755851b9494 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||||
|
@@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
+import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.BlockUtil;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
@@ -109,6 +110,7 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
|
private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
|
private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
|
private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
|
||||||
|
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
||||||
|
public double maxSpeed = 0.4D;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@@ -425,8 +427,10 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
|
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
|
||||||
|
List<Entity> list = this.level.getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||||
|
|
||||||
|
- if (!list.isEmpty()) {
|
||||||
|
- for (int l = 0; l < list.size(); ++l) {
|
||||||
|
+ // Scissors - Add a collision debounce
|
||||||
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
|
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||||
|
+ for (int l = 0; l < Math.min(3, list.size()); ++l) {
|
||||||
|
Entity entity = (Entity) list.get(l);
|
||||||
|
|
||||||
|
if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) {
|
||||||
|
@@ -453,6 +457,16 @@ public abstract class AbstractMinecart extends Entity {
|
||||||
|
entity.push(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Scissors - Add a collision debounce
|
||||||
|
+ if (list.size() > 3) {
|
||||||
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors - Delete entity if the collision amount is over 15
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Iterator iterator = this.level.getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
|
index 391454a58d18d7373b974e094fd62514ca0d0b6b..52b75015c89be054ef2bfe1f4780a69540b0f032 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||||
|
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.UnmodifiableIterator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
+import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.BlockUtil;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -108,6 +109,7 @@ public class Boat extends Entity {
|
||||||
|
public double unoccupiedDeceleration = -1;
|
||||||
|
public boolean landBoats = false;
|
||||||
|
// CraftBukkit end
|
||||||
|
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
|
||||||
|
|
||||||
|
public Boat(EntityType<? extends Boat> type, Level world) {
|
||||||
|
super(type, world);
|
||||||
|
@@ -400,10 +402,12 @@ public class Boat extends Entity {
|
||||||
|
this.checkInsideBlocks();
|
||||||
|
List<Entity> list = this.level.getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
|
||||||
|
|
||||||
|
- if (!list.isEmpty()) {
|
||||||
|
+ // Scissors - Add collision debounce
|
||||||
|
+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability
|
||||||
|
boolean flag = !this.level.isClientSide && !(this.getControllingPassenger() instanceof Player);
|
||||||
|
|
||||||
|
- for (int j = 0; j < list.size(); ++j) {
|
||||||
|
+ // Scissors - Limit amount of vehicle collision checks to 3 maximum
|
||||||
|
+ for (int j = 0; j < Math.min(3, list.size()); ++j) {
|
||||||
|
Entity entity = (Entity) list.get(j);
|
||||||
|
|
||||||
|
if (!entity.hasPassenger(this)) {
|
||||||
|
@@ -414,6 +418,16 @@ public class Boat extends Entity {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Scissors - Add collision debounce
|
||||||
|
+ if (list.size() > 3) {
|
||||||
|
+ lastLargeCollision = System.currentTimeMillis();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors - Delete entity if the collision amount is over 15
|
||||||
|
+ if (list.size() > 15) {
|
||||||
|
+ this.discard();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 1 May 2022 01:19:36 +0100
|
||||||
|
Subject: [PATCH] Make the maximum tag size a constant & add a method for
|
||||||
|
getting tag size
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||||
|
index 058203440fd071ce5edbe18391ea60f0a5fbee3a..978cb98c81195640fb3704d2077148f2be0dca36 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
||||||
|
@@ -1,17 +1,49 @@
|
||||||
|
package com.github.atlasmediagroup.scissors;
|
||||||
|
|
||||||
|
-import net.minecraft.nbt.CompoundTag;
|
||||||
|
+import com.google.common.base.Strings;
|
||||||
|
+import com.google.common.collect.Lists;
|
||||||
|
+import net.minecraft.nbt.*;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
+import java.util.Collections;
|
||||||
|
+import java.util.List;
|
||||||
|
|
||||||
|
public class NbtUtility
|
||||||
|
{
|
||||||
|
+ public static final long MAXIMUM_SIZE = (256 * 1024);
|
||||||
|
+
|
||||||
|
+ public static long getTagSize(@Nullable Tag tag, int depth) {
|
||||||
|
+ if(depth > 512) return 0;
|
||||||
|
+ if(tag == null) return 0;
|
||||||
|
+
|
||||||
|
+ long size = 0;
|
||||||
|
+
|
||||||
|
+ if(tag.getType() == CompoundTag.TYPE) {
|
||||||
|
+ CompoundTag compoundTag = (CompoundTag) tag;
|
||||||
|
+ for(String key : compoundTag.getAllKeys()) {
|
||||||
|
+ size += getTagSize(compoundTag.get(key), depth + 1);
|
||||||
|
+ }
|
||||||
|
+ } else if(tag.getType() == ListTag.TYPE) {
|
||||||
|
+ ListTag listTag = (ListTag) tag;
|
||||||
|
+ for (Tag tag1 : listTag) {
|
||||||
|
+ size += getTagSize(tag1, depth + 1);
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ size += tag.getAsString().getBytes(StandardCharsets.UTF_8).length;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return size;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static long getTagSize(@Nullable CompoundTag tag) {
|
||||||
|
+ return getTagSize(tag, 0);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
public static boolean isTooLarge(@Nullable CompoundTag tag)
|
||||||
|
{
|
||||||
|
if (tag == null) return false;
|
||||||
|
- return tag.toString().getBytes(StandardCharsets.UTF_8).length > (256 * 1024);
|
||||||
|
+ return getTagSize(tag) > MAXIMUM_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Item
|
267
patches/server/0032-Account-for-items-inside-containers.patch
Normal file
267
patches/server/0032-Account-for-items-inside-containers.patch
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 1 May 2022 01:20:13 +0100
|
||||||
|
Subject: [PATCH] Account for items inside containers
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
index 4092c7a8c2b0d9d26e6f4d97386735236300d132..ad3af6d90b68bc55c29243da8814516575299bf0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
@@ -22,10 +23,14 @@ public class ContainerHelper {
|
||||||
|
|
||||||
|
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
|
||||||
|
ListTag listTag = new ListTag();
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < stacks.size(); ++i) {
|
||||||
|
ItemStack itemStack = stacks.get(i);
|
||||||
|
+
|
||||||
|
if (!itemStack.isEmpty()) {
|
||||||
|
+ total += NbtUtility.getTagSize(itemStack.getTag());
|
||||||
|
CompoundTag compoundTag = new CompoundTag();
|
||||||
|
compoundTag.putByte("Slot", (byte)i);
|
||||||
|
itemStack.save(compoundTag);
|
||||||
|
@@ -33,7 +38,7 @@ public class ContainerHelper {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!listTag.isEmpty() || setIfEmpty) {
|
||||||
|
+ if ((!listTag.isEmpty() || setIfEmpty) && !(total > NbtUtility.MAXIMUM_SIZE)) {
|
||||||
|
nbt.put("Items", listTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -42,11 +47,18 @@ public class ContainerHelper {
|
||||||
|
|
||||||
|
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
|
||||||
|
ListTag listTag = nbt.getList("Items", 10);
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < listTag.size(); ++i) {
|
||||||
|
CompoundTag compoundTag = listTag.getCompound(i);
|
||||||
|
int j = compoundTag.getByte("Slot") & 255;
|
||||||
|
if (j >= 0 && j < stacks.size()) {
|
||||||
|
+ total += NbtUtility.getTagSize(compoundTag);
|
||||||
|
+ if (total >= NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ stacks.clear();
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
stacks.set(j, ItemStack.of(compoundTag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
index 1bb79768fe3be8a44a00e1f8686f95eed0dc2cf2..73e95e631ac622de897775399d205de66c4d8ff8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
|
||||||
|
@@ -209,6 +210,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||||
|
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||||
|
index f494063ead9c6303fb3ca880aba2a877ae8d83ab..7ec2f7f9ea8e75d5a04c700fce783a21a9b560f8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
@@ -35,6 +36,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
|
index 3e71a16ae77601f589f4283a72ef8b68aae60db3..27fb605dbaefbb3a8eed25a519af4062e67aee26 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
@@ -72,6 +73,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||||
|
index 52de9852f87d346714a950b60a0004d386ac10f0..14854956a81c5f6da4d3f3ff2e910f37f32c21f7 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
@@ -41,6 +42,17 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||||
|
index cfec89db4300bdb96a220540ee87892d22215e9d..ea14263bc11a80657b099342c1d6bb239ea1c80e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import java.util.Random;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
@@ -31,6 +32,17 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
index 06ffdf7301c8c9a02b4aa3693c69984064c8e085..ed28d8a30f9238a94ff6aff00740b77d12bfb8d6 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
@@ -53,7 +54,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
private int maxStack = MAX_STACK;
|
||||||
|
|
||||||
|
public List<ItemStack> getContents() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.items) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.items.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.items;
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onOpen(CraftHumanEntity who) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||||
|
index 01d77f800a1497418f08b8d52b0b7995bfbb5f4e..281d5f875de4bfaca1efc281e595cfa0dc492ede 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.NbtUtility;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
@@ -257,7 +258,19 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected NonNullList<ItemStack> getItems() {
|
||||||
|
+ // Scissors - Account for items inside containers
|
||||||
|
+ long total = 0;
|
||||||
|
+
|
||||||
|
+ for (ItemStack item : this.itemStacks) {
|
||||||
|
+ total += NbtUtility.getTagSize(item.getOrCreateTag());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (total > NbtUtility.MAXIMUM_SIZE) {
|
||||||
|
+ this.itemStacks.clear();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return this.itemStacks;
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
21
patches/server/0033-Don-t-log-invalid-teams-to-console.patch
Normal file
21
patches/server/0033-Don-t-log-invalid-teams-to-console.patch
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 17 May 2022 05:57:52 +0100
|
||||||
|
Subject: [PATCH] Don't log invalid teams to console
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
index 68ae4dfe3f4a77605b19607b5f04a2a6d07d6fc8..b7efb87767570992e9bb14510e510f2b37ec2226 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
|
@@ -816,7 +816,9 @@ public abstract class LivingEntity extends Entity {
|
||||||
|
boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||||
|
|
||||||
|
if (!flag) {
|
||||||
|
- LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
||||||
|
+ // Scissors start - Prevent log spam possible with this error message, easily provokable by players in creative.
|
||||||
|
+ // LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s);
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Video <videogamesm12@gmail.com>
|
||||||
|
Date: Fri, 19 Aug 2022 00:49:38 -0600
|
||||||
|
Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
index ca9decf85dd1af0baf0d34a48aa67cbb9f4eb586..50cbd324b87300d6b872581571fa97ad9fa54396 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
@@ -265,7 +265,11 @@ public abstract class HangingEntity extends Entity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
|
- this.pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||||
|
+ // Scissors start - Fixes exploit where bad TileX, TileY, and TileZ coordinates can crash servers
|
||||||
|
+ BlockPos pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||||
|
+ if (level.isLoadedAndInBounds(pos))
|
||||||
|
+ this.pos = pos;
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int getWidth();
|
199
patches/server/0035-Add-MasterBlockFireEvent.patch
Normal file
199
patches/server/0035-Add-MasterBlockFireEvent.patch
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 4 Jul 2022 17:02:52 +0100
|
||||||
|
Subject: [PATCH] Add MasterBlockFireEvent
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
|
index fd73e9100feac8c7bf9a5fee21a0ab2d502dc3e0..4912d24683f5094b0b93798c3ad378516eed4746 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
|
-import java.util.Random;
|
||||||
|
+import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
@@ -25,8 +25,10 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
|
|
||||||
|
-import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
|
+import java.util.Random;
|
||||||
|
|
||||||
|
public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
|
|
||||||
|
@@ -116,6 +118,15 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (hasCommand) {
|
||||||
|
executor.performCommand(world);
|
||||||
|
} else {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/StructureBlock.java b/src/main/java/net/minecraft/world/level/block/StructureBlock.java
|
||||||
|
index 4142687c6bb08ac8a156fcaee39ce26308924615..fd9b338117f5cb4575b60bb5bc5664c548132265 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,8 @@
|
||||||
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
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
|
||||||
|
index c391db3b6cbe3140a92aec44fb52e90455209217..c93d21142c5f7b2799eeac7a8314ffdb7360162e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
@@ -28,6 +29,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.PoolElementStructurePiece;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class JigsawBlockEntity extends BlockEntity {
|
||||||
|
public static final String TARGET = "target";
|
||||||
|
@@ -120,11 +122,21 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
ChunkGenerator chunkGenerator = world.getChunkSource().getGenerator();
|
||||||
|
StructureManager structureManager = world.getStructureManager();
|
||||||
|
StructureFeatureManager structureFeatureManager = world.structureFeatureManager();
|
||||||
|
Random random = world.getRandom();
|
||||||
|
- BlockPos blockPos = this.getBlockPos();
|
||||||
|
+ // BlockPos blockPos = this.getBlockPos(); // Scissors - We've already defined this in the scope
|
||||||
|
List<PoolElementStructurePiece> list = Lists.newArrayList();
|
||||||
|
StructureTemplate structureTemplate = new StructureTemplate();
|
||||||
|
structureTemplate.fillFromWorld(world, blockPos, new Vec3i(1, 1, 1), false, (Block)null);
|
||||||
|
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 a9b186e5a60838443d2ad2ee82ed3f4803a4899a..9134c8fc0b9363eadf6da288029b7a33c6d5d405 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
|
@@ -6,6 +6,8 @@ import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import net.minecraft.ResourceLocationException;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -29,6 +31,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class StructureBlockEntity extends BlockEntity {
|
||||||
|
private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
|
||||||
|
@@ -266,7 +269,6 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
BlockPos blockPos = this.getBlockPos();
|
||||||
|
- int i = 80;
|
||||||
|
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
|
||||||
|
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
|
||||||
|
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
|
||||||
|
@@ -323,6 +325,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
public boolean saveStructure(boolean bl) {
|
||||||
|
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final BlockPos pos = this.getBlockPos();
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
|
||||||
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
|
StructureManager structureManager = serverLevel.getStructureManager();
|
||||||
|
@@ -360,6 +372,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
public boolean loadStructure(ServerLevel world, boolean bl) {
|
||||||
|
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
StructureManager structureManager = world.getStructureManager();
|
||||||
|
|
||||||
|
Optional<StructureTemplate> optional;
|
||||||
|
@@ -376,7 +398,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean loadStructure(ServerLevel world, boolean bl, StructureTemplate structureTemplate) {
|
||||||
|
- BlockPos blockPos = this.getBlockPos();
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (!StringUtil.isNullOrEmpty(structureTemplate.getAuthor())) {
|
||||||
|
this.author = structureTemplate.getAuthor();
|
||||||
|
}
|
||||||
|
@@ -405,6 +436,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unloadStructure() {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final BlockPos blockPos = this.getBlockPos();
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.structureName != null) {
|
||||||
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
|
StructureManager structureManager = serverLevel.getStructureManager();
|
32
patches/server/0036-Add-spectator-teleport-event.patch
Normal file
32
patches/server/0036-Add-spectator-teleport-event.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 5 Jul 2022 03:34:36 +0100
|
||||||
|
Subject: [PATCH] Add spectator teleport event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 83333ae9c8e8c1edc6e7f02468bd8dc7e44bb66e..ca595abe940463a62da033c7082c868c4c4b28d8 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 com.github.atlasmediagroup.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
import com.mojang.brigadier.ParseResults;
|
||||||
|
@@ -1905,6 +1906,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
Entity entity = packet.getEntity(worldserver);
|
||||||
|
|
||||||
|
if (entity != null) {
|
||||||
|
+ // Scissors start - Add spectator teleport event
|
||||||
|
+ final SpectatorTeleportEvent event = new SpectatorTeleportEvent(this.player.getBukkitEntity(), entity.getBukkitEntity());
|
||||||
|
+
|
||||||
|
+ if(!event.callEvent()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
this.player.teleportTo(worldserver, entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit
|
||||||
|
return;
|
||||||
|
}
|
52
patches/server/0037-Prevent-invalid-container-events.patch
Normal file
52
patches/server/0037-Prevent-invalid-container-events.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 02:20:16 +0100
|
||||||
|
Subject: [PATCH] Prevent invalid container events
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index ca595abe940463a62da033c7082c868c4c4b28d8..a102586b42ac408a3f655f7c0d069ab0990ec7fc 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -24,6 +24,8 @@ import java.util.function.UnaryOperator;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.CrashReport;
|
||||||
|
import net.minecraft.CrashReportCategory;
|
||||||
|
@@ -2593,6 +2595,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
public void handleContainerClick(ServerboundContainerClickPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
if (this.player.isImmobile()) return; // CraftBukkit
|
||||||
|
+
|
||||||
|
this.player.resetLastActionTime();
|
||||||
|
if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit
|
||||||
|
boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
|
||||||
|
@@ -2602,11 +2605,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
boolean flag = packet.getStateId() != this.player.containerMenu.getStateId();
|
||||||
|
|
||||||
|
this.player.containerMenu.suppressRemoteUpdates();
|
||||||
|
+
|
||||||
|
// CraftBukkit start - Call InventoryClickEvent
|
||||||
|
if (packet.getSlotNum() < -1 && packet.getSlotNum() != -999) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Do not call events when the slot/button number is invalid
|
||||||
|
+ final int sentSlotNum = packet.getSlotNum();
|
||||||
|
+ if((Mth.clamp(sentSlotNum, -1, this.player.containerMenu.slots.size() - 1) != sentSlotNum) && sentSlotNum != -999)
|
||||||
|
+ {
|
||||||
|
+ this.getCraftPlayer().kick(
|
||||||
|
+ net.kyori.adventure.text.Component.text("Invalid container click slot (Hacking?)")
|
||||||
|
+ .color(NamedTextColor.RED)
|
||||||
|
+ );
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
InventoryView inventory = this.player.containerMenu.getBukkitView();
|
||||||
|
SlotType type = inventory.getSlotType(packet.getSlotNum());
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 02:25:28 +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 73e95e631ac622de897775399d205de66c4d8ff8..c3fd536cebb2f8664f9bf86d322f88094677d2b5 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
|
||||||
|
@@ -629,6 +629,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
|
||||||
|
});
|
445
patches/server/0039-Add-Scissors-config-command.patch
Normal file
445
patches/server/0039-Add-Scissors-config-command.patch
Normal file
@ -0,0 +1,445 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 07:53:59 +0100
|
||||||
|
Subject: [PATCH] Add Scissors config & command
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
|
index e29b0a90019b12bd6586ad0f7b5314f307e527ba..c6f19e178f8c5a03f9fb8b011f329ef81e4e35d8 100644
|
||||||
|
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
|
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
|
@@ -23,6 +23,7 @@
|
||||||
|
*/
|
||||||
|
package co.aikar.timings;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
@@ -228,7 +229,8 @@ public class TimingsExport extends Thread {
|
||||||
|
parent.put("config", createObject(
|
||||||
|
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
|
||||||
|
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
|
||||||
|
- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null))
|
||||||
|
+ pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)),
|
||||||
|
+ pair("scissors", mapAsJSON(ScissorsConfig.config, null)) // Scissors
|
||||||
|
));
|
||||||
|
|
||||||
|
new TimingsExport(listeners, parent, history).start();
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsCommand.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsCommand.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..f5202deac5b3a715a22d0d482f1302b6074b26ac
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsCommand.java
|
||||||
|
@@ -0,0 +1,150 @@
|
||||||
|
+package com.github.atlasmediagroup.scissors;
|
||||||
|
+
|
||||||
|
+import com.google.common.base.Functions;
|
||||||
|
+import com.google.common.base.Joiner;
|
||||||
|
+import com.google.common.collect.ImmutableSet;
|
||||||
|
+import com.google.common.collect.Iterables;
|
||||||
|
+import com.google.common.collect.Lists;
|
||||||
|
+import net.minecraft.resources.ResourceLocation;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.ChatColor;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+import org.bukkit.command.Command;
|
||||||
|
+import org.bukkit.command.CommandSender;
|
||||||
|
+
|
||||||
|
+import java.io.File;
|
||||||
|
+import java.util.*;
|
||||||
|
+import java.util.stream.Collectors;
|
||||||
|
+
|
||||||
|
+public class ScissorsCommand extends Command
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final String BASE_PERM = "bukkit.command.scissors.";
|
||||||
|
+ private static final ImmutableSet<String> SUBCOMMANDS = ImmutableSet.<String>builder().add("reload", "version").build();
|
||||||
|
+
|
||||||
|
+ public ScissorsCommand(String name)
|
||||||
|
+ {
|
||||||
|
+ super(name);
|
||||||
|
+ this.description = "Scissors related commands";
|
||||||
|
+ this.usageMessage = "/scissors [" + Joiner.on(" | ").join(SUBCOMMANDS) + "]";
|
||||||
|
+ this.setPermission("bukkit.command.scissors;" + Joiner.on(';').join(SUBCOMMANDS.stream().map(s -> BASE_PERM + s).collect(Collectors.toSet())));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static boolean testPermission(CommandSender commandSender, String permission)
|
||||||
|
+ {
|
||||||
|
+ if (commandSender.hasPermission(BASE_PERM + permission) || commandSender.hasPermission("bukkit.command.scissors"))
|
||||||
|
+ return true;
|
||||||
|
+ commandSender.sendMessage(Bukkit.getPermissionMessage()); // Sorry, kashike
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Code from Mojang - copyright them
|
||||||
|
+ public static List<String> getListMatchingLast(CommandSender sender, String[] args, String... matches)
|
||||||
|
+ {
|
||||||
|
+ return getListMatchingLast(sender, args, Arrays.asList(matches));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static boolean matches(String s, String s1)
|
||||||
|
+ {
|
||||||
|
+ return s1.regionMatches(true, 0, s, 0, s.length());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static List<String> getListMatchingLast(CommandSender sender, String[] strings, Collection<?> collection)
|
||||||
|
+ {
|
||||||
|
+ String last = strings[strings.length - 1];
|
||||||
|
+ ArrayList<String> results = Lists.newArrayList();
|
||||||
|
+
|
||||||
|
+ if (!collection.isEmpty())
|
||||||
|
+ {
|
||||||
|
+ Iterator iterator = Iterables.transform(collection, Functions.toStringFunction()).iterator();
|
||||||
|
+
|
||||||
|
+ while (iterator.hasNext())
|
||||||
|
+ {
|
||||||
|
+ String s1 = (String) iterator.next();
|
||||||
|
+
|
||||||
|
+ if (matches(last, s1) && (sender.hasPermission(BASE_PERM + s1) || sender.hasPermission("bukkit.command.scissors")))
|
||||||
|
+ {
|
||||||
|
+ results.add(s1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (results.isEmpty())
|
||||||
|
+ {
|
||||||
|
+ iterator = collection.iterator();
|
||||||
|
+
|
||||||
|
+ while (iterator.hasNext())
|
||||||
|
+ {
|
||||||
|
+ Object object = iterator.next();
|
||||||
|
+
|
||||||
|
+ if (object instanceof ResourceLocation && matches(last, ((ResourceLocation) object).getPath()))
|
||||||
|
+ {
|
||||||
|
+ results.add(String.valueOf(object));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return results;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException
|
||||||
|
+ {
|
||||||
|
+ if (args.length <= 1)
|
||||||
|
+ return getListMatchingLast(sender, args, SUBCOMMANDS);
|
||||||
|
+
|
||||||
|
+ return Collections.emptyList();
|
||||||
|
+ }
|
||||||
|
+ // end copy stuff
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||||
|
+ {
|
||||||
|
+ if (!testPermission(sender)) return true;
|
||||||
|
+
|
||||||
|
+ if (args.length == 0)
|
||||||
|
+ {
|
||||||
|
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ if (SUBCOMMANDS.contains(args[0].toLowerCase(Locale.ENGLISH)))
|
||||||
|
+ {
|
||||||
|
+ if (!testPermission(sender, args[0].toLowerCase(Locale.ENGLISH))) return true;
|
||||||
|
+ }
|
||||||
|
+ switch (args[0].toLowerCase(Locale.ENGLISH))
|
||||||
|
+ {
|
||||||
|
+ case "reload":
|
||||||
|
+ doReload(sender);
|
||||||
|
+ break;
|
||||||
|
+ case "ver":
|
||||||
|
+ if (!testPermission(sender, "version"))
|
||||||
|
+ break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set)
|
||||||
|
+ case "version":
|
||||||
|
+ Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
|
||||||
|
+ if (ver != null)
|
||||||
|
+ {
|
||||||
|
+ ver.execute(sender, commandLabel, new String[0]);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ // else - fall through to default
|
||||||
|
+ default:
|
||||||
|
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void doReload(CommandSender sender)
|
||||||
|
+ {
|
||||||
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "Please note that this command is not supported and may cause issues.");
|
||||||
|
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
|
||||||
|
+
|
||||||
|
+ MinecraftServer console = MinecraftServer.getServer();
|
||||||
|
+ ScissorsConfig.init((File) console.options.valueOf("scissors-settings"));
|
||||||
|
+ console.server.reloadCount++;
|
||||||
|
+
|
||||||
|
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Scissors config reload complete.");
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..076379a0e61d74ecaf651b341821e1e30999b3b8
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -0,0 +1,170 @@
|
||||||
|
+package com.github.atlasmediagroup.scissors;
|
||||||
|
+
|
||||||
|
+import com.google.common.base.Throwables;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.command.Command;
|
||||||
|
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
+
|
||||||
|
+import java.io.File;
|
||||||
|
+import java.io.IOException;
|
||||||
|
+import java.lang.reflect.InvocationTargetException;
|
||||||
|
+import java.lang.reflect.Method;
|
||||||
|
+import java.lang.reflect.Modifier;
|
||||||
|
+import java.util.HashMap;
|
||||||
|
+import java.util.List;
|
||||||
|
+import java.util.Map;
|
||||||
|
+import java.util.logging.Level;
|
||||||
|
+import java.util.regex.Pattern;
|
||||||
|
+
|
||||||
|
+public class ScissorsConfig
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final String HEADER = """
|
||||||
|
+ This is the main configuration file for Scissors.
|
||||||
|
+ As you can see, there's tons to configure. Some options may impact gameplay, so use
|
||||||
|
+ with caution, and make sure you know what each option does before configuring.
|
||||||
|
+
|
||||||
|
+ If you need help with the configuration or have any questions related to Scissors,
|
||||||
|
+ join us in our Discord.
|
||||||
|
+
|
||||||
|
+ Discord: https://discord.com/invite/mtVQcHn58h
|
||||||
|
+ Website: https://scissors.gg/\s
|
||||||
|
+ Docs: https://javadoc.scissors.gg/1.17.1/\s
|
||||||
|
+ """;
|
||||||
|
+ private static final Pattern SPACE = Pattern.compile(" ");
|
||||||
|
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||||
|
+ /*========================================================================*/
|
||||||
|
+ public static YamlConfiguration config;
|
||||||
|
+ static int version;
|
||||||
|
+ /*========================================================================*/
|
||||||
|
+ static Map<String, Command> commands;
|
||||||
|
+ private static File CONFIG_FILE;
|
||||||
|
+
|
||||||
|
+ public static void init(File configFile)
|
||||||
|
+ {
|
||||||
|
+ CONFIG_FILE = configFile;
|
||||||
|
+ config = new YamlConfiguration();
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ config.load(CONFIG_FILE);
|
||||||
|
+ }
|
||||||
|
+ catch (IOException ex)
|
||||||
|
+ {
|
||||||
|
+ }
|
||||||
|
+ catch (InvalidConfigurationException ex)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load scissors.yml, please correct your syntax errors", ex);
|
||||||
|
+ throw Throwables.propagate(ex);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ commands = new HashMap<>();
|
||||||
|
+ commands.put("scissors", new ScissorsCommand("scissors"));
|
||||||
|
+
|
||||||
|
+ config.options().header(HEADER);
|
||||||
|
+ config.options().copyDefaults(true);
|
||||||
|
+
|
||||||
|
+ version = getInt("config-version", 1);
|
||||||
|
+ set("config-version", 1);
|
||||||
|
+ readConfig(ScissorsConfig.class, null);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected static void logError(String s)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().severe(s);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected static void fatal(String s)
|
||||||
|
+ {
|
||||||
|
+ throw new RuntimeException("Fatal scissors.yml config error: " + s);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void registerCommands()
|
||||||
|
+ {
|
||||||
|
+ for (Map.Entry<String, Command> entry : commands.entrySet())
|
||||||
|
+ {
|
||||||
|
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Scissors", entry.getValue());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static void readConfig(Class<?> clazz, Object instance)
|
||||||
|
+ {
|
||||||
|
+ for (Method method : clazz.getDeclaredMethods())
|
||||||
|
+ {
|
||||||
|
+ if (Modifier.isPrivate(method.getModifiers()))
|
||||||
|
+ {
|
||||||
|
+ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE)
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ method.setAccessible(true);
|
||||||
|
+ method.invoke(instance);
|
||||||
|
+ }
|
||||||
|
+ catch (InvocationTargetException ex)
|
||||||
|
+ {
|
||||||
|
+ throw Throwables.propagate(ex.getCause());
|
||||||
|
+ }
|
||||||
|
+ catch (Exception ex)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ saveConfig();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static void saveConfig()
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ config.save(CONFIG_FILE);
|
||||||
|
+ }
|
||||||
|
+ catch (IOException ex)
|
||||||
|
+ {
|
||||||
|
+ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static void set(String path, Object val)
|
||||||
|
+ {
|
||||||
|
+ config.set(path, val);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static boolean getBoolean(String path, boolean def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getBoolean(path, config.getBoolean(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static double getDouble(String path, double def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getDouble(path, config.getDouble(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static float getFloat(String path, float def)
|
||||||
|
+ {
|
||||||
|
+ // TODO: Figure out why getFloat() always returns the default value.
|
||||||
|
+ return (float) getDouble(path, def);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static int getInt(String path, int def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getInt(path, config.getInt(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static <T> List getList(String path, T def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getList(path, config.getList(path));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static String getString(String path, String def)
|
||||||
|
+ {
|
||||||
|
+ config.addDefault(path, def);
|
||||||
|
+ return config.getString(path, config.getString(path));
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
|
index 6a00ee7f69bf44c5a9a329df26ac5640b368283b..3fed82a0b271234065767ec37c9ddd0a9f39da27 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
|
@@ -106,6 +106,7 @@ public class Main {
|
||||||
|
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = loadConfigFile((File) optionset.valueOf("bukkit-settings"));
|
||||||
|
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = loadConfigFile((File) optionset.valueOf("spigot-settings"));
|
||||||
|
org.bukkit.configuration.file.YamlConfiguration paperConfiguration = loadConfigFile((File) optionset.valueOf("paper-settings"));
|
||||||
|
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = loadConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
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
|
||||||
|
index b6ee0e709b0f0529b99567bc9b8fb6bfd99bcd8e..4cd18a681dedea26b98002902a3c3b1f47966887 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
@@ -234,7 +234,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
|
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
||||||
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
||||||
|
// Paper end
|
||||||
|
-
|
||||||
|
+ // Scissors start
|
||||||
|
+ try {
|
||||||
|
+ com.github.atlasmediagroup.scissors.ScissorsConfig.init((java.io.File) options.valueOf("scissors-settings"));
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ com.github.atlasmediagroup.scissors.ScissorsConfig.registerCommands();
|
||||||
|
+ // Scissors end
|
||||||
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||||
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||||
|
this.setResourcePack(dedicatedserverproperties.resourcePack, this.getPackHash());
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
index cc797b45674163b5913e20031d110796d78b928b..bb5d6e5405c1781404bfd3d2af9c93026f9c86f0 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -924,6 +924,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
|
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
|
||||||
|
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
|
||||||
|
+ com.github.atlasmediagroup.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors
|
||||||
|
for (ServerLevel world : this.console.getAllLevels()) {
|
||||||
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
|
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||||
|
@@ -979,6 +980,7 @@ public final class CraftServer implements Server {
|
||||||
|
this.reloadData();
|
||||||
|
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||||
|
com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
|
||||||
|
+ com.github.atlasmediagroup.scissors.ScissorsConfig.registerCommands(); // Scissors
|
||||||
|
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||||
|
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||||
|
|
||||||
|
@@ -2566,6 +2568,12 @@ public final class CraftServer implements Server {
|
||||||
|
return com.destroystokyo.paper.PaperConfig.config;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Override
|
||||||
|
+ public YamlConfiguration getScissorsConfig()
|
||||||
|
+ {
|
||||||
|
+ return com.github.atlasmediagroup.scissors.ScissorsConfig.config;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void restart() {
|
||||||
|
org.spigotmc.RestartCommand.restart();
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
index d033caf5dabbd2a240286c5623b3d287ae5cbdd9..facfcc3f478a21240fa2938c94de7dc599eeafd3 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -160,6 +160,14 @@ public class Main {
|
||||||
|
.defaultsTo(new File[] {})
|
||||||
|
.describedAs("Jar file");
|
||||||
|
// Paper end
|
||||||
|
+
|
||||||
|
+ // Scissors start
|
||||||
|
+ acceptsAll(asList("scissors", "scissors-settings"), "File for scissors settings")
|
||||||
|
+ .withRequiredArg()
|
||||||
|
+ .ofType(File.class)
|
||||||
|
+ .defaultsTo(new File("scissors.yml"))
|
||||||
|
+ .describedAs("Yml file");
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,103 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 09:46:20 +0100
|
||||||
|
Subject: [PATCH] Disable running commands in books by default
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
index d0e2bcf4671d723d5893e0a9bc8c6e30a9b83be6..6fcbd02c02d70617e4533b450747c918ec3339d5 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -127,6 +127,12 @@ public class ScissorsConfig
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static boolean runCommandsInBooks = false;
|
||||||
|
+
|
||||||
|
+ private static void runCommandsInBooks() {
|
||||||
|
+ runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
index de11f8b4a783e7aa6029693f6812c950649fe88c..526206f11bdfc2aa7cb88649c47d707678753007 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
@@ -1,7 +1,10 @@
|
||||||
|
package net.minecraft.world.item;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
+import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
+
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
@@ -9,10 +12,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.StringTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
|
-import net.minecraft.network.chat.Component;
|
||||||
|
-import net.minecraft.network.chat.ComponentUtils;
|
||||||
|
-import net.minecraft.network.chat.TextComponent;
|
||||||
|
-import net.minecraft.network.chat.TranslatableComponent;
|
||||||
|
+import net.minecraft.network.chat.*;
|
||||||
|
import net.minecraft.stats.Stats;
|
||||||
|
import net.minecraft.util.StringUtil;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
@@ -113,8 +113,7 @@ public class WrittenBookItem extends Item {
|
||||||
|
|
||||||
|
public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) {
|
||||||
|
CompoundTag compoundTag = book.getTag();
|
||||||
|
- if (compoundTag != null && !compoundTag.getBoolean("resolved")) {
|
||||||
|
- compoundTag.putBoolean("resolved", true);
|
||||||
|
+ if (compoundTag != null) {
|
||||||
|
if (!makeSureTagIsValid(compoundTag)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
@@ -148,8 +147,41 @@ public class WrittenBookItem extends Item {
|
||||||
|
component2 = new TextComponent(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
- return Component.Serializer.toJson(component2);
|
||||||
|
+ return Component.Serializer.toJson(!ScissorsConfig.runCommandsInBooks ? sanitize(component2, 0) : component2); // Scissors - Allow server owners to disable run command in books
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors start - Allow server owners to disable run command in books
|
||||||
|
+ public static Component sanitize(Component component, int depth) {
|
||||||
|
+ if (depth > 128) {
|
||||||
|
+ return Component.nullToEmpty("Sanitization function depth limit exceeded");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ MutableComponent component2 = component.copy();
|
||||||
|
+
|
||||||
|
+ final Style style = component2.getStyle();
|
||||||
|
+ final ClickEvent clickEvent = style.getClickEvent();
|
||||||
|
+
|
||||||
|
+ if(clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND))
|
||||||
|
+ {
|
||||||
|
+ final String clickEventValue = clickEvent.getValue();
|
||||||
|
+
|
||||||
|
+ component2 = component2.copy().setStyle(style
|
||||||
|
+ .withClickEvent(null)
|
||||||
|
+ .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.nullToEmpty("Would've " + (clickEventValue.startsWith("/") ? "ran": "said") + ": " + clickEvent.getValue())))
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ final List<Component> processedExtra = component2.getSiblings()
|
||||||
|
+ .stream()
|
||||||
|
+ .map(comp -> sanitize(comp, depth + 1))
|
||||||
|
+ .toList();
|
||||||
|
+
|
||||||
|
+ component2.getSiblings().clear();
|
||||||
|
+ component2.getSiblings().addAll(processedExtra);
|
||||||
|
+
|
||||||
|
+ return component2;
|
||||||
|
}
|
||||||
|
+ // Scissors end
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFoil(ItemStack stack) {
|
@ -0,0 +1,93 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Wed, 13 Jul 2022 10:16:57 +0100
|
||||||
|
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
index 6fcbd02c02d70617e4533b450747c918ec3339d5..52b0161711634f9ad8cecf58668737a726278f72 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -65,8 +65,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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -133,6 +133,13 @@ public class ScissorsConfig
|
||||||
|
runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // people still may want them to bypass permissions for warps
|
||||||
|
+ public static boolean commandSignsBypassPermissions = false;
|
||||||
|
+ public static void commandSignsBypassPermissions()
|
||||||
|
+ {
|
||||||
|
+ commandSignsBypassPermissions = getBoolean("commandSignsBypassPermissions", false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
index 344d3a8c1162f1a4ab5fc2b7676680ddace46649..5e526ba120b9e4ba77fa4474730aa180dba5eb56 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
@@ -1,11 +1,13 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
+import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Vec3i;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@@ -16,6 +18,7 @@ import net.minecraft.network.chat.MutableComponent;
|
||||||
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
|
@@ -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
|
||||||
|
@@ -237,7 +242,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||||
|
if (!event.callEvent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
- player.getServer().getCommands().performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add optional permissions to command signs
|
||||||
|
+ final MinecraftServer vanillaServer = player.getServer();
|
||||||
|
+ final CraftServer craftServer = vanillaServer.server;
|
||||||
|
+ final CraftPlayer craftPlayer = player.getBukkitEntity();
|
||||||
|
+ final Commands commands = vanillaServer.getCommands();
|
||||||
|
+
|
||||||
|
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||||
|
+ {
|
||||||
|
+ commands.performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
// Paper end
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 11 Jul 2022 17:10:17 -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 a102586b42ac408a3f655f7c0d069ab0990ec7fc..1c56ca1f7ed3064bfd3352cf46741fc64bbee4eb 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1240,7 +1240,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
if (this.player.hasPermissions(2)) {
|
||||||
|
Entity entity = this.player.getLevel().getEntity(packet.getEntityId());
|
||||||
|
|
||||||
|
- if (entity != null) {
|
||||||
|
+ if (entity != null && !isOutsideOfReach(entity.position().x, entity.position().y, entity.position().z)) { // Scissors - Prevent querying of entities out of reach
|
||||||
|
CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag());
|
||||||
|
|
||||||
|
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
|
||||||
|
@@ -1252,8 +1252,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (this.player.hasPermissions(2)) {
|
||||||
|
- BlockEntity tileentity = this.player.getLevel().getBlockEntity(packet.getPos());
|
||||||
|
+ // Scissors start - Validate block entity tag query positions, prevent querying block entities out of reach
|
||||||
|
+ final BlockPos pos = packet.getPos();
|
||||||
|
+ if (this.player.hasPermissions(2) && Level.isInSpawnableBounds(pos) && !isOutsideOfReach(pos.getX(), pos.getY(), pos.getZ())) {
|
||||||
|
+ BlockEntity tileentity = this.player.getLevel().isLoaded(pos) ? this.player.getLevel().getBlockEntity(pos) : null;
|
||||||
|
+ // Scissors end
|
||||||
|
CompoundTag nbttagcompound = tileentity != null ? tileentity.save(new CompoundTag()) : null;
|
||||||
|
|
||||||
|
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
|
@ -0,0 +1,22 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 25 Jul 2022 09:43:20 +0100
|
||||||
|
Subject: [PATCH] Fix out of bound chunks crashing server
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||||
|
index cf1cb0996bb06ae7cf56e0ecf0c01f03da7fdd83..57154a7dd88f00ac7cd78f51ead718853e0d2101 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||||
|
@@ -157,7 +157,10 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||||
|
if (ichunkaccess != null) {
|
||||||
|
throw (RuntimeException) Util.pauseInIde((Throwable) (new RuntimeException(String.format("Chunk is not of correct status. Expecting %s, got %s | %s %s", leastStatus, ichunkaccess.getStatus(), chunkX, chunkZ))));
|
||||||
|
} else {
|
||||||
|
- throw (RuntimeException) Util.pauseInIde((Throwable) (new RuntimeException(String.format("We are asking a region for a chunk out of bound | %s %s", chunkX, chunkZ))));
|
||||||
|
+ // Scissors start - Fix out of bound chunks crashing server
|
||||||
|
+ // throw (RuntimeException) Util.pauseInIde((Throwable) (new RuntimeException(String.format("We are asking a region for a chunk out of bound | %s %s", chunkX, chunkZ))));
|
||||||
|
+ return null;
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 16 Aug 2022 18:14:16 +0100
|
||||||
|
Subject: [PATCH] Refuse to convert legacy messages over 1k characters
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
index 26d43c229caf9f8504af7071c3a61ec6da7e27ec..ecceb3fc7f822d826b4a789fe72a8cd08e90d60e 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
|
||||||
|
@@ -198,6 +198,11 @@ public final class CraftChatMessage {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {
|
||||||
|
+ // Scissors start - Refuse to convert legacy messages over 1k characters
|
||||||
|
+ if (message.length() > 1_000) {
|
||||||
|
+ return new Component[]{TextComponent.EMPTY};
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
return new StringMessage(message, keepNewlines, plain).getOutput();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,227 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: VideoGameSmash12 <videogamesm12@gmail.com>
|
||||||
|
Date: Sun, 2 Oct 2022 19:43:40 -0600
|
||||||
|
Subject: [PATCH] Adds configuration option to outright disable Game Master
|
||||||
|
Blocks and fixes some configuration bugs
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
index 52b0161711634f9ad8cecf58668737a726278f72..bb58d90e9d676761a43a12cbc1c3b687d00654b1 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -65,8 +65,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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -135,11 +135,17 @@ public class ScissorsConfig
|
||||||
|
|
||||||
|
// people still may want them to bypass permissions for warps
|
||||||
|
public static boolean commandSignsBypassPermissions = false;
|
||||||
|
- public static void commandSignsBypassPermissions()
|
||||||
|
+ private static void commandSignsBypassPermissions()
|
||||||
|
{
|
||||||
|
commandSignsBypassPermissions = getBoolean("commandSignsBypassPermissions", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static boolean disableGameMasterBlocks = false;
|
||||||
|
+ private static void disableGameMasterBlocks()
|
||||||
|
+ {
|
||||||
|
+ disableGameMasterBlocks = getBoolean("disableGameMasterBlocks", false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index dbf982c85ff361184a34b462bec331ac5b1a472c..8ec188a09dd1d5150a25fdf18f49deac1593fb4d 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 com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
import com.github.atlasmediagroup.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
@@ -987,7 +988,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (this.player.canUseGameMasterBlocks()) {
|
||||||
|
+ if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockState iblockdata = this.player.level.getBlockState(blockposition);
|
||||||
|
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||||
|
@@ -1045,7 +1046,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (this.player.canUseGameMasterBlocks()) {
|
||||||
|
+ if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockState iblockdata = this.player.level.getBlockState(blockposition);
|
||||||
|
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||||
|
@@ -1068,7 +1069,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (this.player.canUseGameMasterBlocks()) {
|
||||||
|
+ if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||||
|
|
||||||
|
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 c93d21142c5f7b2799eeac7a8314ffdb7360162e..2279b7958c837a9616e8de2c2de53950d2f19a59 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig; // Scissors
|
||||||
|
import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import java.util.Arrays;
|
||||||
|
@@ -122,6 +123,12 @@ public class JigsawBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
// Scissors - Add master block fire event
|
||||||
|
final BlockPos blockPos = this.getBlockPos();
|
||||||
|
final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
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 ed297126ebc05c1eb81e32b7644552d5627b3697..896afd5ce022a4f4d83f2985112bcf0e3fc5f37d 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
|
@@ -7,6 +7,7 @@ import java.util.Random;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import net.minecraft.ResourceLocationException;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
@@ -130,6 +131,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBlockState() {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.level != null) {
|
||||||
|
BlockPos blockPos = this.getBlockPos();
|
||||||
|
BlockState blockState = this.level.getBlockState(blockPos);
|
||||||
|
@@ -152,6 +159,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean usedBy(Player player) {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (!player.canUseGameMasterBlocks()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
@@ -265,6 +278,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean detectSize() {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.mode != StructureMode.SAVE) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
@@ -324,13 +343,18 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean saveStructure(boolean bl) {
|
||||||
|
+ // Scissors - Add option to completely disable structure and jigsaw blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||||
|
// Scissors - Add master block fire event
|
||||||
|
final BlockPos pos = this.getBlockPos();
|
||||||
|
final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
|
|
||||||
|
- if (!event.callEvent())
|
||||||
|
- {
|
||||||
|
+ if (!event.callEvent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Scissors end
|
||||||
|
@@ -371,6 +395,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean loadStructure(ServerLevel world, boolean bl) {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
||||||
|
// Scissors - Add master block fire event
|
||||||
|
final BlockPos blockPos = this.getBlockPos();
|
||||||
|
@@ -398,6 +428,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean loadStructure(ServerLevel world, boolean bl, StructureTemplate structureTemplate) {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
// Scissors - Add master block fire event
|
||||||
|
final BlockPos blockPos = this.getBlockPos();
|
||||||
|
final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
@@ -436,6 +472,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unloadStructure() {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
// Scissors - Add master block fire event
|
||||||
|
final BlockPos blockPos = this.getBlockPos();
|
||||||
|
final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
|
||||||
|
@@ -454,6 +496,12 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStructureLoadable() {
|
||||||
|
+ // Scissors start - Add configuration option to completely disable jigsaw and structure blocks
|
||||||
|
+ if (ScissorsConfig.disableGameMasterBlocks) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (this.mode == StructureMode.LOAD && !this.level.isClientSide && this.structureName != null) {
|
||||||
|
ServerLevel serverLevel = (ServerLevel)this.level;
|
||||||
|
StructureManager structureManager = serverLevel.getStructureManager();
|
87
patches/server/0046-Prevent-velocity-freeze.patch
Normal file
87
patches/server/0046-Prevent-velocity-freeze.patch
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 27 Nov 2022 04:04:14 +0000
|
||||||
|
Subject: [PATCH] Prevent velocity freeze
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
index 3a088afd8269606543ebc9fb2074eb70431fcd39..561e68806b50c417f08a20bcf87c44d117b9f41c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
@@ -41,9 +41,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||||
|
|
||||||
|
if (d6 != 0.0D) {
|
||||||
|
- this.xPower = d3 / d6 * 0.1D;
|
||||||
|
- this.yPower = d4 / d6 * 0.1D;
|
||||||
|
- this.zPower = d5 / d6 * 0.1D;
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = d3 / d6 * 0.1D;
|
||||||
|
+ //this.yPower = d4 / d6 * 0.1D;
|
||||||
|
+ //this.zPower = d5 / d6 * 0.1D;
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -150,6 +154,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ public void setPower(double xPower, double yPower, double zPower)
|
||||||
|
+ {
|
||||||
|
+ if (Double.isInfinite(xPower) || Double.isInfinite(yPower) || Double.isInfinite(zPower))
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (Double.isNaN(xPower) || Double.isNaN(yPower) || Double.isNaN(zPower))
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.xPower = Math.min(Math.max(xPower, -1024), 1024);
|
||||||
|
+ this.yPower = Math.min(Math.max(yPower, -1024), 1024);
|
||||||
|
+ this.zPower = Math.min(Math.max(zPower, -1024), 1024);
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
|
super.readAdditionalSaveData(nbt);
|
||||||
|
@@ -157,9 +180,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
ListTag nbttaglist = nbt.getList("power", 6);
|
||||||
|
|
||||||
|
if (nbttaglist.size() == 3) {
|
||||||
|
- this.xPower = nbttaglist.getDouble(0);
|
||||||
|
- this.yPower = nbttaglist.getDouble(1);
|
||||||
|
- this.zPower = nbttaglist.getDouble(2);
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = nbttaglist.getDouble(0);
|
||||||
|
+ //this.yPower = nbttaglist.getDouble(1);
|
||||||
|
+ //this.zPower = nbttaglist.getDouble(2);
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
+ setPower(nbttaglist.getDouble(0), nbttaglist.getDouble(1), nbttaglist.getDouble(2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -192,9 +219,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
Vec3 vec3d = entity.getLookAngle();
|
||||||
|
|
||||||
|
this.setDeltaMovement(vec3d);
|
||||||
|
- this.xPower = vec3d.x * 0.1D;
|
||||||
|
- this.yPower = vec3d.y * 0.1D;
|
||||||
|
- this.zPower = vec3d.z * 0.1D;
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = vec3d.x * 0.1D;
|
||||||
|
+ //this.yPower = vec3d.y * 0.1D;
|
||||||
|
+ //this.zPower = vec3d.z * 0.1D;
|
||||||
|
+
|
||||||
|
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
||||||
|
+ // Scissors end
|
||||||
|
this.setOwner(entity);
|
||||||
|
return true;
|
||||||
|
} else {
|
@ -0,0 +1,53 @@
|
|||||||
|
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 a890f52e2214242f6e31353bb912813d00e41045..bc0e1938d6e1faca64bb041442bad9e501708fe4 100644
|
||||||
|
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
|
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
|
||||||
|
@@ -173,7 +173,7 @@ public abstract class MinMaxBounds<T extends Number> {
|
||||||
|
return double_ == null ? null : double_ * double_;
|
||||||
|
}
|
||||||
|
|
||||||
|
- 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 0fb8f32427843f4bfd90ab88ecb3ab3e4a4fda31..c9b5f7715d4a866d477c65adb39f11cc46e5623a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||||
|
@@ -58,9 +58,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(
|
||||||
|
+ Math.min(Math.max(box.minX, -1024), 1025),
|
||||||
|
+ Math.min(Math.max(box.minY, -1024), 1025),
|
||||||
|
+ Math.min(Math.max(box.minZ, -1024), 1025),
|
||||||
|
+ Math.min(Math.max(box.maxX, -1024), 1025),
|
||||||
|
+ Math.min(Math.max(box.maxY, -1024), 1025),
|
||||||
|
+ Math.min(Math.max(box.maxZ, -1024), 1025),
|
||||||
|
+ false
|
||||||
|
+ );
|
||||||
|
+ } else {
|
||||||
|
+ this.aabb = null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
this.order = sorter;
|
||||||
|
this.currentEntity = senderOnly;
|
||||||
|
this.playerName = playerName;
|
23
patches/server/0048-Limit-map-decoration-text-length.patch
Normal file
23
patches/server/0048-Limit-map-decoration-text-length.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 28 Apr 2023 18:24:09 -0300
|
||||||
|
Subject: [PATCH] Limit map decoration text length
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java
|
||||||
|
index 3d9c3e3ec56bc1bf5719e31d169015eaf598bde3..1233c8904f6a4f91931b42a08c514d783267a4c8 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
|
||||||
|
@@ -14,6 +14,12 @@ public class MapDecoration {
|
||||||
|
private final Component name;
|
||||||
|
|
||||||
|
public MapDecoration(MapDecoration.Type type, byte x, byte z, byte rotation, @Nullable Component text) {
|
||||||
|
+ // Scissors start - Limit decoration text length
|
||||||
|
+ if (text != null && text.getString().length() > 32) {
|
||||||
|
+ text = null;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
this.type = type;
|
||||||
|
this.x = x;
|
||||||
|
this.y = z;
|
23
patches/server/0049-Limit-map-decoration-count.patch
Normal file
23
patches/server/0049-Limit-map-decoration-count.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 28 Apr 2023 18:24:55 -0300
|
||||||
|
Subject: [PATCH] Limit map decoration count
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
index 6f64d1ce0f5b20e1579f8af64c08ef8fc4e4444b..d78036b62bb36539d3d3e1a8299af2fa60ebd379 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
|
||||||
|
@@ -357,6 +357,12 @@ 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.x) / (float) i;
|
||||||
|
float f1 = (float) (z - (double) this.z) / (float) i;
|
@ -0,0 +1,26 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 28 Apr 2023 18:25:56 -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 a002713686e66faf0d18662586a7a236c27ca7d2..795d72084ff196c5f4a0ff4bafd3ac88257fc379 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
@@ -1354,7 +1354,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||||
|
if (entity != null) {
|
||||||
|
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID().toString());
|
||||||
|
entity.unRide();
|
||||||
|
- this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
|
||||||
|
+
|
||||||
|
+ // Scissors start - Prevent player banning using duplicate UUIDs
|
||||||
|
+ if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
|
+ this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED);
|
||||||
|
+ } else {
|
||||||
|
+ entity.discard();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
this.entityManager.addNewEntity(player); // CraftBukkit - decompile error
|
@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Fri, 28 Apr 2023 18:32:03 -0300
|
||||||
|
Subject: [PATCH] Don't warn on duplicate entity UUIDs
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||||
|
index 8cb246863e06c5b95ba1442e2ec47095026c4f39..48990a8192465e11b27c072fc7d4351a6c5fb7a0 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
|
||||||
|
@@ -147,7 +147,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
- PersistentEntitySectionManager.LOGGER.warn("UUID of added entity already exists: {}", entity);
|
||||||
|
+ // Scissors - Don't warn on duplicate entity UUIDs
|
||||||
|
// Paper start
|
||||||
|
if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) {
|
||||||
|
if (((Entity) entity).addedToWorldStack != null) {
|
@ -0,0 +1,23 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 29 May 2023 19:47:48 -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 6978d14c6bd90ffb640e39e8666430d95d5ef45c..474ed00c09d58a7796cd543c9bcf8752e2f9f742 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
@@ -201,6 +201,12 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
} else if (!jsonelement.isJsonObject()) {
|
||||||
|
if (jsonelement.isJsonArray()) {
|
||||||
|
JsonArray jsonarray = jsonelement.getAsJsonArray();
|
||||||
|
+ // Scissors start
|
||||||
|
+ if (jsonarray.size() <= 0) {
|
||||||
|
+ throw new JsonParseException("Unexpected empty array of components");
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
MutableComponent ichatmutablecomponent = null;
|
||||||
|
Iterator iterator = jsonarray.iterator();
|
||||||
|
|
@ -0,0 +1,151 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Wed, 31 May 2023 20:44:20 -0300
|
||||||
|
Subject: [PATCH] Add depth limit to Component deserializer
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
index bb58d90e9d676761a43a12cbc1c3b687d00654b1..74f33cba7d713eddca5a58a2b33cad357792145e 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -65,8 +65,8 @@ public class ScissorsConfig
|
||||||
|
config.options().header(HEADER);
|
||||||
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
|
- version = getInt("config-version", 3);
|
||||||
|
- set("config-version", 3);
|
||||||
|
+ version = getInt("config-version", 4);
|
||||||
|
+ set("config-version", 4);
|
||||||
|
readConfig(ScissorsConfig.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -146,6 +146,12 @@ public class ScissorsConfig
|
||||||
|
disableGameMasterBlocks = getBoolean("disableGameMasterBlocks", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static int componentDepthLimit = 128;
|
||||||
|
+ private static void componentDepthLimit()
|
||||||
|
+ {
|
||||||
|
+ componentDepthLimit = getInt("componentDepthLimit", 128);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
index 474ed00c09d58a7796cd543c9bcf8752e2f9f742..68e99223b0b084bdfdb9990780150bbc7d8ad8ea 100644
|
||||||
|
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.network.chat;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig; // Scissors
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.papermc.paper.adventure.AdventureComponent; // Paper
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
@@ -33,6 +34,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
|
||||||
|
|
||||||
|
@@ -192,27 +194,31 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
throw new IllegalStateException("Couldn't get field 'lineStart' for JsonReader", nosuchfieldexception);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
+ private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s"); // Scissors
|
||||||
|
|
||||||
|
public Serializer() {}
|
||||||
|
|
||||||
|
- public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
||||||
|
+ // Scissors start
|
||||||
|
+ private MutableComponent deserialize(JsonElement jsonelement, JsonDeserializationContext jsondeserializationcontext, int depth) throws JsonParseException {
|
||||||
|
+ if (depth > ScissorsConfig.componentDepthLimit) {
|
||||||
|
+ throw new JsonParseException("Depth limit exceeded");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (jsonelement.isJsonPrimitive()) {
|
||||||
|
return new TextComponent(jsonelement.getAsString());
|
||||||
|
} else if (!jsonelement.isJsonObject()) {
|
||||||
|
if (jsonelement.isJsonArray()) {
|
||||||
|
JsonArray jsonarray = jsonelement.getAsJsonArray();
|
||||||
|
- // Scissors start
|
||||||
|
if (jsonarray.size() <= 0) {
|
||||||
|
throw new JsonParseException("Unexpected empty array of components");
|
||||||
|
}
|
||||||
|
- // Scissors end
|
||||||
|
|
||||||
|
MutableComponent ichatmutablecomponent = null;
|
||||||
|
Iterator iterator = jsonarray.iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
JsonElement jsonelement1 = (JsonElement) iterator.next();
|
||||||
|
- MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext);
|
||||||
|
+ MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsondeserializationcontext, depth + 1);
|
||||||
|
|
||||||
|
if (ichatmutablecomponent == null) {
|
||||||
|
ichatmutablecomponent = ichatmutablecomponent1;
|
||||||
|
@@ -236,12 +242,17 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
|
||||||
|
if (jsonobject.has("translate")) {
|
||||||
|
s = GsonHelper.getAsString(jsonobject, "translate");
|
||||||
|
+
|
||||||
|
+ // Penalize depth for placeholders in translate & fallback
|
||||||
|
+ long translate_placeholders = PLACEHOLDER_PATTERN.matcher(s).results().count();
|
||||||
|
+ int penalty = (int)translate_placeholders * 12;
|
||||||
|
+
|
||||||
|
if (jsonobject.has("with")) {
|
||||||
|
JsonArray jsonarray1 = GsonHelper.getAsJsonArray(jsonobject, "with");
|
||||||
|
Object[] aobject = new Object[jsonarray1.size()];
|
||||||
|
|
||||||
|
for (int i = 0; i < aobject.length; ++i) {
|
||||||
|
- aobject[i] = this.deserialize(jsonarray1.get(i), type, jsondeserializationcontext);
|
||||||
|
+ aobject[i] = this.deserialize(jsonarray1.get(i), jsondeserializationcontext, depth + 1 + penalty);
|
||||||
|
if (aobject[i] instanceof TextComponent) {
|
||||||
|
TextComponent chatcomponenttext = (TextComponent) aobject[i];
|
||||||
|
|
||||||
|
@@ -264,7 +275,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
|
||||||
|
object = new ScoreComponent(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);
|
||||||
|
|
||||||
|
object = new SelectorComponent(GsonHelper.getAsString(jsonobject, "selector"), optional);
|
||||||
|
} else if (jsonobject.has("keybind")) {
|
||||||
|
@@ -275,7 +286,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
}
|
||||||
|
|
||||||
|
s = GsonHelper.getAsString(jsonobject, "nbt");
|
||||||
|
- Optional<Component> optional1 = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
|
||||||
|
+ Optional<Component> optional1 = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1);
|
||||||
|
boolean flag = GsonHelper.getAsBoolean(jsonobject, "interpret", false);
|
||||||
|
|
||||||
|
if (jsonobject.has("block")) {
|
||||||
|
@@ -300,7 +311,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < jsonarray2.size(); ++j) {
|
||||||
|
- ((MutableComponent) object).append(this.deserialize(jsonarray2.get(j), type, jsondeserializationcontext));
|
||||||
|
+ ((MutableComponent) object).append(this.deserialize(jsonarray2.get(j), jsondeserializationcontext, depth + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -309,8 +320,13 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- 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();
|
||||||
|
+ public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
|
||||||
|
+ return this.deserialize(jsonelement, jsondeserializationcontext, 1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private Optional<Component> parseSeparator(JsonDeserializationContext context, JsonObject json, int depth) {
|
||||||
|
+ return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), context, depth + 1)) : Optional.empty();
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
private void serializeStyle(Style style, JsonObject json, JsonSerializationContext context) {
|
116
patches/server/0054-Add-depth-limit-to-SNBT.patch
Normal file
116
patches/server/0054-Add-depth-limit-to-SNBT.patch
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 23:30:40 +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 28a13331ac7713cde725bf7c7ce6be959227d506..4f5573d1cc5630519122010d44f0a82e2948e767 100644
|
||||||
|
--- a/src/main/java/net/minecraft/nbt/TagParser.java
|
||||||
|
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
|
||||||
|
@@ -169,8 +169,58 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect('}');
|
||||||
|
- return compoundTag;
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add depth limit to SNBT
|
||||||
|
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag;
|
||||||
|
+ // Scissors end
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add depth limit to SNBT
|
||||||
|
+ private boolean exceedsDepthLimit(Tag tag) {
|
||||||
|
+ return this.exceedsDepthLimit(0, tag);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private boolean exceedsDepthLimit(long depth, Tag tag)
|
||||||
|
+ {
|
||||||
|
+ if (depth > 256)
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (tag instanceof ListTag listTag)
|
||||||
|
+ {
|
||||||
|
+ for (Tag childTag : listTag)
|
||||||
|
+ {
|
||||||
|
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
||||||
|
+
|
||||||
|
+ if (returnValue)
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else if (tag instanceof CompoundTag compoundTag)
|
||||||
|
+ {
|
||||||
|
+ for (String key: compoundTag.getAllKeys())
|
||||||
|
+ {
|
||||||
|
+ Tag childTag = compoundTag.get(key);
|
||||||
|
+
|
||||||
|
+ if (childTag == null)
|
||||||
|
+ {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
|
||||||
|
+
|
||||||
|
+ if (returnValue)
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
}
|
||||||
|
+ // Scissors end
|
||||||
|
|
||||||
|
private Tag readListTag() throws CommandSyntaxException {
|
||||||
|
this.expect('[');
|
||||||
|
@@ -203,7 +253,11 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect(']');
|
||||||
|
- return listTag;
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add depth limit to SNBT
|
||||||
|
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag;
|
||||||
|
+ // return listTag;
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -228,7 +282,7 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T extends Number> List<T> readArray(TagType<?> arrayTypeReader, TagType<?> typeReader) throws CommandSyntaxException {
|
||||||
|
- List<T> list = Lists.newArrayList();
|
||||||
|
+ List<Number> list = Lists.newArrayList(); // Scissors - List<T> -> List<Number>
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
if (this.reader.peek() != ']') {
|
||||||
|
@@ -241,11 +295,11 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeReader == ByteTag.TYPE) {
|
||||||
|
- list.add((T)((NumericTag)tag).getAsByte());
|
||||||
|
+ list.add(((NumericTag)tag).getAsByte()); // Scissors - Remove (T) cast
|
||||||
|
} else if (typeReader == LongTag.TYPE) {
|
||||||
|
- list.add((T)((NumericTag)tag).getAsLong());
|
||||||
|
+ list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast
|
||||||
|
} else {
|
||||||
|
- list.add((T)((NumericTag)tag).getAsInt());
|
||||||
|
+ list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasElementSeparator()) {
|
||||||
|
@@ -257,7 +311,7 @@ public class TagParser {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expect(']');
|
||||||
|
- return list;
|
||||||
|
+ return (List<T>) list; // Scissors - Cast to List<T>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
86
patches/server/0055-Implement-command-block-events.patch
Normal file
86
patches/server/0055-Implement-command-block-events.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 23:42:46 +0100
|
||||||
|
Subject: [PATCH] Implement command block events
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 8ec188a09dd1d5150a25fdf18f49deac1593fb4d..0eb54b2b36df7870724e33d75d1d3f6d5492ffab 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 com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
+import com.github.atlasmediagroup.scissors.event.block.CommandBlockPlayerEditEvent;
|
||||||
|
+import com.github.atlasmediagroup.scissors.event.block.CommandMinecartPlayerEditEvent;
|
||||||
|
import com.github.atlasmediagroup.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
@@ -134,6 +136,7 @@ import net.minecraft.world.entity.player.ChatVisiblity;
|
||||||
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
|
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||||
|
import net.minecraft.world.entity.vehicle.Boat;
|
||||||
|
+import net.minecraft.world.entity.vehicle.MinecartCommandBlock;
|
||||||
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
import net.minecraft.world.item.BucketItem;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
@@ -186,6 +189,7 @@ import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||||
|
import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
||||||
|
import org.bukkit.craftbukkit.util.Waitable;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.entity.minecart.CommandMinecart;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
@@ -902,6 +906,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
this.player.level.getChunkAt(blockposition).setBlockEntity(tileentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Implement command block events
|
||||||
|
+ if (commandblocklistenerabstract instanceof org.bukkit.block.CommandBlock commandBlock)
|
||||||
|
+ {
|
||||||
|
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), Objects.requireNonNullElse(commandblocklistenerabstract.getCommand(), ""), s, commandBlock);
|
||||||
|
+ event.callEvent();
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ s = event.getNewCommand();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
commandblocklistenerabstract.setCommand(s);
|
||||||
|
commandblocklistenerabstract.setTrackOutput(flag);
|
||||||
|
if (!flag) {
|
||||||
|
@@ -933,7 +952,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level);
|
||||||
|
|
||||||
|
if (commandblocklistenerabstract != null) {
|
||||||
|
- commandblocklistenerabstract.setCommand(packet.getCommand());
|
||||||
|
+ // Scissors start - Implement command block events
|
||||||
|
+ String command = packet.getCommand();
|
||||||
|
+
|
||||||
|
+ if (commandblocklistenerabstract instanceof CommandMinecart commandMinecart)
|
||||||
|
+ {
|
||||||
|
+ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), Objects.requireNonNullElse(commandblocklistenerabstract.getCommand(), ""), command, commandMinecart);
|
||||||
|
+ event.callEvent();
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ command = event.getNewCommand();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ commandblocklistenerabstract.setCommand(command);
|
||||||
|
+
|
||||||
|
+ // commandblocklistenerabstract.setCommand(packet.getCommand());
|
||||||
|
+
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
|
||||||
|
if (!packet.isTrackOutput()) {
|
||||||
|
commandblocklistenerabstract.setLastOutput((Component) null);
|
27
patches/server/0056-Limit-beacon-effectRange.patch
Normal file
27
patches/server/0056-Limit-beacon-effectRange.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Wed, 7 Jun 2023 17:02:00 -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 8038e3a10b563321df1e8cedd26b256078ce745a..7fb177779fa2bf30e4d190a277691eeab375120e 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
|
||||||
|
@@ -84,7 +84,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||||
|
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;
|
||||||
|
@@ -410,6 +410,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||||
|
|
||||||
|
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
|
46
patches/server/0057-Fix-packet-related-lag-exploits.patch
Normal file
46
patches/server/0057-Fix-packet-related-lag-exploits.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Tue, 4 Jul 2023 18:49:34 -0300
|
||||||
|
Subject: [PATCH] Fix packet-related lag exploits
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index d3fd35a33da5ce40667781f7ee35e89531b4ea96..f92385c4f72fce6ceec40e21ea081eeb1bd8fc25 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -866,7 +866,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID);
|
||||||
|
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
||||||
|
this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID);
|
||||||
|
- } else {
|
||||||
|
+ } else if (this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||||
|
BaseCommandBlock commandblocklistenerabstract = null;
|
||||||
|
CommandBlockEntity tileentitycommand = null;
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
@@ -1027,7 +1027,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
||||||
|
+ if (!ScissorsConfig.disableGameMasterBlocks && 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);
|
||||||
|
@@ -1085,7 +1085,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
||||||
|
+ if (!ScissorsConfig.disableGameMasterBlocks && 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);
|
||||||
|
@@ -1108,7 +1108,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
||||||
|
+ if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks() && this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
||||||
|
BlockPos blockposition = packet.getPos();
|
||||||
|
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
||||||
|
|
44
patches/server/0058-Limit-save-data-for-Bees-and-Vexes.patch
Normal file
44
patches/server/0058-Limit-save-data-for-Bees-and-Vexes.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Wed, 5 Jul 2023 22:58:24 +0100
|
||||||
|
Subject: [PATCH] Limit save data for Bees and Vexes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
|
index 083640b7e4aee75db9b884aebd640c9410e669ca..76a2d683c7a32a8af2683cb2d7a3e33111064b27 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
|
@@ -223,8 +223,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
|
this.hivePos = null;
|
||||||
|
- if (nbt.contains("HivePos")) {
|
||||||
|
- this.hivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos"));
|
||||||
|
+ if (nbt.contains("HivePos"))
|
||||||
|
+ {
|
||||||
|
+ // Scissors start - Limit HivePos
|
||||||
|
+ final BlockPos savedHivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos"));
|
||||||
|
+ this.hivePos = this.level.isLoadedAndInBounds(savedHivePos) ? savedHivePos : null;
|
||||||
|
+ // Scissors end - Limit HivePos
|
||||||
|
}
|
||||||
|
|
||||||
|
this.savedFlowerPos = null;
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||||
|
index f78f3f2d740f7b4800e17d9bc64b7b4fedda49b9..a4c4c7cd5a4325916836728f11d2164ad211143b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
|
||||||
|
@@ -107,8 +107,12 @@ public class Vex extends Monster {
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
|
super.readAdditionalSaveData(nbt);
|
||||||
|
- if (nbt.contains("BoundX")) {
|
||||||
|
- this.boundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
||||||
|
+ if (nbt.contains("BoundX"))
|
||||||
|
+ {
|
||||||
|
+ // Scissors start - Limit Vex bound origin
|
||||||
|
+ final BlockPos savedBoundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ"));
|
||||||
|
+ this.boundOrigin = this.level.isLoadedAndInBounds(savedBoundOrigin) ? savedBoundOrigin : null;
|
||||||
|
+ // Scissors end - Limit Vex bound origin
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbt.contains("LifeTicks")) {
|
32
patches/server/0059-Mute-invalid-attributes.patch
Normal file
32
patches/server/0059-Mute-invalid-attributes.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Thu, 6 Jul 2023 23:01:12 +0100
|
||||||
|
Subject: [PATCH] Mute invalid attributes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||||
|
index 9cbfda029782385d1a7987f5be46d450bd8a758e..2421573bbc738ce5c2ac0e5a3013a4813d807dc5 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
|
||||||
|
@@ -127,7 +127,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 5f94be8e8793f0b5b99e630882f53199d688eadf..7da1c212ff15940c849ac27061d47c5d9ffb1a30 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
|
||||||
|
@@ -90,7 +90,7 @@ public class AttributeModifier {
|
||||||
|
AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation"));
|
||||||
|
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
|
||||||
|
} catch (Exception var3) {
|
||||||
|
- LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage());
|
||||||
|
+ // LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage()); // Scissors - Mute invalid attributes
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
32
patches/server/0060-Mute-invalid-Enderdragon-phases.patch
Normal file
32
patches/server/0060-Mute-invalid-Enderdragon-phases.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Thu, 6 Jul 2023 23:34:46 +0100
|
||||||
|
Subject: [PATCH] Mute invalid Enderdragon phases
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
|
||||||
|
index 235b1548ccd1ff6a7ff05fc6a903d8b053aea5ce..92b4bd06c53e1f2c5c4c05ec7dd10e15889f4ebb 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
|
||||||
|
@@ -19,7 +19,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 318a288a9170254b682955d96a150e99ca89b345..bcdd44cc2927791eae8492d316f26b52b58a2a06 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
|
||||||
|
@@ -29,7 +29,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()) {
|
Reference in New Issue
Block a user