mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-07-15 15:18:35 +00:00
Compare commits
33 Commits
1.20.1
...
archive/1.
Author | SHA1 | Date | |
---|---|---|---|
cedb59e831 | |||
3000da112b | |||
ebdedbed25 | |||
2733597c72 | |||
72fa0ce340 | |||
b90b32ca54 | |||
8274f52923 | |||
f3b3ef9f03 | |||
a7dbe8a38e | |||
63e980e13b | |||
8c0deddbe1 | |||
ade230ed68 | |||
f940a6bb8f | |||
f403924ca0 | |||
ba694be2bc | |||
d382eb52e7 | |||
3ea91b9dbc | |||
b30b7223e5 | |||
2b687d9eda | |||
ad72d5928e | |||
907c5f4ed1 | |||
ff6ceb1094 | |||
acb9c23149 | |||
3330671737 | |||
0abae227cb | |||
6b64fc6c2c | |||
310c7a953b | |||
c09d7fa208 | |||
219e834ffd | |||
3eb4c190e4 | |||
6be48a491b | |||
e34e6c62e6 | |||
fe1c388702 |
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@ -3,22 +3,24 @@ pipeline {
|
|||||||
environment {
|
environment {
|
||||||
GITHUB_BRANCH = "${BRANCH_NAME}"
|
GITHUB_BRANCH = "${BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
options {
|
|
||||||
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')
|
|
||||||
}
|
|
||||||
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 createReobfPaperclipJar --no-daemon'
|
sh './gradlew createReobfPaperclipJar --no-daemon --refresh-dependencies'
|
||||||
}
|
}
|
||||||
|
sh """
|
||||||
|
#!/bin/sh
|
||||||
|
mv \${WORKSPACE}/build/libs/Scissors-paperclip-*.jar \${WORKSPACE}/build/libs/scissors-\${BRANCH_NAME}-\${BUILD_NUMBER}.jar
|
||||||
|
rm \${WORKSPACE}/build/libs/Scissors-bundler-*.jar
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('test') {
|
stage('test') {
|
||||||
@ -31,7 +33,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
archiveArtifacts artifacts: 'build/libs/Scissors-paperclip-*.jar', fingerprint: true
|
archiveArtifacts artifacts: 'build/libs/scissors-*.jar', fingerprint: true
|
||||||
junit 'Scissors-Server/build/test-results/test/*.xml'
|
junit 'Scissors-Server/build/test-results/test/*.xml'
|
||||||
junit 'Scissors-API/build/test-results/test/*.xml'
|
junit 'Scissors-API/build/test-results/test/*.xml'
|
||||||
cleanWs()
|
cleanWs()
|
||||||
|
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,8 +1,14 @@
|
|||||||
# Scissors
|
# Scissors [](https://ci.scissors.gg/job/Scissors/job/1.18.2/)
|
||||||
|
|
||||||
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
|
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
|
||||||
Paper's own team has either refused to fix or would have.
|
Paper's own team has either refused to fix or would have.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
### [Scissors Download](https://ci.plex.us.org/job/Scissors)
|
||||||
|
### [Scissors Javadoc](https://javadoc.scissors.gg/1.18.2)
|
||||||
|
### [Scissors Announcements](https://totalfreedom.me/forum/board/139)
|
||||||
|
### [Scissors General Discussion](https://totalfreedom.me/forum/board/140)
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
```
|
```
|
||||||
Paperweight tasks
|
Paperweight tasks
|
||||||
|
@ -65,3 +65,32 @@ paperweight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.generateDevelopmentBundle {
|
||||||
|
apiCoordinates.set("me.totalfreedom.scissors:scissors-api")
|
||||||
|
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||||
|
libraryRepositories.set(
|
||||||
|
listOf(
|
||||||
|
"https://repo.maven.apache.org/maven2/",
|
||||||
|
paperMavenPublicUrl,
|
||||||
|
"https://repo.scissors.gg/repository/scissors-snapshot/",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
// Publishing API:
|
||||||
|
// ./gradlew :Scissors-API:publish[ToMavenLocal]
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "scissors-snapshots"
|
||||||
|
url = uri("https://repo.scissors.gg/repository/scissors-snapshot/")
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("scissorsUser")
|
||||||
|
password = System.getenv("scissorsPassword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@ group=me.totalfreedom.scissors
|
|||||||
version=1.18.2-R0.1-SNAPSHOT
|
version=1.18.2-R0.1-SNAPSHOT
|
||||||
|
|
||||||
mcVersion=1.18.2
|
mcVersion=1.18.2
|
||||||
paperRef=276d830d223ddf68611beacc248285ae5a4e8a1f
|
paperRef=fc9ee65a32622d03a91db39364b6f106cf88335b
|
||||||
|
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
675
licenses/GPL.md
Normal file
675
licenses/GPL.md
Normal file
@ -0,0 +1,675 @@
|
|||||||
|
### GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
### Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom
|
||||||
|
to share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users. We, the Free Software Foundation, use
|
||||||
|
the GNU General Public License for most of our software; it applies
|
||||||
|
also to any other work released this way by its authors. You can apply
|
||||||
|
it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you
|
||||||
|
have certain responsibilities if you distribute copies of the
|
||||||
|
software, or if you modify it: responsibilities to respect the freedom
|
||||||
|
of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the
|
||||||
|
manufacturer can do so. This is fundamentally incompatible with the
|
||||||
|
aim of protecting users' freedom to change the software. The
|
||||||
|
systematic pattern of such abuse occurs in the area of products for
|
||||||
|
individuals to use, which is precisely where it is most unacceptable.
|
||||||
|
Therefore, we have designed this version of the GPL to prohibit the
|
||||||
|
practice for those products. If such problems arise substantially in
|
||||||
|
other domains, we stand ready to extend this provision to those
|
||||||
|
domains in future versions of the GPL, as needed to protect the
|
||||||
|
freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish
|
||||||
|
to avoid the special danger that patents applied to a free program
|
||||||
|
could make it effectively proprietary. To prevent this, the GPL
|
||||||
|
assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
### TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
#### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
#### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
#### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
#### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
#### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
#### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
#### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
#### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
#### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
#### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
#### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
#### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
#### 13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
#### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in
|
||||||
|
detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU General Public
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that numbered version or
|
||||||
|
of any later version published by the Free Software Foundation. If the
|
||||||
|
Program does not specify a version number of the GNU General Public
|
||||||
|
License, you may choose any version ever published by the Free
|
||||||
|
Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU General Public License can be used, that proxy's public
|
||||||
|
statement of acceptance of a version permanently authorizes you to
|
||||||
|
choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
#### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
#### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
#### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands \`show w' and \`show c' should show the
|
||||||
|
appropriate parts of the General Public License. Of course, your
|
||||||
|
program's commands might be different; for a GUI interface, you would
|
||||||
|
use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your
|
||||||
|
program into proprietary programs. If your program is a subroutine
|
||||||
|
library, you may consider it more useful to permit linking proprietary
|
||||||
|
applications with the library. If this is what you want to do, use the
|
||||||
|
GNU Lesser General Public License instead of this License. But first,
|
||||||
|
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
23
licenses/MIT.md
Normal file
23
licenses/MIT.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the “Software”), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use,
|
||||||
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
63
patches/api/0001-Add-MasterBlockFireEvent.patch
Normal file
63
patches/api/0001-Add-MasterBlockFireEvent.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 4 Jul 2022 16:44:35 +0100
|
||||||
|
Subject: [PATCH] Add MasterBlockFireEvent
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..812e6ae9f1c8eb9558e5109c522d3ce3a7deb35c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/MasterBlockFireEvent.java
|
||||||
|
@@ -0,0 +1,51 @@
|
||||||
|
+package me.totalfreedom.scissors.event.block;
|
||||||
|
+
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a GameMasterBlock is fired (i.e. command block, structure block, jigsaw block)
|
||||||
|
+ */
|
||||||
|
+public class MasterBlockFireEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Location at;
|
||||||
|
+
|
||||||
|
+ public MasterBlockFireEvent(@NotNull Location at)
|
||||||
|
+ {
|
||||||
|
+ this.at = at;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Location getAt()
|
||||||
|
+ {
|
||||||
|
+ return this.at;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancelled)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancelled;
|
||||||
|
+ }
|
||||||
|
+}
|
72
patches/api/0002-Add-spectator-teleport-event.patch
Normal file
72
patches/api/0002-Add-spectator-teleport-event.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 5 Jul 2022 03:59:18 +0100
|
||||||
|
Subject: [PATCH] Add spectator teleport event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..e4c9256c78f8b395aea86e9ea1a112f8e7426c1f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/player/SpectatorTeleportEvent.java
|
||||||
|
@@ -0,0 +1,60 @@
|
||||||
|
+package me.totalfreedom.scissors.event.player;
|
||||||
|
+
|
||||||
|
+import org.bukkit.entity.Entity;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called whenever a spectator attempts to teleport to an entity
|
||||||
|
+ */
|
||||||
|
+public class SpectatorTeleportEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlerList = new HandlerList();
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final Entity target;
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+
|
||||||
|
+ public SpectatorTeleportEvent(@NotNull Player player, @NotNull Entity target)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.target = target;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public Player getPlayer() {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public Entity getTarget() {
|
||||||
|
+ return this.target;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancelled)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ @Override
|
||||||
|
+ public HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlerList;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @NotNull
|
||||||
|
+ public static org.bukkit.event.HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlerList;
|
||||||
|
+ }
|
||||||
|
+}
|
24
patches/api/0003-Add-Scissors-configuration-file.patch
Normal file
24
patches/api/0003-Add-Scissors-configuration-file.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 09:56:34 +0100
|
||||||
|
Subject: [PATCH] Add Scissors configuration file
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
|
index 79b26045a68ebb9b01e5bd06abbccaaef5489777..eb66a2cf4785c9f8ef4bdebee59f29777bf9fa50 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
|
@@ -1897,6 +1897,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
}
|
||||||
|
// 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
|
||||||
|
*
|
172
patches/api/0004-Add-command-block-player-edit-event.patch
Normal file
172
patches/api/0004-Add-command-block-player-edit-event.patch
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Fri, 2 Jun 2023 20:42:02 +0100
|
||||||
|
Subject: [PATCH] Add command block player edit event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/CommandBlockPlayerEditEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/CommandBlockPlayerEditEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..722f5839600954998cbbf799e68477d499d104c4
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/CommandBlockPlayerEditEvent.java
|
||||||
|
@@ -0,0 +1,77 @@
|
||||||
|
+package me.totalfreedom.scissors.event.block;
|
||||||
|
+
|
||||||
|
+import org.bukkit.block.CommandBlock;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Called when a command block is modified by a player
|
||||||
|
+ */
|
||||||
|
+public class CommandBlockPlayerEditEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+ private final Player player;
|
||||||
|
+ private final String oldCommand;
|
||||||
|
+ private String newCommand;
|
||||||
|
+ private final CommandBlock commandBlock;
|
||||||
|
+
|
||||||
|
+ public CommandBlockPlayerEditEvent(@NotNull Player player, @NotNull String oldCommand, @NotNull String newCommand, @NotNull CommandBlock commandBlock)
|
||||||
|
+ {
|
||||||
|
+ this.player = player;
|
||||||
|
+ this.oldCommand = oldCommand;
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ this.commandBlock = commandBlock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getNewCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull String getOldCommand()
|
||||||
|
+ {
|
||||||
|
+ return this.oldCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setNewCommand(@NotNull String newCommand)
|
||||||
|
+ {
|
||||||
|
+ this.newCommand = newCommand;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull Player getPlayer()
|
||||||
|
+ {
|
||||||
|
+ return this.player;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @NotNull CommandBlock getCommandBlock()
|
||||||
|
+ {
|
||||||
|
+ return this.commandBlock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return this.cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancel)
|
||||||
|
+ {
|
||||||
|
+ this.cancelled = cancel;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static @NotNull HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java b/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..4248563a590c76dc0d211fec99f6c98becf42b57
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/me/totalfreedom/scissors/event/block/CommandMinecartPlayerEditEvent.java
|
||||||
|
@@ -0,0 +1,77 @@
|
||||||
|
+package me.totalfreedom.scissors.event.block;
|
||||||
|
+
|
||||||
|
+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;
|
||||||
|
+ }
|
||||||
|
+}
|
@ -48,6 +48,28 @@ index 0282e3b75470e1a68ea1fc228082483514ba432e..9e78384fdd5727143d3be5f189478ed7
|
|||||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||||
standardInput = System.`in`
|
standardInput = System.`in`
|
||||||
workingDir = rootProject.layout.projectDirectory
|
workingDir = rootProject.layout.projectDirectory
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
|
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/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 da15a224b8b974e78b9d8d5f514229b3b2a5a63e..8ca2e2e3d2564ec0cc081ff52334484dd5561e5c 100644
|
index da15a224b8b974e78b9d8d5f514229b3b2a5a63e..8ca2e2e3d2564ec0cc081ff52334484dd5561e5c 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Fri, 22 Apr 2022 00:59:00 -0500
|
Date: Fri, 22 Apr 2022 00:59:00 -0500
|
||||||
Subject: [PATCH] Fixes the Blank SkullOwner exploit
|
Subject: [PATCH] Fixes the Blank SkullOwner exploit
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Mon, 9 May 2022 23:40:59 -0500
|
Date: Mon, 9 May 2022 23:40:59 -0500
|
||||||
Subject: [PATCH] Even more ResourceLocation validation and log spam fixes
|
Subject: [PATCH] Even more ResourceLocation validation and log spam fixes
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Fri, 22 Apr 2022 01:19:49 -0500
|
Date: Fri, 22 Apr 2022 01:19:49 -0500
|
||||||
Subject: [PATCH] Even more resource location validation
|
Subject: [PATCH] Even more resource location validation
|
||||||
|
|
||||||
|
@ -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 bf42969859545a8a520923ef1836ffa4a5cc24a0..2ee707e109f146c83cdea162c119ea96c0ff4f8f 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 fbe68bd4739d9a0e7d9bc4c3d5ba8ecfd2d13954..40313b014b4ed5f7e9505bde2827383c19d4377a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@@ -265,7 +265,7 @@ public class Main {
|
||||||
|
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
|
||||||
|
@ -22,7 +22,7 @@ index 65844bb02bd3d9ef566d4779106a1f9ef2a2b7bc..f856ac2dfe55a1f1f63725ec20e7b8dd
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Fri, 22 Apr 2022 01:24:05 -0500
|
Date: Fri, 22 Apr 2022 01:24:05 -0500
|
||||||
Subject: [PATCH] Validate coordinates before attempting to get block entities
|
Subject: [PATCH] Validate coordinates before attempting to get block entities
|
||||||
when handling Creative Inventory packets
|
when handling Creative Inventory packets
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Video <videogamesm12@gmail.com>
|
||||||
Date: Fri, 22 Apr 2022 01:26:55 -0500
|
Date: Fri, 22 Apr 2022 01:26:55 -0500
|
||||||
Subject: [PATCH] Better handling of invalid JSON components
|
Subject: [PATCH] Better handling of invalid JSON components
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
Date: Fri, 3 Jun 2022 19:30:14 -0500
|
Date: Fri, 3 Jun 2022 19:30:14 -0500
|
||||||
Subject: [PATCH] Fix negative death times
|
Subject: [PATCH] Fix negative death times
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
Date: Fri, 22 Apr 2022 01:56:03 -0500
|
Date: Fri, 22 Apr 2022 01:56:03 -0500
|
||||||
Subject: [PATCH] Reset large tags
|
Subject: [PATCH] Reset large tags
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
From: Business Goose <arclicious@vivaldi.net>
|
||||||
Date: Sun, 1 May 2022 14:23:35 -0500
|
Date: Sun, 1 May 2022 14:23:35 -0500
|
||||||
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
|
||||||
vehicles if they collide with more than 15 other entities
|
vehicles if they collide with more than 15 other entities
|
||||||
|
170
patches/server/0032-Add-MasterBlockFireEvent.patch
Normal file
170
patches/server/0032-Add-MasterBlockFireEvent.patch
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Mon, 4 Jul 2022 21:43:40 +0100
|
||||||
|
Subject: [PATCH] Add MasterBlockFireEvent
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
|
index 1a48c5ea1f2f755abfa85469e26f37ea5f02d6da..d6ed6b04792c4766ed5111fb83d52b76967d6856 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
package net.minecraft.world.level.block;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
-import java.util.Random;
|
||||||
|
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
@@ -25,9 +25,11 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||||
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
-import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
|
+import java.util.Random;
|
||||||
|
|
||||||
|
public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
|
|
||||||
|
@@ -117,6 +119,15 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
|
||||||
|
+
|
||||||
|
+ if (!event.callEvent())
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
if (hasCommand) {
|
||||||
|
executor.performCommand(world);
|
||||||
|
} else {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
|
||||||
|
index 4bed3a1f353ada478c93e3e6f94aa7ea9d228730..02a9c902a2ec8994ebc8c639864aa0d231aab61a 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 me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
@@ -27,6 +28,7 @@ import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class JigsawBlockEntity extends BlockEntity {
|
||||||
|
public static final String TARGET = "target";
|
||||||
|
@@ -117,11 +119,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 9a65ed7e5ed76a320c8602b0a4edeff6615d9e0b..e46727ee13550d4ab5473dc5ac28abddf822c9ee 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 me.totalfreedom.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;
|
||||||
|
@@ -264,7 +267,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);
|
||||||
|
@@ -321,6 +323,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
public boolean saveStructure(boolean bl) {
|
||||||
|
if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ final BlockPos pos = this.getBlockPos();
|
||||||
|
+ final 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();
|
||||||
|
@@ -358,6 +370,16 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
|
public boolean loadStructure(ServerLevel world, boolean bl) {
|
||||||
|
if (this.mode == StructureMode.LOAD && this.structureName != null) {
|
||||||
|
+ // Scissors - Add master block fire event
|
||||||
|
+ 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;
|
||||||
|
@@ -403,6 +425,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();
|
@ -1,231 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Telesphoreo <me@telesphoreo.me>
|
|
||||||
Date: Sun, 22 May 2022 21:15:51 -0500
|
|
||||||
Subject: [PATCH] Prevent crash paintings and similar entity OOB exploits
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/MathUtility.java b/src/main/java/com/github/atlasmediagroup/scissors/MathUtility.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..7965cf3abd02d415dd0e71a0de73987e5fdf11ec
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/MathUtility.java
|
|
||||||
@@ -0,0 +1,29 @@
|
|
||||||
+package com.github.atlasmediagroup.scissors;
|
|
||||||
+
|
|
||||||
+public class MathUtility
|
|
||||||
+{
|
|
||||||
+ public static int clampInt(int number, int minimum, int maximum)
|
|
||||||
+ {
|
|
||||||
+ return Math.min(Math.max(number, minimum), maximum);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static long clampLong(long number, long minimum, long maximum)
|
|
||||||
+ {
|
|
||||||
+ return Math.min(Math.max(number, minimum), maximum);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static double clampDouble(double number, double minimum, double maximum)
|
|
||||||
+ {
|
|
||||||
+ return Math.min(Math.max(number, minimum), maximum);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static int safeDoubleToInt(double number)
|
|
||||||
+ {
|
|
||||||
+ return (int) clampDouble(number, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static int safeLongToInt(long number)
|
|
||||||
+ {
|
|
||||||
+ return (int) clampLong(number, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
|
||||||
index 978cb98c81195640fb3704d2077148f2be0dca36..59a4ff3593e74f72c3843554c2e14b82912c0a54 100644
|
|
||||||
--- a/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
|
||||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/NbtUtility.java
|
|
||||||
@@ -1,13 +1,9 @@
|
|
||||||
package com.github.atlasmediagroup.scissors;
|
|
||||||
|
|
||||||
-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
|
|
||||||
{
|
|
||||||
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/PositionUtility.java b/src/main/java/com/github/atlasmediagroup/scissors/PositionUtility.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..fd22a200e070ca5a594802d2f201c6b27d6cddcf
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/com/github/atlasmediagroup/scissors/PositionUtility.java
|
|
||||||
@@ -0,0 +1,83 @@
|
|
||||||
+package com.github.atlasmediagroup.scissors;
|
|
||||||
+
|
|
||||||
+import net.minecraft.core.BlockPos;
|
|
||||||
+import net.minecraft.world.entity.Entity;
|
|
||||||
+import net.minecraft.world.level.Level;
|
|
||||||
+import net.minecraft.world.level.border.WorldBorder;
|
|
||||||
+import net.minecraft.world.phys.Vec3;
|
|
||||||
+
|
|
||||||
+public class PositionUtility
|
|
||||||
+{
|
|
||||||
+ public static Vec3 getValidVec3(double x, double y, double z, Entity entity)
|
|
||||||
+ {
|
|
||||||
+ final Level level = entity.level;
|
|
||||||
+
|
|
||||||
+ try
|
|
||||||
+ {
|
|
||||||
+ if (level.isInWorldBounds(new BlockPos(Math.floor(MathUtility.safeDoubleToInt(x)), Math.floor(MathUtility.safeDoubleToInt(y)), Math.floor(MathUtility.safeDoubleToInt(z)))))
|
|
||||||
+ {
|
|
||||||
+ return new Vec3(x, y, z);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ final WorldBorder worldBorder = level.getWorldBorder();
|
|
||||||
+
|
|
||||||
+ final double maxX = worldBorder.getMaxX();
|
|
||||||
+ final double maxY = level.getMaxBuildHeight();
|
|
||||||
+ final double maxZ = worldBorder.getMaxZ();
|
|
||||||
+
|
|
||||||
+ final double minX = worldBorder.getMinX();
|
|
||||||
+ final double minY = level.getMinBuildHeight();
|
|
||||||
+ final double minZ = worldBorder.getMinZ();
|
|
||||||
+
|
|
||||||
+ return new Vec3(MathUtility.clampDouble(x, minX, maxX), MathUtility.clampDouble(y, minY, maxY), MathUtility.clampDouble(z, minZ, maxZ));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ catch (Exception e)
|
|
||||||
+ { // If we throw some sort of exception due to the position being crazy, catch it
|
|
||||||
+ return new Vec3(0, 0, 0);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static Vec3 getValidVec3FromBlockPos(BlockPos blockPos, Entity entity)
|
|
||||||
+ {
|
|
||||||
+ final BlockPos validBlockPos = getValidBlockPos(blockPos, entity);
|
|
||||||
+
|
|
||||||
+ return new Vec3(validBlockPos.getX(), validBlockPos.getY(), validBlockPos.getZ());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static BlockPos getValidBlockPos(BlockPos blockPos, Entity entity)
|
|
||||||
+ {
|
|
||||||
+ final Level level = entity.level;
|
|
||||||
+
|
|
||||||
+ try
|
|
||||||
+ {
|
|
||||||
+ if (level.isInWorldBounds(blockPos))
|
|
||||||
+ {
|
|
||||||
+ return blockPos;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ final int x = blockPos.getX();
|
|
||||||
+ final int y = blockPos.getY();
|
|
||||||
+ final int z = blockPos.getZ();
|
|
||||||
+
|
|
||||||
+ final WorldBorder worldBorder = level.getWorldBorder();
|
|
||||||
+
|
|
||||||
+ final int maxX = MathUtility.safeDoubleToInt(worldBorder.getMaxX());
|
|
||||||
+ final int maxY = level.getMaxBuildHeight();
|
|
||||||
+ final int maxZ = MathUtility.safeDoubleToInt(worldBorder.getMaxZ());
|
|
||||||
+
|
|
||||||
+ final int minX = MathUtility.safeDoubleToInt(worldBorder.getMinX());
|
|
||||||
+ final int minY = level.getMinBuildHeight();
|
|
||||||
+ final int minZ = MathUtility.safeDoubleToInt(worldBorder.getMinZ());
|
|
||||||
+
|
|
||||||
+ return new BlockPos(MathUtility.clampInt(x, minX, maxX), MathUtility.clampInt(y, minY, maxY), MathUtility.clampInt(z, minZ, maxZ));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ catch (Exception e)
|
|
||||||
+ { // If we throw some sort of exception due to the position being crazy, catch it
|
|
||||||
+ return new BlockPos(0, 0, 0);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
index 876e8f83fab4e255959948e59cabf05478446e4d..886451893fbc30576249ca6816c2579127acfe06 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.entity;
|
|
||||||
|
|
||||||
+import com.github.atlasmediagroup.scissors.PositionUtility;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableList.Builder;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
@@ -1775,6 +1776,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
|
||||||
+ // Scissors start - Reassign x, y & z to make sure entities can't move out of the world border
|
|
||||||
+ Vec3 vec3 = PositionUtility.getValidVec3(x, y, z, this);
|
|
||||||
+ x = vec3.x;
|
|
||||||
+ y = vec3.y;
|
|
||||||
+ z = vec3.z;
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper - cancel entity velocity if teleported
|
|
||||||
if (!preserveMotion) {
|
|
||||||
this.deltaMovement = Vec3.ZERO;
|
|
||||||
@@ -3209,6 +3217,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
|
|
||||||
+ // Scissors start - Reassign location to a safe value
|
|
||||||
+ location = PositionUtility.getValidBlockPos(location, this);
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// CraftBukkit end
|
|
||||||
// Paper start - fix bad state entities causing dupes
|
|
||||||
if (!isAlive() || !valid) {
|
|
||||||
@@ -4103,6 +4115,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
||||||
this.setPosRaw(x, y, z, false);
|
|
||||||
}
|
|
||||||
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
|
||||||
+ // Scissors start - Reassign x, y & z to prevent entities from moving outside the world border
|
|
||||||
+ Vec3 vec = PositionUtility.getValidVec3(x, y, z, this);
|
|
||||||
+ x = vec.x;
|
|
||||||
+ y = vec.y;
|
|
||||||
+ z = vec.z;
|
|
||||||
+ // Scissors end
|
|
||||||
+
|
|
||||||
// Paper start - block invalid positions
|
|
||||||
if (!checkPosition(this, x, y, z)) {
|
|
||||||
return;
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
|
||||||
index 2805ebfe4ffe769bcde778a1225b3101c91538d8..7c988395567c170d825af2bd99121f2d4d05cd8d 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package net.minecraft.world.entity.decoration;
|
|
||||||
|
|
||||||
+import com.github.atlasmediagroup.scissors.PositionUtility;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
@@ -265,7 +266,9 @@ 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 - Stop this stupid bullshit
|
|
||||||
+ this.pos = PositionUtility.getValidBlockPos(new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ")), this);
|
|
||||||
+ // Scissors end
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract int getWidth();
|
|
||||||
@@ -292,7 +295,9 @@ public abstract class HangingEntity extends Entity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPos(double x, double y, double z) {
|
|
||||||
- this.pos = new BlockPos(x, y, z);
|
|
||||||
+ // Scissors start - Fix this stupid bullshit
|
|
||||||
+ this.pos = PositionUtility.getValidBlockPos(new BlockPos(x, y, z), this);
|
|
||||||
+ // Scissors end
|
|
||||||
this.recalculateBoundingBox();
|
|
||||||
this.hasImpulse = true;
|
|
||||||
}
|
|
32
patches/server/0033-Add-spectator-teleport-event.patch
Normal file
32
patches/server/0033-Add-spectator-teleport-event.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 5 Jul 2022 04:00:42 +0100
|
||||||
|
Subject: [PATCH] Add spectator teleport event
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 64c438459f150af1cabdd3cea29c2951d42d69a0..b0bd0412010320cc624535d6abffe417a135a4dc 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
package net.minecraft.server.network;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.primitives.Floats;
|
||||||
|
import com.mojang.brigadier.ParseResults;
|
||||||
|
@@ -1948,6 +1949,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
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;
|
||||||
|
}
|
46
patches/server/0034-Prevent-invalid-container-events.patch
Normal file
46
patches/server/0034-Prevent-invalid-container-events.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 02:44:05 +0100
|
||||||
|
Subject: [PATCH] Prevent invalid container events
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index b0bd0412010320cc624535d6abffe417a135a4dc..65e9791d7e613d039f93184cde717bff8e97000c 100644
|
||||||
|
--- 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;
|
||||||
|
@@ -2642,6 +2644,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
public void handleContainerClick(ServerboundContainerClickPacket packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
if (this.player.isImmobile()) return; // CraftBukkit
|
||||||
|
+
|
||||||
|
this.player.resetLastActionTime();
|
||||||
|
if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit
|
||||||
|
boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
|
||||||
|
@@ -2661,6 +2664,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
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:45:15 +0100
|
||||||
|
Subject: [PATCH] Do not attempt to cast items to recipes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
index 0f19ef250a2f82e49730cb58ea43ee6bf407455a..764b56c2d5cdf5a57fced106d196ef866f70e885 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
|
@@ -634,6 +634,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||||
|
Entry<ResourceLocation> entry = (Entry) objectiterator.next();
|
||||||
|
|
||||||
|
worldserver.getRecipeManager().byKey((ResourceLocation) entry.getKey()).ifPresent((irecipe) -> {
|
||||||
|
+ // Scissors start - Do not attempt to cast items to recipes
|
||||||
|
+ if (!(irecipe instanceof AbstractCookingRecipe))
|
||||||
|
+ {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
list.add(irecipe);
|
||||||
|
AbstractFurnaceBlockEntity.createExperience(worldserver, vec3d, entry.getIntValue(), ((AbstractCookingRecipe) irecipe).getExperience(), blockposition, entityplayer, itemstack, amount); // CraftBukkit
|
||||||
|
});
|
@ -0,0 +1,456 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 09:57:10 +0100
|
||||||
|
Subject: [PATCH] Add Scissors configuration file & command
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||||
|
index 06bff37e4c1fddd3be6343049a66787c63fb420c..c7f93f7b8531c0783eba0c77e319d9a08588c184 100644
|
||||||
|
--- 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 io.papermc.paper.adventure.PaperAdventure;
|
||||||
|
import net.kyori.adventure.text.event.ClickEvent;
|
||||||
|
@@ -241,7 +242,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..2085c48fa4dda81bf275aee0b92c9e8206dba8e2
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsCommand.java
|
||||||
|
@@ -0,0 +1,156 @@
|
||||||
|
+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 java.io.File;
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.Arrays;
|
||||||
|
+import java.util.Collection;
|
||||||
|
+import java.util.Collections;
|
||||||
|
+import java.util.Iterator;
|
||||||
|
+import java.util.List;
|
||||||
|
+import java.util.Locale;
|
||||||
|
+import java.util.stream.Collectors;
|
||||||
|
+import net.minecraft.resources.ResourceLocation;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.ChatColor;
|
||||||
|
+import org.bukkit.Location;
|
||||||
|
+import org.bukkit.command.Command;
|
||||||
|
+import org.bukkit.command.CommandSender;
|
||||||
|
+
|
||||||
|
+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..9612d02814d6ae45d7087c34e0c8549e6c9aecf9
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -0,0 +1,175 @@
|
||||||
|
+package com.github.atlasmediagroup.scissors;
|
||||||
|
+
|
||||||
|
+import com.google.common.base.Throwables;
|
||||||
|
+import java.io.File;
|
||||||
|
+import java.io.IOException;
|
||||||
|
+import java.lang.reflect.InvocationTargetException;
|
||||||
|
+import java.lang.reflect.Method;
|
||||||
|
+import java.lang.reflect.Modifier;
|
||||||
|
+import java.util.HashMap;
|
||||||
|
+import java.util.List;
|
||||||
|
+import java.util.Map;
|
||||||
|
+import java.util.logging.Level;
|
||||||
|
+import java.util.regex.Pattern;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.command.Command;
|
||||||
|
+import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
+import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
+
|
||||||
|
+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://scissors.gg/javadoc/1.18.2/\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);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ 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);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ 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 1e0d261439255091a6f61485c0747231fbd5b1db..63861ff0c0e942dfafad7ceedfa17864c100b301 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
|
@@ -114,6 +114,7 @@ public class Main {
|
||||||
|
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = loadConfigFile((File) optionset.valueOf("bukkit-settings"));
|
||||||
|
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = loadConfigFile((File) optionset.valueOf("spigot-settings"));
|
||||||
|
org.bukkit.configuration.file.YamlConfiguration paperConfiguration = loadConfigFile((File) optionset.valueOf("paper-settings"));
|
||||||
|
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = loadConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors
|
||||||
|
// 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 257c94f7c1cb00c9a91ab82e311dfd8eca29c538..605602ca03bd0d974b559881ab0ad4da66640002 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
|
@@ -235,7 +235,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
|
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
||||||
|
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 ebd5aeceb4ac1a6300bbfa70218421f0d91b7614..b17f788c982a5c46e493edd447c07bedfcefd2fd 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -956,6 +956,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
|
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))
|
||||||
|
@@ -987,6 +988,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");
|
||||||
|
|
||||||
|
@@ -2714,6 +2716,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 40313b014b4ed5f7e9505bde2827383c19d4377a..d88a755e18c1da5e5a64ff88d96be33e3dd3dcc3 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("Unknown Server")
|
||||||
|
.describedAs("Name");
|
||||||
|
// Paper end
|
||||||
|
+
|
||||||
|
+ // Scissors start
|
||||||
|
+ acceptsAll(asList("scissors", "scissors-settings"), "File for scissors settings")
|
||||||
|
+ .withRequiredArg()
|
||||||
|
+ .ofType(File.class)
|
||||||
|
+ .defaultsTo(new File("scissors.yml"))
|
||||||
|
+ .describedAs("Yml file");
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 10 Jul 2022 10:06:58 +0100
|
||||||
|
Subject: [PATCH] Disable running commands in books by default
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||||
|
index 26a9a15cc630113cd8d2c8287c6b0f1067ce53f0..15419727d37fc75bc18177cf3ea2daa54f97ec47 100644
|
||||||
|
--- 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 (com.destroystokyo.paper.PaperConfig.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper
|
||||||
|
- compoundTag.putBoolean("resolved", true);
|
||||||
|
+ if (compoundTag != null) { // Paper
|
||||||
|
if (!makeSureTagIsValid(compoundTag)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
@@ -165,8 +164,41 @@ public class WrittenBookItem extends Item {
|
||||||
|
component2 = new TextComponent(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
- 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,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luna <lunahatesgogle@gmail.com>
|
||||||
|
Date: Mon, 11 Jul 2022 17:21:37 -0300
|
||||||
|
Subject: [PATCH] Validate block entity tag query positions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 65e9791d7e613d039f93184cde717bff8e97000c..2e6e1af5244202e0bc77b443f089b4f3016be8ac 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -1273,7 +1273,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
@Override
|
||||||
|
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
|
||||||
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||||
|
- if (this.player.hasPermissions(2)) {
|
||||||
|
+ if (this.player.hasPermissions(2) && Level.isInSpawnableBounds(packet.getPos())) { // Scissors - Validate block entity tag query positions
|
||||||
|
BlockEntity tileentity = this.player.getLevel().getBlockEntity(packet.getPos());
|
||||||
|
CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null;
|
||||||
|
|
@ -0,0 +1,93 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Wed, 13 Jul 2022 11:31:04 +0100
|
||||||
|
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
index 9612d02814d6ae45d7087c34e0c8549e6c9aecf9..ad222b622979716efdb0ea14cbf2cbcb4acf2e74 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -64,8 +64,8 @@ public class ScissorsConfig
|
||||||
|
config.options().header(HEADER);
|
||||||
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
|
- version = getInt("config-version", 1);
|
||||||
|
- set("config-version", 1);
|
||||||
|
+ version = getInt("config-version", 2);
|
||||||
|
+ set("config-version", 2);
|
||||||
|
readConfig(ScissorsConfig.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -132,6 +132,13 @@ public class ScissorsConfig
|
||||||
|
runCommandsInBooks = getBoolean("runCommandsInBooks", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // people still may want them to bypass permissions for warps
|
||||||
|
+ public static boolean commandSignsBypassPermissions = false;
|
||||||
|
+ public static void commandSignsBypassPermissions()
|
||||||
|
+ {
|
||||||
|
+ commandSignsBypassPermissions = getBoolean("commandSignsBypassPermissions", false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static void set(String path, Object val)
|
||||||
|
{
|
||||||
|
config.set(path, val);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
index d5bcc81a809e3c733c6fc11309bcf0913860edf6..19e04b0b47c0e185b5e02e8a7c00bab551a0d45e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||||
|
@@ -1,11 +1,13 @@
|
||||||
|
package net.minecraft.world.level.block.entity;
|
||||||
|
|
||||||
|
+import com.github.atlasmediagroup.scissors.ScissorsConfig;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import net.minecraft.commands.CommandSource;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
+import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.chat.ClickEvent;
|
||||||
|
@@ -15,6 +17,7 @@ import net.minecraft.network.chat.MutableComponent;
|
||||||
|
import net.minecraft.network.chat.Style;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
+import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
|
@@ -23,6 +26,8 @@ import net.minecraft.world.item.DyeColor;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.phys.Vec2;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
+import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
|
|
||||||
|
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
|
||||||
|
private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper
|
||||||
|
@@ -236,7 +241,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||||
|
if (!event.callEvent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
- player.getServer().getCommands().performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||||
|
+
|
||||||
|
+ // Scissors start - Add optional permissions to command signs
|
||||||
|
+ final MinecraftServer vanillaServer = player.getServer();
|
||||||
|
+ final CraftServer craftServer = vanillaServer.server;
|
||||||
|
+ final CraftPlayer craftPlayer = player.getBukkitEntity();
|
||||||
|
+ final Commands commands = vanillaServer.getCommands();
|
||||||
|
+
|
||||||
|
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
||||||
|
+ {
|
||||||
|
+ commands.performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage());
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
// Paper end
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Tue, 16 Aug 2022 17:25:37 +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,38 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sat, 20 Aug 2022 03:01:56 +0100
|
||||||
|
Subject: [PATCH] Fix exploit where paintings are able to spawn out of bounds
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
index ad222b622979716efdb0ea14cbf2cbcb4acf2e74..33b97f0738fbc4a54a174e9419275770e4513ca0 100644
|
||||||
|
--- a/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
+++ b/src/main/java/com/github/atlasmediagroup/scissors/ScissorsConfig.java
|
||||||
|
@@ -30,7 +30,7 @@ public class ScissorsConfig
|
||||||
|
|
||||||
|
Discord: https://discord.com/invite/mtVQcHn58h
|
||||||
|
Website: https://scissors.gg/\s
|
||||||
|
- Docs: https://scissors.gg/javadoc/1.18.2/\s
|
||||||
|
+ Docs: https://javadoc.scissors.gg/1.18.2/\s
|
||||||
|
""";
|
||||||
|
private static final Pattern SPACE = Pattern.compile(" ");
|
||||||
|
private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
index 2805ebfe4ffe769bcde778a1225b3101c91538d8..3c4bfad55e438c5e723ef58c9cc24908af9e0846 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
|
||||||
|
@@ -265,7 +265,13 @@ public abstract class HangingEntity extends Entity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
|
- this.pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||||
|
+ // Scissors start - Fix exploit where paintings are able to spawn out of bounds
|
||||||
|
+ final BlockPos pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
|
||||||
|
+ if (this.level.isLoadedAndInBounds(pos))
|
||||||
|
+ {
|
||||||
|
+ this.pos = pos;
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int getWidth();
|
86
patches/server/0042-Prevent-velocity-freeze.patch
Normal file
86
patches/server/0042-Prevent-velocity-freeze.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Allink <arclicious@vivaldi.net>
|
||||||
|
Date: Sun, 27 Nov 2022 04:56:24 +0000
|
||||||
|
Subject: [PATCH] Prevent velocity freeze
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
|
||||||
|
index fa4e930388baa2ee0a752873b2ec1a67cc020de6..8ba2433de1e079e2227b97a5a7b5f06a6f34984f 100644
|
||||||
|
--- 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 = xPower;
|
||||||
|
+ this.yPower = yPower;
|
||||||
|
+ this.zPower = zPower;
|
||||||
|
+ }
|
||||||
|
+ // 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -193,9 +220,12 @@ public abstract class AbstractHurtingProjectile extends Projectile {
|
||||||
|
Vec3 vec3d = entity.getLookAngle();
|
||||||
|
|
||||||
|
this.setDeltaMovement(vec3d);
|
||||||
|
- this.xPower = vec3d.x * 0.1D;
|
||||||
|
- this.yPower = vec3d.y * 0.1D;
|
||||||
|
- this.zPower = vec3d.z * 0.1D;
|
||||||
|
+ // Scissors start - Prevent projectile velocity freeze
|
||||||
|
+ //this.xPower = vec3d.x * 0.1D;
|
||||||
|
+ //this.yPower = vec3d.y * 0.1D;
|
||||||
|
+ //this.zPower = vec3d.z * 0.1D;
|
||||||
|
+ setPower(vec3d.x * 0.1D, vec3d.y * 0.1D, vec3d.z * 0.1D);
|
||||||
|
+ // Scissors end
|
||||||
|
this.setOwner(entity);
|
||||||
|
}
|
||||||
|
|
74
patches/server/0043-Implement-command-block-events.patch
Normal file
74
patches/server/0043-Implement-command-block-events.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sun, 11 Jun 2023 00:00:20 -0500
|
||||||
|
Subject: [PATCH] Implement command block events
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
index 2e6e1af5244202e0bc77b443f089b4f3016be8ac..f1f17e33cddf23fffae96d60bfd92934b6ab3c5a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -25,6 +25,8 @@ import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent;
|
||||||
|
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent;
|
||||||
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.CrashReport;
|
||||||
|
@@ -156,6 +158,7 @@ import net.minecraft.world.phys.shapes.BooleanOp;
|
||||||
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
+import org.bukkit.entity.minecart.CommandMinecart;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
@@ -916,6 +919,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
this.player.level.getChunkAt(blockposition).setBlockEntity(tileentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Scissors start - Implement command block events
|
||||||
|
+ if (commandblocklistenerabstract instanceof org.bukkit.block.CommandBlock commandBlock) {
|
||||||
|
+ CommandBlockPlayerEditEvent event = new CommandBlockPlayerEditEvent(this.getCraftPlayer(), Objects.requireNonNullElse(commandblocklistenerabstract.getCommand(), ""), s, commandBlock);
|
||||||
|
+ event.callEvent();
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ s = event.getNewCommand();
|
||||||
|
+ }
|
||||||
|
+ // Scissors end
|
||||||
|
+
|
||||||
|
commandblocklistenerabstract.setCommand(s);
|
||||||
|
commandblocklistenerabstract.setTrackOutput(flag);
|
||||||
|
if (!flag) {
|
||||||
|
@@ -947,7 +963,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||||
|
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level);
|
||||||
|
|
||||||
|
if (commandblocklistenerabstract != null) {
|
||||||
|
- commandblocklistenerabstract.setCommand(packet.getCommand());
|
||||||
|
+ // Scissors start - Implement command block events
|
||||||
|
+ String command = packet.getCommand();
|
||||||
|
+
|
||||||
|
+ if (commandblocklistenerabstract instanceof CommandMinecart commandMinecart) {
|
||||||
|
+ CommandMinecartPlayerEditEvent event = new CommandMinecartPlayerEditEvent(this.getCraftPlayer(), Objects.requireNonNullElse(commandblocklistenerabstract.getCommand(), ""), command, commandMinecart);
|
||||||
|
+ event.callEvent();
|
||||||
|
+
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ command = event.getNewCommand();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ commandblocklistenerabstract.setCommand(command);
|
||||||
|
+
|
||||||
|
+ // commandblocklistenerabstract.setCommand(packet.getCommand());
|
||||||
|
+
|
||||||
|
+ // Scissors end
|
||||||
|
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
|
||||||
|
if (!packet.isTrackOutput()) {
|
||||||
|
commandblocklistenerabstract.setLastOutput((Component) null);
|
Reference in New Issue
Block a user