Initial commit

This commit is contained in:
JeremyStar™ 2024-04-23 17:15:46 +02:00
commit 89789374cb
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
55 changed files with 162455 additions and 0 deletions

136
.gitignore vendored Normal file
View file

@ -0,0 +1,136 @@
# User-specific stuff
.idea/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
# Cache of project
.gradletasknamecache
**/build/
# Common working directory
run/
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Avoid committing large parts of the server
server/.console_history
server/banned-ips.json
server/banned-players.json
server/commands.yml
server/config
server/help.yml
server/logs
server/ops.json
server/permissions.yml
server/plugins/spark/tmp
server/usercache.json
server/version_history.json
server/whitelist.json
server/world
server/world_nether
server/world_the_end

662
LICENSE Normal file
View file

@ -0,0 +1,662 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 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 Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are 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.
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.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
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 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 work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero 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 Affero 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 Affero 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 Affero 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 Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero 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 your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
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 AGPL, see
<https://www.gnu.org/licenses/>.

12
README.md Normal file
View file

@ -0,0 +1,12 @@
# PickShadow Server Plugin
PSSP is intended as a all-in-one plugin for Bukkit-implementing server software for JeremyStarTM's PickShadow survival server.
## Index
- [Used where?](#used-where)
- [Contributing](#contributing)
## Used where?
This plugin is used on JeremyStarTM's **PickShadow** server, a survival server (or SMP, if you like) and replaces many commands such as /msg but also adds a few new ones. And before you ask: No you can't join.
## Contributing
Please don't.

51
build.gradle Normal file
View file

@ -0,0 +1,51 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
}
group = 'de.pickshadow'
version = '1-alpha0'
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
}
dependencies {
compileOnly "io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT"
implementation 'com.nikialeksey:jhunspell:1.0.5'
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}

0
gradle.properties Normal file
View file

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

249
gradlew vendored Executable file
View file

@ -0,0 +1,249 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

92
gradlew.bat vendored Normal file
View file

@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

32
server/bukkit.yml Normal file
View file

@ -0,0 +1,32 @@
settings:
allow-end: true
warn-on-overload: true
permissions-file: permissions.yml
update-folder: update
plugin-profiling: false
connection-throttle: 4000
query-plugins: true
deprecated-verbose: default
shutdown-message: Server closed
minimum-api: none
use-map-color-cache: true
spawn-limits:
monsters: 70
animals: 10
water-animals: 5
water-ambient: 20
water-underground-creature: 5
axolotls: 5
ambient: 15
chunk-gc:
period-in-ticks: 600
ticks-per:
animal-spawns: 400
monster-spawns: 1
water-spawns: 1
water-ambient-spawns: 1
water-underground-creature-spawns: 1
axolotl-spawns: 1
ambient-spawns: 1
autosave: 6000
aliases: now-in-commands.yml

31
server/debugstart.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
set -eo pipefail
if [ -z "${TIMEOUT}" ]; then
echo "-> Set \$TIMEOUT"
export "TIMEOUT=1s"
fi
while true; do
clear
echo "-> Removing plugin data"
rm -rfv /tmp/pssp-plugin-data
echo "-> Creating plugin directory"
mkdir -p /tmp/pssp-plugin-data
echo "-> Downloading server"
if [ ! -f "server.jar" ]; then
if ! wget "https://api.purpurmc.org/v2/purpur/1.20.4/latest/download" -O server.jar.tmp; then
echo "-> Failed to download server, exiting"
rm -rf server.jar.tmp
exit 1
fi
mv server.jar.tmp server.jar
fi
echo "-> Starting server"
if java --add-modules=jdk.incubator.vector -jar server.jar nogui --nogui; then
echo "-> Server shut down."
echo " Restarting in ${TIMEOUT}. Press CTRL+C to cancel."
else
echo "-> Server stopped with code ${?}."
echo " Restarting in ${TIMEOUT}. Press CTRL+C to cancel."
fi
sleep "${TIMEOUT}"
done

1
server/eula.txt Normal file
View file

@ -0,0 +1 @@
eula=true

View file

@ -0,0 +1,15 @@
# Whether FreedomChat should replace player (signed or unsigned) chat with
# system messages. This is what makes chat not reportable.
rewrite-chat: true
# Whether FreedomChat should claim to clients that secure chat is enforced.
# With this set to true, the "Chat messages can't be verified" toast will not
# be shown. This is, in default configurations, unrelated to allowing clients
# not signing their messages join.
claim-secure-chat-enforced: true
# Whether to report the server as secure (disabling chat reporting) to the
# NoChatReports client mod. This displays a green icon on the server list
# screen and if enforce-secure-profiles is disabled the open chat screen
# for users of the client-side mod.
send-prevents-chat-reports-to-client: false

1
server/plugins/PSSP Symbolic link
View file

@ -0,0 +1 @@
/tmp/pssp-plugin-data

View file

@ -0,0 +1,8 @@
# bStats collects some data for plugin authors like how many servers are using their plugins.
# To honor their work, you should not disable it.
# This has nearly no effect on the server performance!
# Check out https://bStats.org/ to learn more :)
enabled: false
serverUuid: fuck-analytics
logFailedRequests: false

View file

@ -0,0 +1,4 @@
{
"_header": "spark configuration file - https://spark.lucko.me/docs/Configuration",
"backgroundProfiler": true
}

36
server/pufferfish.yml Normal file
View file

@ -0,0 +1,36 @@
# Pufferfish Configuration
# Check out Pufferfish Host for maximum performance server hosting: https://pufferfish.host
# Join our Discord for support: https://discord.gg/reZw4vQV9H
# Download new builds at https://ci.pufferfish.host/job/Pufferfish
info:
version: '1.0'
# These values define a entity's maximum lifespan. If an
# entity is in this list and it has survived for longer than
# that number of ticks, then it will be removed. Setting a value to
# -1 disables this feature.
entity_timeouts:
SNOWBALL: -1
LLAMA_SPIT: -1
enable-books: true
enable-suffocation-optimization: true
enable-async-mob-spawning: true
# Optimizes projectile settings
projectile:
max-loads-per-tick: 10
max-loads-per-projectile: 10
# Optimizes entity brains when
# they're far away from the player
dab:
enabled: false
start-distance: 12
max-tick-freq: 20
activation-dist-mod: 8
blacklisted-entities: []
inactive-goal-selector-throttle: false
# Settings for things that don't belong elsewhere
misc:
disable-method-profiler: true
disable-out-of-order-chat: false
tps-catchup: true
allow-end-crystal-respawn: true
sentry-dsn: ''

1720
server/purpur.yml Normal file

File diff suppressed because it is too large Load diff

62
server/server.properties Normal file
View file

@ -0,0 +1,62 @@
#Minecraft server properties
#Tue Apr 23 17:13:56 CEST 2024
enable-jmx-monitoring=false
rcon.port=25575
level-seed=
enable-command-block=true
gamemode=survival
enable-query=false
generator-settings={}
enforce-secure-profile=false
level-name=world
motd=A Minecraft Server
query.port=25565
pvp=true
generate-structures=true
max-chained-neighbor-updates=1000000
difficulty=easy
network-compression-threshold=256
max-tick-time=60000
require-resource-pack=false
max-players=20
use-native-transport=true
online-mode=true
enable-status=true
allow-flight=false
initial-disabled-packs=
broadcast-rcon-to-ops=true
view-distance=10
resource-pack-prompt=
server-ip=
allow-nether=true
server-port=25565
enable-rcon=false
sync-chunk-writes=true
resource-pack-id=
server-name=Unknown Server
op-permission-level=4
prevent-proxy-connections=false
hide-online-players=false
resource-pack=
entity-broadcast-range-percentage=100
simulation-distance=10
rcon.password=
player-idle-timeout=0
force-gamemode=false
debug=false
rate-limit=0
hardcore=false
white-list=true
broadcast-console-to-ops=true
spawn-npcs=true
spawn-animals=true
log-ips=true
function-permission-level=2
initial-enabled-packs=vanilla
level-type=minecraft\:normal
text-filtering-config=
spawn-monsters=true
enforce-whitelist=false
spawn-protection=16
resource-pack-sha1=
max-world-size=29999984

178
server/spigot.yml Normal file
View file

@ -0,0 +1,178 @@
# This is the main configuration file for Spigot.
# 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.
# For a reference for any variable inside this file, check out the Spigot wiki at
# http://www.spigotmc.org/wiki/spigot-configuration/
#
# If you need help with the configuration or have any questions related to Spigot,
# join us at the Discord or drop by our forums and leave a post.
#
# Discord: https://www.spigotmc.org/go/discord
# Forums: http://www.spigotmc.org/
messages:
whitelist: You are not whitelisted on this server!
unknown-command: Unknown command. Type "/help" for help.
server-full: The server is full!
outdated-client: Outdated client! Please use {0}
outdated-server: Outdated server! I'm still on {0}
restart: Server is restarting
advancements:
disable-saving: false
disabled:
- minecraft:story/disabled
world-settings:
default:
below-zero-generation-in-existing-chunks: true
merge-radius:
item: 2.5
exp: 3.0
view-distance: default
simulation-distance: default
mob-spawn-range: 8
item-despawn-rate: 6000
arrow-despawn-rate: 1200
trident-despawn-rate: 1200
zombie-aggressive-towards-villager: true
nerf-spawner-mobs: false
enable-zombie-pigmen-portal-spawns: true
wither-spawn-sound-radius: 0
end-portal-sound-radius: 0
hanging-tick-frequency: 100
thunder-chance: 100000
growth:
cactus-modifier: 100
cane-modifier: 100
melon-modifier: 100
mushroom-modifier: 100
pumpkin-modifier: 100
sapling-modifier: 100
beetroot-modifier: 100
carrot-modifier: 100
potato-modifier: 100
torchflower-modifier: 100
wheat-modifier: 100
netherwart-modifier: 100
vine-modifier: 100
cocoa-modifier: 100
bamboo-modifier: 100
sweetberry-modifier: 100
kelp-modifier: 100
twistingvines-modifier: 100
weepingvines-modifier: 100
cavevines-modifier: 100
glowberry-modifier: 100
pitcherplant-modifier: 100
entity-activation-range:
animals: 32
monsters: 32
raiders: 48
misc: 16
water: 16
villagers: 32
flying-monsters: 32
wake-up-inactive:
animals-max-per-tick: 4
animals-every: 1200
animals-for: 100
monsters-max-per-tick: 8
monsters-every: 400
monsters-for: 100
villagers-max-per-tick: 4
villagers-every: 600
villagers-for: 100
flying-monsters-max-per-tick: 8
flying-monsters-every: 200
flying-monsters-for: 100
villagers-work-immunity-after: 100
villagers-work-immunity-for: 20
villagers-active-for-panic: true
tick-inactive-villagers: true
ignore-spectators: false
entity-tracking-range:
players: 48
animals: 48
monsters: 48
misc: 32
display: 128
other: 64
ticks-per:
hopper-transfer: 8
hopper-check: 1
hopper-amount: 1
hopper-can-load-chunks: false
dragon-death-sound-radius: 0
seed-village: 10387312
seed-desert: 14357617
seed-igloo: 14357618
seed-jungle: 14357619
seed-swamp: 14357620
seed-monument: 10387313
seed-shipwreck: 165745295
seed-ocean: 14357621
seed-outpost: 165745296
seed-endcity: 10387313
seed-slime: 987234911
seed-nether: 30084232
seed-mansion: 10387319
seed-fossil: 14357921
seed-portal: 34222645
seed-ancientcity: 20083232
seed-trailruins: 83469867
seed-trialchambers: 94251327
seed-buriedtreasure: 10387320
seed-mineshaft: default
seed-stronghold: default
hunger:
jump-walk-exhaustion: 0.05
jump-sprint-exhaustion: 0.2
combat-exhaustion: 0.1
regen-exhaustion: 6.0
swim-multiplier: 0.01
sprint-multiplier: 0.1
other-multiplier: 0.0
max-tnt-per-tick: 100
max-tick-time:
tile: 50
entity: 50
verbose: false
settings:
timeout-time: 60
restart-on-crash: true
restart-script: ./start.sh
bungeecord: false
save-user-cache-on-stop-only: false
sample-count: 12
player-shuffle: 0
user-cache-size: 1000
moved-wrongly-threshold: 0.0625
moved-too-quickly-multiplier: 10.0
netty-threads: 4
attribute:
maxHealth:
max: 2048.0
movementSpeed:
max: 2048.0
attackDamage:
max: 2048.0
log-villager-deaths: true
log-named-deaths: true
debug: false
commands:
spam-exclusions:
- /skill
silent-commandblock-console: false
replace-commands:
- setblock
- summon
- testforblock
- tellraw
log: true
tab-complete: 0
send-namespaced: true
players:
disable-saving: false
config-version: 12
stats:
disable-saving: false
forced-stats: {}

1
settings.gradle Normal file
View file

@ -0,0 +1 @@
rootProject.name = 'PSSP'

View file

@ -0,0 +1,71 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
import de.pickshadow.plugin.classes.Types;
public final class BuildConfiguration {
// Plugin information
// -> Update in plugin.yml and build.gradle when necessary
public static final String pluginName = "PickShadow Server Plugin";
public static final int pluginRelease = 1;
public static final Types.VersionType pluginVersionType = Types.VersionType.ALPHA;
public static final int pluginTyperelease = 0;
public static final String[] pluginAuthors = new String[]{ "JeremyStarTM" };
public static final String[] pluginContributors = new String[]{};
public static final String pluginLicense = "GNU AGPL v3 (or later)";
public static final String pluginSourceCode = "https://git.staropensource.de/JeremyStarTM/PSSP";
// General
public static final boolean shutdownServerOnInitializationFailure = true;
// Contact
public static final String contactName = "JeremyStar™";
public static final String contactEmail = "jeremystartm@staropensource.de";
// Verbose logging
public static final boolean provideVerboseLoggingForSpellingHelpers = false;
public static final boolean provideVerboseLoggingForSpellingCompletions = false;
// Command configuration
// -> /msg & /reply
public static final boolean allowSelfMessaging = false;
// Returns the type as a String
public static String getTypeAsString(boolean technical) {
switch (pluginVersionType) {
case RELEASE -> {
return technical ? "r" : "Release";
}
case RELEASECANDIDATE -> {
return technical ? "rc" : "Release Candidate";
}
case BETA -> {
return technical ? "b" : "Beta";
}
case ALPHA -> {
return technical ? "a" : "Alpha";
}
default -> {
return "invalid";
}
}
}
}

View file

@ -0,0 +1,114 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.classes.logger.implementations.ExtendedBukkitLogger;
import de.pickshadow.plugin.loaders.ConfigLoader;
import de.pickshadow.plugin.loaders.PlayerDataLoader;
import de.pickshadow.plugin.utils.SpellingHelper;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin {
// Ensure safety
private boolean failed = false;
private boolean preinitialized = false;
private boolean initialized = false;
private LoggerInstanceImpl logger;
// Initialize classes
@Override
public void onLoad() {
// Check operating system
if (!System.getProperty("os.name").contains("Linux")) {
failed = true;
if (BuildConfiguration.shutdownServerOnInitializationFailure) {
Bukkit.shutdown();
}
throw new IllegalStateException("Invalid operating system '" + System.getProperty("os.name") + "'. PSSP only supports Linux-based operating systems.");
}
// Update ObjHolder
ObjHolder.main = this;
ObjHolder.logger = new ExtendedBukkitLogger();
ObjHolder.spellingHelper = new SpellingHelper();
ObjHolder.configLoader = new ConfigLoader();
ObjHolder.playerDataLoader = new PlayerDataLoader();
ObjHolder.pluginInitializer = new PluginInitializer();
ObjHolder.scheduler = new Scheduler();
// Initialize objects
logger = ObjHolder.logger.getInstance(getClass());
logger.diag("Finished onLoad()");
preinitialized = true;
}
// Initialize classes requiring Bukkit API + initialize plugin
@Override
public void onEnable() {
if (failed || !preinitialized) {
if (BuildConfiguration.shutdownServerOnInitializationFailure) {
Bukkit.shutdown();
}
throw new IllegalStateException("Preinitialization failed already, unable to execute onEnable method.");
} else if (logger == null) {
failed = true;
if (BuildConfiguration.shutdownServerOnInitializationFailure) {
Bukkit.shutdown();
}
throw new IllegalStateException("Logger is equal to null, unable to execute onEnable method.");
}
logger.diag("Called onEnable()");
// Invoke PluginInitializer
logger.verb("Invoking pluginInitializer.initialize()");
String error = ObjHolder.pluginInitializer.initialize();
if (!error.isEmpty()) {
// Could not initialize, throw error
failed = true;
throw new IllegalStateException("Could not initialize plugin: " + error);
}
logger.diag("Finished onEnable()");
initialized = true;
}
// Shutdown plugin
@Override
public void onDisable() {
if (failed || !initialized) {
throw new IllegalStateException("Initialization failed, unable to uninitialize for safety reasons.");
} else if (logger == null) {
if (BuildConfiguration.shutdownServerOnInitializationFailure) {
Bukkit.shutdown();
}
throw new IllegalStateException("Logger is equal to null, unable to execute onDisable method.");
}
logger.diag("Called onDisable()");
// Invoke PluginInitializer
logger.verb("Invoking pluginInitializer.uninitialize()");
ObjHolder.pluginInitializer.uninitialize();
logger.diag("Finished onDisable()");
}
}

View file

@ -0,0 +1,46 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
import de.pickshadow.plugin.classes.logger.LoggerImpl;
import de.pickshadow.plugin.loaders.ConfigLoader;
import de.pickshadow.plugin.classes.Configuration;
import de.pickshadow.plugin.loaders.PlayerDataLoader;
import de.pickshadow.plugin.utils.SpellingHelper;
public class ObjHolder {
/*
This class only holds references to various non-static objects.
This class is intended to ease development and prevent sharing
objects around classes.
*/
// Plugin management
public static Main main;
public static PluginInitializer pluginInitializer;
public static Scheduler scheduler;
// Utility classes
public static LoggerImpl logger;
public static SpellingHelper spellingHelper;
// Loaders
public static ConfigLoader configLoader;
public static PlayerDataLoader playerDataLoader;
// Configuration
public static Configuration config;
}

View file

@ -0,0 +1,101 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.commands.*;
import de.pickshadow.plugin.loaders.ConfigLoader;
import de.pickshadow.plugin.listeners.ChatMessageOverrideListener;
import de.pickshadow.plugin.listeners.JoinLeaveMessagesListener;
import de.pickshadow.plugin.utils.SpellingHelper;
import org.bukkit.Bukkit;
import java.util.UUID;
public class PluginInitializer {
// Objects
private final LoggerInstanceImpl logger;
public PluginInitializer() {
logger = ObjHolder.logger.getInstance(getClass());
}
public String initialize() {
logger.info("Initializing PSSP");
// Load configuration file
logger.verb("Loading configuration");
ObjHolder.configLoader = new ConfigLoader();
ObjHolder.config = ObjHolder.configLoader.loadConfig();
if (ObjHolder.config == null) {
return "configLoader.loadConfig() returned null";
}
// Extract spelling files
logger.verb("Extracting spelling files");
ObjHolder.spellingHelper = new SpellingHelper();
String errorExtractFiles = ObjHolder.spellingHelper.extractFiles();
if (!errorExtractFiles.isEmpty()) {
return "Could not extract spelling files: " + errorExtractFiles;
}
// Update spelling language
logger.verb("Updating spelling language");
if (!ObjHolder.spellingHelper.setActiveLanguage(ObjHolder.config.defaultSpellingLanguage)) {
return "Could not update active spelling language";
}
// Register commands
logger.verb("Registering commands");
try {
new BroadcastCommand().registerCommand();
new DiscordCommand().registerCommand();
new HomeCommand().registerCommand();
new PluginCommand().registerCommand();
new SystemInformationCommand().registerCommand();
new TrollCommand().registerCommand();
new MsgCommand().registerCommand();
} catch (NullPointerException e) {
logger.crash("Could not register plugin commands", e.getStackTrace());
}
// Register listeners
logger.verb("Registering listeners");
logger.diag("Registering ChatMessageOverrideListener");
Bukkit.getServer().getPluginManager().registerEvents(new ChatMessageOverrideListener(), ObjHolder.main);
logger.diag("Registering JoinLeaveMessagesListener");
Bukkit.getServer().getPluginManager().registerEvents(new JoinLeaveMessagesListener(), ObjHolder.main);
// Setup scheduler
logger.diag("Initializing scheduler");
ObjHolder.scheduler.initializeScheduler();
logger.info("Initialized PSSP");
return "";
}
public void uninitialize() {
logger.info("Uninitializing PSSP");
logger.verb("Closing Hunspell instance");
ObjHolder.spellingHelper.setActiveLanguage(null);
logger.verb("Saving player data");
for (UUID uuid : ObjHolder.playerDataLoader.getLoadedUUIDs()) ObjHolder.playerDataLoader.savePlayerData(uuid);
logger.info("Uninitialized PSSP");
}
}

View file

@ -0,0 +1,43 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import org.bukkit.Bukkit;
import java.util.UUID;
public class Scheduler {
LoggerInstanceImpl logger;
public void initializeScheduler() {
logger = ObjHolder.logger.getInstance(getClass());
logger.verb("Scheduling tasks");
Bukkit.getScheduler().runTaskLater(ObjHolder.main, this::runMinuteTasks, 1200L);
}
public void runMinuteTasks() {
logger.diag("Running minutely tasks");
// Save player data
for (UUID uuid : ObjHolder.playerDataLoader.getLoadedUUIDs()) ObjHolder.playerDataLoader.savePlayerData(uuid);
// Schedule
Bukkit.getScheduler().runTaskLater(ObjHolder.main, this::runMinuteTasks, 1200L);
}
}

View file

@ -0,0 +1,64 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import org.bukkit.Bukkit;
import org.bukkit.command.*;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public abstract class CommandBase implements CommandExecutor {
// Objects
protected final LoggerInstanceImpl logger;
// Command properties
protected String[] commandNames = new String[0];
// Constructor
public CommandBase() {
logger = ObjHolder.logger.getInstance(this.getClass());
}
// Registration
public void registerCommand() throws NullPointerException {
for (String commandName : commandNames) {
logger.diag("Registering command /" + commandName + " (" + this.getClass().getName().replace(this.getClass().getPackageName() + ".", "") + ")");
Objects.requireNonNull(Bukkit.getPluginCommand(commandName)).setExecutor(this);
Objects.requireNonNull(Bukkit.getPluginCommand(commandName)).setTabCompleter(this.getCompletion());
}
}
public void unregisterCommand() throws NullPointerException {
for (String commandName : commandNames) {
logger.diag("Unregistering command /" + commandName + " (" + this.getClass().getName().replace(this.getClass().getPackageName() + ".", "") + ")");
Objects.requireNonNull(Bukkit.getPluginCommand(commandName)).setExecutor(null);
Objects.requireNonNull(Bukkit.getPluginCommand(commandName)).setTabCompleter(null);
}
}
// Command code
@Override
public abstract boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args);
// Command completion
public abstract TabCompleter getCompletion();
}

View file

@ -0,0 +1,26 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes;
public class Configuration {
public int version = -1;
public boolean enablePrefix = false;
public String inviteLink = "";
public String defaultSpellingLanguage = "de_DE";
}

View file

@ -0,0 +1,86 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes;
import de.pickshadow.plugin.ObjHolder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
public class PlayerData {
// Player data
public int version = 0;
public UUID playerId = null;
public long firstPlayed = 0;
public long lastPlayed = 0;
public UUID lastMessagedPlayer = null;
// Constructors
public PlayerData(@NotNull UUID uuid) {
playerId = uuid;
}
public PlayerData(@NotNull String name) {
playerId = Bukkit.getPlayerUniqueId(name);
}
public PlayerData(@NotNull Player player) {
playerId = player.getUniqueId();
}
// Used for loading player data off disk
@ApiStatus.Internal
public PlayerData() {}
// Convert data into config string
public String convertToConfig() {
return "##############################\n" +
"## PickShadow Server Plugin ##\n" +
"## Player data file ##\n" +
"##############################\n" +
"### DO NOT REMOVE THESE LINES OR THIS PLUGIN WILL BREAK ###\n" +
"!!de.pickshadow.plugin.classes.PlayerData\n" +
"version: " + version + "\n" +
"playerId: " + playerId + "\n" +
"### DO NOT REMOVE THESE LINES OR THIS PLUGIN WILL BREAK ###\n" +
"\n" +
"firstPlayed: " + firstPlayed + "\n" +
"lastPlayed: " + lastPlayed + "\n" +
"lastMessagedPlayer: " + lastMessagedPlayer;
}
// Convert data into debuggable string
public String convertToString() {
StringBuilder string = new StringBuilder();
boolean stringEmpty = true;
for (String var : new String[]{ "version", "playerId", "firstPlayed", "lastPlayed", "lastMessagedPlayer" }) {
if (stringEmpty) {
stringEmpty = false;
} else {
string.append("\n");
}
try {
string.append(var).append("=").append(this.getClass().getField(var).get(this));
} catch (NoSuchFieldException | IllegalAccessException e) {
ObjHolder.logger.crash(getClass(), "Couldn't convert player data for UUID '" + playerId + "' to string: Got exception: " + e.getMessage(), e.getStackTrace());
}
}
return string.toString();
}
}

View file

@ -0,0 +1,109 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import java.util.Arrays;
public class Translation {
// Global
public static String GLOBAL_PREFIX = "<dark_gray>[<BRANDING>PickShadow<BRANDING_END><dark_gray>] <reset>";
public static String GLOBAL_EXCEPTION = "Ein Fehler ist während der Ausführung des Befehls aufgetreten. Bitte sende eine E-Mail an " + BuildConfiguration.contactName + " (" + BuildConfiguration.contactEmail + ") für die Fehlerbehebung.";
public static String GLOBAL_NOT_ENOUGH_ARGUMENTS = "Zu wenig Argumente. Syntax: <HIGHLIGHT>%usage%";
public static String GLOBAL_INVALID_ARGUMENT = "Ungültiges Argument. Syntax: <HIGHLIGHT>%usage%";
public static String GLOBAL_NOT_A_PLAYER = "Die Serverkonsole kann diesen Aktion nicht ausführen.";
public static String GLOBAL_PLAYER_NOT_ONLINE = "Der Spieler <HIGHLIGHT>%player% <reset>ist nicht online.";
// Player data-related
public static String PLAYERDATA_LOAD_FAILED = "Deine Spielerdaten konnten nicht geladen werden.\nBitte sende eine E-Mail an " + BuildConfiguration.contactName + " (" + BuildConfiguration.contactEmail + ").\n\n==== Es folgen Debugginginformationen ====\nUUID: %uuid%\nError:\n%error%\nPlayer data loader version: " + ObjHolder.playerDataLoader.playerDataVersion + "\nPSSP version:\n-> Release: " + BuildConfiguration.pluginRelease + "\n-> Type: " + BuildConfiguration.pluginVersionType.name() + "\n-> Typerelease: " + BuildConfiguration.pluginTyperelease;
public static String PLAYERDATA_RELOAD_FAILED = "Deine Spielerdaten konnten nicht neugeladen werden.\nBitte sende eine E-Mail an " + BuildConfiguration.contactName + " (" + BuildConfiguration.contactEmail + ").\n\n==== Es folgen Debugginginformationen ====\nUUID: %uuid%\nError:\n%error%\nPlayer data loader version: " + ObjHolder.playerDataLoader.playerDataVersion + "\nPSSP version:\n-> Release: " + BuildConfiguration.pluginRelease + "\n-> Type: " + BuildConfiguration.pluginVersionType.name() + "\n-> Typerelease: " + BuildConfiguration.pluginTyperelease;
// Events
public static String EVENT_JOIN = "<HIGHLIGHT>%player% <reset>ist dem Server beigetreten.";
public static String EVENT_LEAVE = "<HIGHLIGHT>%player% <reset>hat den Server verlassen.";
// Command: /atc
public static String PLUGINCOMMAND_INFO = "PickShadow Server Plugin » " + BuildConfiguration.pluginRelease + "-" + BuildConfiguration.getTypeAsString(true) + BuildConfiguration.pluginTyperelease + "\n" +
"Entwickelt von " + Arrays.toString(BuildConfiguration.pluginAuthors) + " & Beitragenden.\n" +
"Der Quellcode ist unter der " + BuildConfiguration.pluginLicense + " Lizenz lizensiert und kann <click:open_url:" + BuildConfiguration.pluginSourceCode + ">hier</click> gefunden werden.";
public static String PLUGINCOMMAND_RELOAD_CONFIG = "Die Konfigurationsdatei wird neugeladen, einen Moment bitte...";
public static String PLUGINCOMMAND_RELOAD_CONFIG_SUCCESS = "Die Konfigurationsdatei wurde erfolgreich neugeladen.";
public static String PLUGINCOMMAND_RELOAD_CONFIG_FAIL = "Die Konfigurationsdatei konnte nicht neugeladen werden, siehe bitte die Serverkonsole ein für mehr Informationen.\nWarnung: Starte den Server NICHT neu oder dieser wird nicht wieder starten!";
public static String PLUGINCOMMAND_RELOAD_DATA = "Alle Spielerdaten werden neugeladen, einen Moment bitte...";
public static String PLUGINCOMMAND_RELOAD_DATA_SUCCESS = "Alle Spielerdaten wurden erfolgreich neugeladen.";
public static String PLUGINCOMMAND_RELOAD_DATA_FAIL = "Nicht alle Spielerdaten konnten erfolgreich neugeladen werden, folgende UUIDs sind betroffen:\n%uuids%";
public static String PLUGINCOMMAND_GARBAGECOLLECT = "Starte Garbage Collector, der Server könnte für ein paar Millisekunden einfrieren.";
public static String PLUGINCOMMAND_PLAYERINFO = "Deine Spielerinformationen:\n%playerdata%";
// Command: /sysinfo
public static String SERVERINFO_SYSTEMINFO = """
<bold>Systeminformationen</bold>
Arbeitsspeicher (frei): <HIGHLIGHT>%mem_free%<reset>
Arbeitsspeicher (verwendet): <HIGHLIGHT>%mem_used%<reset>
Arbeitsspeicher (verfügbar): <HIGHLIGHT>%mem_usable%<reset>
Arbeitsspeicher (maximum): <HIGHLIGHT>%mem_max%<reset>
Ticks Pro Sekunde (TPS): <HIGHLIGHT>%tps%<reset>
Millisekunden pro Tick (MSPT): <HIGHLIGHT>%mspt%""";
public static String SERVERINFO_MEMORY = """
<bold>Arbeitsspeichernutzung</bold>
Arbeitsspeicher (frei): <HIGHLIGHT>%mem_free%<reset>
Arbeitsspeicher (verwendet): <HIGHLIGHT>%mem_used%<reset>
Arbeitsspeicher (verfügbar): <HIGHLIGHT>%mem_usable%<reset>
Arbeitsspeicher (maximum): <HIGHLIGHT>%mem_max%<reset>
""";
public static String SERVERINFO_PERF = """
<bold>Performancestatistiken</bold>
Ticks Pro Sekunde (TPS): <HIGHLIGHT>%tps%<reset>
Millisekunden pro Tick (MSPT): <HIGHLIGHT>%mspt%""";
// Command: /home
public static String HOME_TELEPORT = "Du wurdest zu deinem Bett teleportiert.";
public static String HOME_MISSING = "Es wurde kein Respawnpunkt gefunden. Entweder wurde dein Bett oder Respawnanker abgebaut, wurde noch nie platziert oder der Respawnpunkt ist blockiert.";
// Command: /discord
public static String DISCORD_INVITE = "Du kannst den Discord Server über diesen Link beitreten: <HIGHLIGHT>%invite%";
public static String DISCORD_UNAVAILABLE = "Es gibt aktuell noch keinen Discord Server.";
// Command: /troll
public static String TROLL_DEMO = "<HIGHLIGHT>%target%<reset> wird jetzt der Demobildschirm angezeigt.";
public static String TROLL_CREDITS = "<HIGHLIGHT>%target%<reset> werden jetzt die Credits angezeigt.";
public static String TROLL_GUARDIAN = "<HIGHLIGHT>%target%<reset> sieht jetzt einen Elder Guardian.";
public static String TROLL_HACK = "<HIGHLIGHT>%target%<reset> wird jetzt gehackt.";
public static String TROLL_MALWARE = "<HIGHLIGHT>%target%<reset> wird jetzt mit Malware infiziert.";
public static String TROLL_MALWARE_PERCENT = "<red>Extracting virus to disk (%percent%% complete)";
public static String TROLL_MALWARE_INFECTED = "<red>>>> DeStR Virus installed successfully <<<";
public static String TROLL_MALWARE_PASSWORDS = "<red>>>> Sending passwords to C&C Server <<<";
public static String TROLL_MALWARE_BANKING = "<red>>>> Transferring 1000€ to bank account <<<";
public static String TROLL_MALWARE_HACKED = "<red>>>> Hacked machine successfully <<<";
public static String TROLL_CREEPER = "<HIGHLIGHT>%target%<reset> hört jetzt einen Creeper.";
public static String TROLL_HEAVENS = "<HIGHLIGHT>%target%<reset> ist nun im Himmel.";
public static String TROLL_CRASH = "<HIGHLIGHT>%target%<reset>'s Minecraft ist soeben abgestürzt. Oops...";
// Command: /msg
public static String MSG_NO_SELF_MESSAGING = "Seit wann kann man sich denn selber anschreiben?";
public static String MSG_NO_LAST_MESSAGED_PLAYER = "Du scheinst keinen Spieler in der letzten Zeit angeschrieben zu haben.";
public static String MSG_TO = "<gold><bold>%reciever% <reset><gold>« <bold>%sender% <reset><gold>» <reset>%message%";
public static String MSG_FROM = "<gold><bold>%reciever% <reset><gold>» <bold>%sender% <reset><gold>» <reset>%message%";
}

View file

@ -0,0 +1,25 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes;
public class Types {
public enum VersionType { RELEASE, RELEASECANDIDATE, BETA, ALPHA }
public enum LoggerLevel { ERROR, WARN, INFO, VERB, DIAG }
public enum FormatType { NONE, ERROR, NORMAL }
}

View file

@ -0,0 +1,132 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes.logger;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
// Logger base class implementing SOSLS version 1
public abstract class LoggerImpl {
// Configuration
public Types.LoggerLevel configLoggerLevel = Types.LoggerLevel.INFO;
public String configFormat = "[%level% %origin%] %message%";
// Instancing
public LoggerInstanceImpl getInstance(@NotNull Class<?> callerClass) {
return new LoggerInstanceImpl(this, callerClass);
}
// Abstract log functions
protected abstract void log(@NotNull Types.LoggerLevel level, @NotNull Class<?> callerClass, @NotNull String message);
public abstract void logCrash(String crashMessage);
// log() callers
public void diag(@NotNull Class<?> callerClass, @NotNull String message) {
log(Types.LoggerLevel.DIAG, callerClass, message);
}
public void verb(@NotNull Class<?> callerClass, @NotNull String message) {
log(Types.LoggerLevel.VERB, callerClass, message);
}
public void info(@NotNull Class<?> callerClass, @NotNull String message) {
log(Types.LoggerLevel.INFO, callerClass, message);
}
public void warn(@NotNull Class<?> callerClass, @NotNull String message) {
log(Types.LoggerLevel.WARN, callerClass, message);
}
public void error(@NotNull Class<?> callerClass, @NotNull String message) {
log(Types.LoggerLevel.ERROR, callerClass, message);
}
// Crash reporter
public void crash(@NotNull Class<?> callerClass, @NotNull String message) {
crash(callerClass, message, null, false);
}
public void crash(@NotNull Class<?> callerClass, @NotNull String message, boolean softCrash) {
crash(callerClass, message, null, softCrash);
}
public void crash(@NotNull Class<?> callerClass, @NotNull String message, StackTraceElement[] stackTrace) {
crash(callerClass, message, stackTrace, false);
}
public void crash(@NotNull Class<?> callerClass, @NotNull String message, StackTraceElement[] stackTrace, boolean softCrash) {
String crashMessage = "Generating crash report...\n";
crashMessage += "##################\n";
crashMessage += " PSSP crashed\n";
crashMessage += "++++++++++++++++++\n";
crashMessage += "Crash\n";
crashMessage += " -> Caller: " + getCallerInfo(callerClass).get("package.name") + "\n";
crashMessage += " -> Message: " + message + "\n";
crashMessage += "\n";
crashMessage += "PickShadow Server Plugin\n";
crashMessage += " -> Version: " + ObjHolder.main.getPluginMeta().getVersion() + "\n";
crashMessage += " -> API Version: " + ObjHolder.main.getPluginMeta().getAPIVersion() + "\n";
crashMessage += " -> Dependencies (hard): " + ObjHolder.main.getPluginMeta().getPluginDependencies() + "\n";
crashMessage += " -> Dependencies (soft): " + ObjHolder.main.getPluginMeta().getPluginSoftDependencies() + "\n";
crashMessage += " -> Authors: " + ObjHolder.main.getPluginMeta().getAuthors() + "\n";
crashMessage += " -> Contributors: " + ObjHolder.main.getPluginMeta().getContributors() + "\n";
crashMessage += "\n";
crashMessage += "Minecraft\n";
crashMessage += " -> Version: " + Bukkit.getMinecraftVersion() + "\n";
crashMessage += "\n";
crashMessage += "Server software\n";
crashMessage += " -> Name: " + Bukkit.getName() + "\n";
crashMessage += " -> Version: " + Bukkit.getVersion() + "\n";
crashMessage += "\n";
crashMessage += "Stack trace\n";
if (stackTrace == null) {
crashMessage += " -> No stack trace available\n";
} else {
crashMessage += Miscellaneous.convertStacktraceToString(stackTrace) + "\n";
}
crashMessage += "++++++++++++++++++\n";
crashMessage += " PSSP crashed\n";
crashMessage += "##################";
if (softCrash) {
crashMessage += "\nNote: Crash is soft, will not bring down server.";
}
logCrash(crashMessage);
if (!softCrash) Miscellaneous.shutdownPlugin();
}
// Utils
public boolean isLevelAllowed(@NotNull Types.LoggerLevel level) {
return configLoggerLevel.compareTo(level) <= 0;
}
public HashMap<String, String> getCallerInfo(@NotNull Class<?> callerClass) {
HashMap<String, String> callerInfo = new HashMap<>();
callerInfo.put("name", callerClass.getName().replace(callerClass.getPackage() + ".", ""));
callerInfo.put("package", String.valueOf(callerClass.getPackage()));
callerInfo.put("package.name", callerClass.getName());
return callerInfo;
}
public String getFinalFormat(@NotNull Types.LoggerLevel level, @NotNull Class<?> callerClass, @NotNull String message) {
return configFormat
.replace("%plugin%", BuildConfiguration.pluginName)
.replace("%level%", level.name())
.replace("%origin%", getCallerInfo(callerClass).get("package.name"))
.replace("%message%", message);
}
}

View file

@ -0,0 +1,59 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes.logger;
import org.jetbrains.annotations.NotNull;
public class LoggerInstanceImpl {
private final LoggerImpl logger;
private final Class<?> callerClass;
public LoggerInstanceImpl(LoggerImpl newLogger, Class<?> newCallerClass) {
logger = newLogger;
callerClass = newCallerClass;
}
public void diag(@NotNull String message) {
logger.diag(callerClass, message);
}
public void verb(@NotNull String message) {
logger.verb(callerClass, message);
}
public void info(@NotNull String message) {
logger.info(callerClass, message);
}
public void warn(@NotNull String message) {
logger.warn(callerClass, message);
}
public void error(@NotNull String message) {
logger.error(callerClass, message);
}
public void crash(@NotNull String message) {
logger.crash(callerClass, message);
}
public void crash(@NotNull String message, boolean softCrash) {
logger.crash(callerClass, message, softCrash);
}
public void crash(@NotNull String message, StackTraceElement[] stackTrace) {
logger.crash(callerClass, message, stackTrace);
}
public void crash(@NotNull String message, StackTraceElement[] stackTrace, boolean softCrash) {
logger.crash(callerClass, message, stackTrace, softCrash);
}
}

View file

@ -0,0 +1,64 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.classes.logger.implementations;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.classes.logger.LoggerImpl;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
public class ExtendedBukkitLogger extends LoggerImpl {
public ExtendedBukkitLogger() {
super();
}
public boolean tryAlternativeLogging = false;
@Override
protected void log(Types.@NotNull LoggerLevel level, @NotNull Class<?> callerClass, @NotNull String message) throws IllegalArgumentException {
if (isLevelAllowed(level)) {
String finalFormat = getFinalFormat(level, callerClass, message);
if (tryAlternativeLogging) {
Bukkit.getConsoleSender().sendMessage(finalFormat);
} else {
switch (level) {
case DIAG:
case VERB:
case INFO:
ObjHolder.main.getLogger().info(finalFormat);
break;
case WARN:
ObjHolder.main.getLogger().warning(finalFormat);
break;
case ERROR:
ObjHolder.main.getLogger().severe(finalFormat);
break;
default:
throw new IllegalArgumentException("Invalid log level \"" + level + "\"");
}
}
}
}
@Override
public void logCrash(String crashMessage) {
ObjHolder.main.getLogger().severe(crashMessage);
}
}

View file

@ -0,0 +1,54 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.jetbrains.annotations.NotNull;
public class BroadcastCommand extends CommandBase {
public BroadcastCommand() {
super();
commandNames = new String[]{ "broadcast" };
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
StringBuilder message = new StringBuilder();
for (String arg : args) {
if (message.isEmpty()) {
message.append(arg);
} else {
message.append(" ").append(arg);
}
}
Bukkit.broadcast(Miscellaneous.format(String.valueOf(message), Types.FormatType.NONE, true));
return true;
}
public TabCompleter getCompletion() {
return ObjHolder.spellingHelper.getSpellingCompletion();
}
}

View file

@ -0,0 +1,53 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class DiscordCommand extends CommandBase {
public DiscordCommand() {
commandNames = new String[]{ "discord" };
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (Objects.equals(ObjHolder.config.inviteLink, "")) {
sender.sendMessage(Miscellaneous.format(Translation.DISCORD_UNAVAILABLE, Types.FormatType.ERROR));
} else {
sender.sendMessage(Miscellaneous.format(Translation.DISCORD_INVITE.replace("%invite%", ObjHolder.config.inviteLink)));
}
return true;
}
public TabCompleter getCompletion() {
return TabCompletionHelper.createEmptyCompletion();
}
}

View file

@ -0,0 +1,57 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import org.bukkit.Location;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class HomeCommand extends CommandBase {
public HomeCommand() {
commandNames = new String[]{ "home"};
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_A_PLAYER, Types.FormatType.ERROR));
return true;
}
Player player = (Player) sender;
Location coords = player.getRespawnLocation();
if (coords == null) {
player.sendMessage(Miscellaneous.format(Translation.HOME_MISSING, Types.FormatType.ERROR));
} else {
player.sendMessage(Miscellaneous.format(Translation.HOME_TELEPORT));
player.setFallDistance(0f);
player.teleport(coords);
}
return true;
}
public TabCompleter getCompletion() {
return TabCompletionHelper.createEmptyCompletion();
}
}

View file

@ -0,0 +1,167 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.PlayerData;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Objects;
public class MsgCommand extends CommandBase {
public MsgCommand() {
commandNames = new String[]{ "msg", "reply" };
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_A_PLAYER, Types.FormatType.ERROR));
return true;
}
// Define shared variables
Player player = (Player) sender;
Player reciever;
StringBuilder message = new StringBuilder();
switch (label) {
case "msg":
case "whisper":
// Check args size
if (args.length < 2) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_ENOUGH_ARGUMENTS.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
return true;
}
// Get reciever and check if online
reciever = Bukkit.getPlayerExact(args[0]);
if (reciever == null) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_PLAYER_NOT_ONLINE.replace("%player%", args[0])));
return true;
}
// Check if performing self messaging
if (!BuildConfiguration.allowSelfMessaging && player.getUniqueId() == reciever.getUniqueId()) {
player.sendMessage(Miscellaneous.format(Translation.MSG_NO_SELF_MESSAGING, Types.FormatType.ERROR));
return true;
}
// Update player data
ObjHolder.playerDataLoader.getPlayerData(player.getUniqueId()).lastMessagedPlayer = reciever.getUniqueId();
// Build message string from args
boolean messageRecieverSkipped = false;
for (String arg : args) {
if (!messageRecieverSkipped) {
messageRecieverSkipped = true;
continue;
}
if (message.isEmpty()) {
message.append(arg);
} else {
message.append(" ").append(arg);
}
}
// Send message
player.sendMessage(Miscellaneous.format(Translation.MSG_TO.replace("%sender%", player.getName()).replace("%reciever%", reciever.getName()).replace("%message%", message), Types.FormatType.NONE, true));
if (!(!BuildConfiguration.allowSelfMessaging && player.getUniqueId() == reciever.getUniqueId())) reciever.sendMessage(Miscellaneous.format(Translation.MSG_FROM.replace("%sender%", player.getName()).replace("%reciever%", reciever.getName()).replace("%message%", message), Types.FormatType.NONE, true));
break;
case "reply":
case "r":
// Check args size
if (args.length < 1) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_ENOUGH_ARGUMENTS.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
return true;
}
// Get last messaged player
PlayerData playerData = ObjHolder.playerDataLoader.getPlayerData(player.getUniqueId());
if (playerData.lastMessagedPlayer == null) {
player.sendMessage(Miscellaneous.format(Translation.MSG_NO_LAST_MESSAGED_PLAYER, Types.FormatType.ERROR));
return true;
}
reciever = Bukkit.getPlayer(playerData.lastMessagedPlayer);
if (reciever == null) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_EXCEPTION, Types.FormatType.ERROR));
}
if (!Objects.requireNonNull(reciever).isOnline()) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_PLAYER_NOT_ONLINE.replace("%player%", reciever.getName()), Types.FormatType.ERROR));
}
// Check if performing self messaging
if (!BuildConfiguration.allowSelfMessaging && player.getUniqueId() == reciever.getUniqueId()) {
player.sendMessage(Miscellaneous.format(Translation.MSG_NO_SELF_MESSAGING, Types.FormatType.ERROR));
return true;
}
// Build message string from args
for (String arg : args) {
if (message.isEmpty()) {
message.append(arg);
} else {
message.append(" ").append(arg);
}
}
// Send message
sender.sendMessage(Miscellaneous.format(Translation.MSG_TO.replace("%sender%", player.getName()).replace("%reciever%", reciever.getName()).replace("%message%", message), Types.FormatType.NONE, true));
if (!(!BuildConfiguration.allowSelfMessaging && player.getUniqueId() == reciever.getUniqueId())) reciever.sendMessage(Miscellaneous.format(Translation.MSG_FROM.replace("%sender%", player.getName()).replace("%reciever%", reciever.getName()).replace("%message%", message), Types.FormatType.NONE, true));
break;
default:
logger.crash("Invalid command '" + label + "' for " + getClass().getName());
}
return true;
}
public TabCompleter getCompletion() {
return (commandSender, command, name, args) -> {
if (name.equals("msg")) {
// Only apply workaround for /msg command
if (args.length == 0) {
// No tab completion available
return TabCompletionHelper.processEmptyCompletion(args);
} else if (args.length == 1) {
// Currently at argument one, insert player list
ArrayList<String[]> completion = new ArrayList<>();
completion.add(new String[]{"@@@@PLAYERLIST@@@@"});
return TabCompletionHelper.processDynamicCompletion(completion, args);
} else {
// Currently typing a message, insert spelling corrections
return ObjHolder.spellingHelper.getSpellingCompletionRaw(commandSender, name, args, 1);
}
} else {
// No workaround required, pass everything to getSpellingCompletionRaw as normal
return ObjHolder.spellingHelper.getSpellingCompletionRaw(commandSender, name, args, 0);
}
};
}
}

View file

@ -0,0 +1,99 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.classes.Configuration;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.UUID;
public class PluginCommand extends CommandBase {
public PluginCommand() {
commandNames = new String[]{ "pssp" };
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!sender.hasPermission("pickshadow.commands.pssp") || args.length < 1) {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_INFO));
return true;
}
switch (args[0]) {
case "reloadconfig":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_CONFIG));
Configuration newConfig = ObjHolder.configLoader.loadConfig();
if (newConfig == null) {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_CONFIG_FAIL, Types.FormatType.ERROR));
} else {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_CONFIG_SUCCESS));
ObjHolder.config = newConfig;
}
break;
case "reloaddata":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_DATA));
UUID[] failedReloads = ObjHolder.playerDataLoader.reloadPlayerData();
if (failedReloads.length == 0) {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_DATA_SUCCESS));
} else {
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_RELOAD_DATA_FAIL.replace("%uuids%", Arrays.toString(failedReloads)), Types.FormatType.ERROR));
}
break;
case "gc":
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_GARBAGECOLLECT));
System.gc();
break;
case "playerinfo":
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_A_PLAYER, Types.FormatType.ERROR));
break;
}
Player player = (Player) sender;
sender.sendMessage(Miscellaneous.format(Translation.PLUGINCOMMAND_PLAYERINFO.replace("%playerdata%", ObjHolder.playerDataLoader.getPlayerData(player.getUniqueId()).convertToString())));
break;
default:
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_INVALID_ARGUMENT.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
}
return true;
}
public TabCompleter getCompletion() {
return (commandSender, command, name, args) -> {
if (commandSender.hasPermission("atc.commands.pickshadow")) {
ArrayList<String[]> completion = new ArrayList<>();
completion.add(new String[]{ "reloadconfig", "reloaddata", "gc", "playerinfo" });
return TabCompletionHelper.processDynamicCompletion(completion, args);
} else {
return TabCompletionHelper.processEmptyCompletion(args);
}
};
}
}

View file

@ -0,0 +1,121 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Objects;
public class SystemInformationCommand extends CommandBase {
public SystemInformationCommand() {
commandNames = new String[]{ "sysinfo" };
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
switch (label) {
case "sysinfo":
case "info":
case "stats":
if (args.length == 0) {
sender.sendMessage(Objects.requireNonNull(getMessage(0)));
} else {
switch (args[0]) {
case "memory":
sender.sendMessage(Objects.requireNonNull(getMessage(1)));
break;
case "performance":
sender.sendMessage(Objects.requireNonNull(getMessage(2)));
break;
default:
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_INVALID_ARGUMENT.replace("%usage%", command.getUsage())));
break;
}
}
break;
case "ram":
case "mem":
case "memory":
sender.sendMessage(Objects.requireNonNull(getMessage(1)));
break;
case "tps":
case "mspt":
case "perf":
sender.sendMessage(Objects.requireNonNull(getMessage(2)));
break;
default:
logger.crash("Invalid label \"" + label + "\"");
break;
}
return true;
}
private Component getMessage(int messageType) {
String string;
switch (messageType) {
case 0:
string = Translation.SERVERINFO_SYSTEMINFO;
string = string.replace("%mem_free%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().freeMemory(), true)));
string = string.replace("%mem_used%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory(), true)));
string = string.replace("%mem_usable%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().totalMemory(), true)));
string = string.replace("%mem_max%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().maxMemory(), true)));
string = string.replace("%tps%", String.valueOf(Miscellaneous.truncateNumber(Bukkit.getTPS()[0])));
string = string.replace("%mspt%", String.valueOf(Miscellaneous.truncateNumber(Bukkit.getAverageTickTime())));
return Miscellaneous.format(string);
case 1:
string = Translation.SERVERINFO_MEMORY;
string = string.replace("%mem_free%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().freeMemory(), true)));
string = string.replace("%mem_used%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory(), true)));
string = string.replace("%mem_usable%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().totalMemory(), true)));
string = string.replace("%mem_max%", String.valueOf(Miscellaneous.byteToMib(Runtime.getRuntime().maxMemory(), true)));
return Miscellaneous.format(string);
case 2:
string = Translation.SERVERINFO_PERF;
string = string.replace("%tps%", String.valueOf(Miscellaneous.truncateNumber(Bukkit.getTPS()[0])));
string = string.replace("%mspt%", String.valueOf(Miscellaneous.truncateNumber(Bukkit.getAverageTickTime())));
return Miscellaneous.format(string);
default:
logger.crash("Invalid messageType " + messageType);
return null;
}
}
public TabCompleter getCompletion() {
return (commandSender, command, name, args) -> {
if (commandSender.hasPermission("atc.commands.sysinfo")) {
if (name.equals("sysinfo") || name.equals("info") || name.equals("stats")) {
ArrayList<String[]> completion = new ArrayList<>();
completion.add(new String[]{ "mem", "tps", "mspt" });
return TabCompletionHelper.processDynamicCompletion(completion, args);
}
}
return TabCompletionHelper.processEmptyCompletion(args);
};
}
}

View file

@ -0,0 +1,157 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.commands;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.CommandBase;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.utils.Miscellaneous;
import de.pickshadow.plugin.utils.TabCompletionHelper;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.sound.Sound;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.title.Title;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.time.Duration;
import java.util.ArrayList;
public class TrollCommand extends CommandBase {
public TrollCommand() {
commandNames = new String[]{ "troll" };
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_A_PLAYER, Types.FormatType.ERROR));
return true;
}
Player player = (Player) sender;
if (args.length < 2) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_NOT_ENOUGH_ARGUMENTS.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
return true;
}
Player target = Bukkit.getPlayerExact(args[0]);
if (target == null) {
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_PLAYER_NOT_ONLINE.replace("%player%", args[0]), Types.FormatType.ERROR));
return true;
}
switch (args[1]) {
case "demo":
player.sendMessage(Miscellaneous.format(Translation.TROLL_DEMO.replace("%target%", args[0])));
target.showDemoScreen();
break;
case "credits":
player.sendMessage(Miscellaneous.format(Translation.TROLL_CREDITS.replace("%target%", args[0])));
target.showWinScreen();
break;
case "guardian":
player.sendMessage(Miscellaneous.format(Translation.TROLL_GUARDIAN.replace("%target%", args[0])));
target.showElderGuardian();
break;
case "hack":
player.sendMessage(Miscellaneous.format(Translation.TROLL_HACK.replace("%target%", args[0])));
String base = "<dark_red><bold><obfuscated>";
MiniMessage mm = MiniMessage.miniMessage();
target.showTitle(Title.title(mm.deserialize(base + "S=)E8tuv9ZM^P)TJZMVP);ZTP)MZIZM989pv(UZ;."), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
// Keine Ahnung wie ich das besser machen soll
// tl;dr der wartet 20 ticks und zeigt einen neuen Titel an
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "v89tp$MUPT)(98vtp9UASOEUVTP)("), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "t87ZJ(TW/$ZTVohufUS; PVT)()W$%ZV;"), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "tv)(Tuzv948SMZVEVRAOUERKV()REAK=(RK()AV=)§"), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "S=)E8tuv9ZM^P)TJZMVP);ZTP)MZIZM989pv(UZ;."), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "v89tp$MUPT)(98vtp9UASOEUVTP)("), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "t87ZJ(TW/$ZTVohufUS; PVT)()W$%ZV;"), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> {
target.showTitle(Title.title(mm.deserialize(base + "tv)(Tuzv948SMZVEVRAOUERKV()REAK=(RK()AV=)§"), mm.deserialize(""), Title.Times.times(Duration.ofMillis(0L), Duration.ofSeconds(5L), Duration.ofMillis(0L))));
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> target.showTitle(Title.title(mm.deserialize("<red>Zugriff gewährt."), mm.deserialize(""), Title.Times.times(Duration.ofSeconds(1L), Duration.ofSeconds(5L), Duration.ofSeconds(1L)))), 20L);
}, 20L);
}, 20L);
}, 20L);
}, 20L);
}, 20L);
}, 20L);
}, 20L);
break;
case "malware":
player.sendMessage(Miscellaneous.format(Translation.TROLL_MALWARE.replace("%target%", args[0])));
for (int i = 0; i < 127; i++) {
int finalI = i;
if (finalI == 100) {
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> target.sendMessage(Miscellaneous.format(Translation.TROLL_MALWARE_INFECTED, Types.FormatType.NORMAL, true)), 1L + i);
} else if (finalI == 101) {
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> target.sendMessage(Miscellaneous.format(Translation.TROLL_MALWARE_PASSWORDS, Types.FormatType.NORMAL, true)), 1L + i);
} else if (finalI == 121) {
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> target.sendMessage(Miscellaneous.format(Translation.TROLL_MALWARE_BANKING, Types.FormatType.NORMAL, true)), 1L + i);
} else if (finalI == 126) {
Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> target.sendMessage(Miscellaneous.format(Translation.TROLL_MALWARE_HACKED, Types.FormatType.NORMAL, true)), 1L + i);
} else {
if (!(finalI > 101 && finalI < 121 || finalI > 121 && finalI < 126)) Bukkit.getScheduler().runTaskLater(ObjHolder.main, () -> target.sendMessage(Miscellaneous.format(Translation.TROLL_MALWARE_PERCENT.replace("%percent%", String.valueOf(finalI)), Types.FormatType.NORMAL, true)), 1L + i);
}
}
break;
case "creeper":
player.sendMessage(Miscellaneous.format(Translation.TROLL_CREEPER.replace("%target%", args[0])));
target.playSound(Sound.sound(Key.key("entity.creeper.primed"), Sound.Source.MASTER, 1f, 1f));
break;
case "heavens":
player.sendMessage(Miscellaneous.format(Translation.TROLL_HEAVENS.replace("%target%", args[0])));
Location locationHeavens = target.getLocation();
locationHeavens.setY(10000);
target.teleport(locationHeavens);
break;
case "crash":
player.sendMessage(Miscellaneous.format(Translation.TROLL_CRASH.replace("%target%", args[0])));
for (int i = 0; i < 100001; i++) {
target.spawnParticle(Particle.EXPLOSION_HUGE, target.getLocation(), 100000);
}
break;
default:
player.sendMessage(Miscellaneous.format(Translation.GLOBAL_INVALID_ARGUMENT.replace("%usage%", command.getUsage()), Types.FormatType.ERROR));
break;
}
return true;
}
public TabCompleter getCompletion() {
return (commandSender, command, name, args) -> {
if (commandSender.hasPermission("atc.commands.troll")) {
ArrayList<String[]> completion = new ArrayList<>();
completion.add(new String[]{ "@@@@PLAYERLIST@@@@" });
completion.add(new String[]{ "demo", "credits", "guardian", "hack", "malware", "creeper", "heavens", "crash" });
return TabCompletionHelper.processDynamicCompletion(completion, args);
} else {
return TabCompletionHelper.processEmptyCompletion(args);
}
};
}
}

View file

@ -0,0 +1,42 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.listeners;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
public class ChatMessageOverrideListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onChat(@NotNull AsyncChatEvent event) {
String messageBuilder = "<gold><bold>%player%<reset> <gold>» <white>";
messageBuilder = messageBuilder.replace("%player%", event.getPlayer().getName());
messageBuilder = messageBuilder.replace("%player_health%", String.valueOf(event.getPlayer().getHealth()));
messageBuilder = messageBuilder.replace("%player_world%", event.getPlayer().getWorld().getName());
messageBuilder = messageBuilder.replace("%player_brand%", String.valueOf(event.getPlayer().getClientBrandName()));
messageBuilder = messageBuilder.replace("%player_ping%", String.valueOf(event.getPlayer().getPing()));
Bukkit.broadcast(MiniMessage.miniMessage().deserialize(messageBuilder).append(event.originalMessage()));
event.setCancelled(true);
}
}

View file

@ -0,0 +1,53 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.listeners;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.utils.Miscellaneous;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class JoinLeaveMessagesListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onJoin(@NotNull PlayerJoinEvent event) {
Bukkit.broadcast(Miscellaneous.format(Translation.EVENT_JOIN.replace("%player%", event.getPlayer().getName())));
String dataLoadError = ObjHolder.playerDataLoader.loadPlayerData(event.getPlayer().getUniqueId());
if (!Objects.equals(dataLoadError, "")) {
event.getPlayer().kick(Miscellaneous.format(Translation.PLAYERDATA_LOAD_FAILED.replace("%uuid%", event.getPlayer().getUniqueId().toString()).replace("%error%", dataLoadError)));
}
ObjHolder.playerDataLoader.getPlayerData(event.getPlayer().getUniqueId()).lastPlayed = System.currentTimeMillis() / 1000L;
event.joinMessage(Component.empty());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onQuit(@NotNull PlayerQuitEvent event) {
Bukkit.broadcast(Miscellaneous.format(Translation.EVENT_LEAVE.replace("%player%", event.getPlayer().getName())));
ObjHolder.playerDataLoader.unloadPlayerData(event.getPlayer().getUniqueId());
event.quitMessage(Component.empty());
}
}

View file

@ -0,0 +1,146 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.loaders;
import de.pickshadow.plugin.Main;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Configuration;
import de.pickshadow.plugin.classes.logger.LoggerImpl;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.utils.FileOperations;
import org.jetbrains.annotations.NotNull;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.composer.ComposerException;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.constructor.ConstructorException;
import org.yaml.snakeyaml.parser.ParserException;
import org.yaml.snakeyaml.scanner.ScannerException;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
import java.util.Scanner;
public class ConfigLoader {
// Objects
private final LoggerInstanceImpl logger;
private final File configFile;
// Non-static
public final int configVersion = 0;
// Constructor
public ConfigLoader() {
logger = ObjHolder.logger.getInstance(getClass());
configFile = new File(ObjHolder.main.getDataFolder() + File.separator + "config.yml");
}
// Loads and returns a new configuration
public Configuration loadConfig() {
Configuration config;
logger.verb("Loading configuration file");
// Check existance of configuration directory
if (!ObjHolder.main.getDataFolder().exists()) {
logger.verb("Creating missing configuration directory");
if (!ObjHolder.main.getDataFolder().mkdir()) {
logger.crash("Could not create configuration directory: mkdir() returned false", true);
return null;
}
}
if (!configFile.exists()) {
logger.verb("Generating new configuration file");
if (!generateConfiguration()) {
return null;
}
}
// Read configuration file
logger.diag("Reading configuration file");
FileOperations operations = new FileOperations(configFile);
String configRaw;
try {
configRaw = operations.readUtf8();
} catch (IOException e) {
logger.crash("Reading configuration file failed", e.getStackTrace(), true);
return null;
}
// Mapping file to Configuration
logger.diag("Mapping file to Configuration");
LoaderOptions options = new LoaderOptions();
options.setTagInspector(tag -> tag.getClassName().equals(Configuration.class.getName()));
Yaml yaml = new Yaml(new Constructor(Configuration.class, options));
try {
config = yaml.load(configRaw);
} catch (ParserException | ScannerException | ComposerException | ConstructorException e) {
logger.crash("Unable to parse configuration file: " + e.getProblem(), e.getStackTrace(), true);
return null;
}
// Check config version
if (config.version == -1) {
logger.crash("Configuration file is invalid, cannot continue.", true);
} else if (config.version < configVersion) {
logger.crash("Configuration file is too old, cannot continue.", true);
} else if (config.version > configVersion) {
logger.crash("Configuration file is too new, cannot continue.", true);
} else {
return config;
}
return null;
}
// Generates a new configuration file
public boolean generateConfiguration() {
FileOperations operations = new FileOperations(configFile);
// Check if exists
try {
if (operations.exists()) {
logger.crash("Could not generate configuration file: A configuration file already exists", true);
return false;
}
} catch (IOException e) {
logger.crash("Could not generate player data file: Got IOException for exists(): " + e.getMessage(), true);
return false;
}
// Create file
try {
operations.createFile();
} catch (IOException e) {
logger.crash("Could not generate configuration file: Got IOException for createFile(): " + e.getMessage(), true);
return false;
}
// Write default configuration
Scanner scanner = new Scanner(Objects.requireNonNull(getClass().getResourceAsStream(File.separator + "config.yml"))).useDelimiter("\\A");
String defaultConfiguration = scanner.hasNext() ? scanner.next() : "";
try {
operations.writeUtf8(defaultConfiguration);
} catch (IOException e) {
logger.crash("Could not generate configuration file: Got IOException for writeUtf8(): " + e.getMessage(), true);
return false;
}
return true;
}
}

View file

@ -0,0 +1,239 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.loaders;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.PlayerData;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.classes.Types;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import de.pickshadow.plugin.utils.FileOperations;
import de.pickshadow.plugin.utils.Miscellaneous;
import org.bukkit.Bukkit;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.composer.ComposerException;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.constructor.ConstructorException;
import org.yaml.snakeyaml.parser.ParserException;
import org.yaml.snakeyaml.scanner.ScannerException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Objects;
import java.util.UUID;
public class PlayerDataLoader {
// Objects
private final LoggerInstanceImpl logger;
// Non-static
private final String storageLocation;
public final int playerDataVersion = 0;
private HashMap<UUID, PlayerData> loadedPlayerData = new HashMap<>();
// Constructor
public PlayerDataLoader() {
logger = ObjHolder.logger.getInstance(getClass());
storageLocation = ObjHolder.main.getDataFolder() + File.separator + "playerdata" + File.separator;
}
// Loads player data
public String loadPlayerData(UUID uuid) {
PlayerData playerData;
logger.verb("Loading player data for UUID '" + uuid.toString() + "'");
// Check existance of player data directory
if (!new File(storageLocation).exists()) {
logger.verb("Creating missing player data directory");
if (!new File(storageLocation).mkdir()) {
logger.crash("Could not create player data directory: mkdir() returned false", true);
return "Could not create player data directory: mkdir() returned false";
}
}
File playerDataFile = new File(storageLocation + uuid + ".yml");
if (!playerDataFile.exists()) {
logger.verb("Generating new player data file");
String generationError = generatePlayerData(uuid);
if (!Objects.equals(generationError, "")) {
return generationError;
}
}
// Read configuration file
logger.diag("Reading player data file");
FileOperations operations = new FileOperations(playerDataFile);
String playerDataRaw;
try {
playerDataRaw = operations.readUtf8();
} catch (IOException e) {
logger.crash("Reading player data file failed for UUID '" + uuid + "'", e.getStackTrace(), true);
return "Reading player data file failed";
}
// Mapping file to PlayerData
logger.diag("Mapping file to PlayerData");
LoaderOptions options = new LoaderOptions();
options.setTagInspector(tag -> tag.getClassName().equals(PlayerData.class.getName()));
Yaml yaml = new Yaml(new Constructor(PlayerData.class, options));
try {
playerData = yaml.load(playerDataRaw);
} catch (ParserException | ScannerException | ComposerException | ConstructorException e) {
logger.crash("Unable to parse player data file for UUID '" + uuid + "': " + e.getProblem(), e.getStackTrace(), true);
return "Unable to parse player data file: " + e.getProblem();
}
// Check player data version
if (playerData.version == -1) {
logger.crash("Player data file is invalid, cannot continue.", true);
return "Player data file is invalid.";
} else if (playerData.version < playerDataVersion) {
logger.crash("Player data file for UUID '" + uuid + "' is too old, cannot continue.", true);
return "Player data file is too old.";
} else if (playerData.version > playerDataVersion) {
logger.crash("Player data file for UUID '" + uuid + "' is too new, cannot continue.", true);
return "Player data file is too new.";
} else {
loadedPlayerData.put(uuid, playerData);
return "";
}
}
// Generates a new configuration file
public String generatePlayerData(UUID uuid) {
FileOperations operations = new FileOperations(new File(storageLocation + uuid + ".yml"));
// Check if exists
try {
if (operations.exists()) {
logger.crash("Could not generate player data file for UUID '" + uuid + "': A player data file already exists", true);
return "Could not generate player data file: A player data file already exists";
}
} catch (IOException e) {
logger.crash("Could not generate player data file for UUID '" + uuid + "': Got IOException for exists(): " + e.getMessage(), true);
return "Could not generate player data file: Got IOException: " + e.getMessage();
}
// Create file
try {
operations.createFile();
} catch (IOException e) {
logger.crash("Could not generate player data file for UUID '" + uuid + "': Got IOException from creatFile(): " + e.getMessage(), true);
return "Could not generate player data file: createFile() was unsuccessful";
}
// Create new PlayerData object
PlayerData playerData = new PlayerData(uuid);
playerData.firstPlayed = System.currentTimeMillis() / 1000L;
playerData.version = playerDataVersion;
// Write default configuration
try {
operations.writeUtf8(playerData.convertToConfig());
} catch (IOException e) {
logger.crash("Could not generate player data file for UUID '" + uuid + "': Got IOException from writeUtf8(): " + e.getMessage(), true);
return "Could not generate player data file: writeUtf8() was unsuccessful";
}
return "";
}
// Unloads loaded player data
public void unloadPlayerData(UUID uuid) {
if (isPlayerDataLoaded(uuid)) {
savePlayerData(uuid);
loadedPlayerData.remove(uuid);
}
}
// Saves loaded player data
public void savePlayerData(UUID uuid) {
FileOperations operations = new FileOperations(new File(storageLocation + uuid + ".yml"));
// Check if loaded
if (!isPlayerDataLoaded(uuid)) {
logger.error("Could not save player data for UUID '" + uuid + "': Not loaded in memory");
}
// Check if exists
try {
if (!operations.exists()) {
try {
if (!operations.createFile()) logger.crash("Could not save player data for UUID '" + uuid + "': createFile() failed");
} catch (IOException e) {
logger.crash("Could not save player data file for UUID '" + uuid + "': Got IOException for createFile(): " + e.getMessage(), true);
}
}
} catch (IOException e) {
logger.crash("Could not save player data file for UUID '" + uuid + "': Got IOException for exists(): " + e.getMessage(), true);
}
// Write contents
try {
operations.writeUtf8(getPlayerData(uuid).convertToConfig());
} catch (IOException e) {
logger.crash("Could not save player data for UUID '" + uuid + "': Got IOException for writeUtf8(): " + e.getMessage());
}
}
// Reloads all loaded player data
// Returns the failed uuids
public UUID[] reloadPlayerData() {
return reloadPlayerData(true);
}
public UUID[] reloadPlayerData(boolean kickFailedUUIDs) {
logger.verb("Reloading player data");
ArrayList<UUID> failedReloads = new ArrayList<>();
for (UUID uuid : getLoadedUUIDs()) {
logger.diag("Reloading player data for UUID '" + uuid + "'");
unloadPlayerData(uuid);
String error = loadPlayerData(uuid);
if (!error.isEmpty()) {
logger.error("Could not reload player data for UUID '" + uuid + "': " + error);
failedReloads.add(uuid);
if (kickFailedUUIDs) {
try {
Objects.requireNonNull(Bukkit.getPlayer(uuid)).kick(Miscellaneous.format(Translation.PLAYERDATA_RELOAD_FAILED, Types.FormatType.NONE));
} catch (NullPointerException e) {
logger.crash("Could not kick player with UUID '" + uuid + "' (data reload failed): " + e.getMessage(), e.getStackTrace());
}
}
}
}
return failedReloads.toArray(new UUID[0]);
}
// Returns loaded player data
public PlayerData getPlayerData(UUID uuid) {
return loadedPlayerData.getOrDefault(uuid, null);
}
// Return if player is loaded
public boolean isPlayerDataLoaded(UUID uuid) {
return loadedPlayerData.containsKey(uuid);
}
// Return all loaded UUIDs
public UUID[] getLoadedUUIDs() {
return loadedPlayerData.keySet().toArray(new UUID[0]);
}
}

View file

@ -0,0 +1,101 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.utils;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
public class FileOperations {
public FileOperations(@NotNull File newFile) {
file = newFile;
path = file.toPath();
}
private final File file;
private final Path path;
// Reading
public byte[] readBytes() throws IOException {
return Files.readAllBytes(path);
}
public String readUtf8() throws IOException {
StringBuilder string = new StringBuilder();
List<String> lines = Files.readAllLines(path, StandardCharsets.UTF_8);
for (String line : lines) {
string.append(line).append("\n");
}
return string.toString();
}
// Writing
public void writeBytes(@NotNull byte[] data) throws IOException {
Files.write(path, data);
}
public void writeUtf8(@NotNull String data) throws IOException {
writeBytes(data.getBytes(StandardCharsets.UTF_8));
}
// File operations
public boolean createFile() throws IOException {
return file.createNewFile();
}
public boolean deleteFile() {
return file.delete();
}
public boolean exists() throws IOException {
return file.exists();
}
// Permissions
public boolean canRead() {
return file.canRead();
}
public boolean canWrite() {
return file.canWrite();
}
public boolean canExecute() {
return file.canExecute();
}
public String getUnixUserPermissions() {
String permissions;
if (canRead()) {
permissions = "r";
} else {
permissions = "-";
}
if (canWrite()) {
permissions = permissions + "w";
} else {
permissions = permissions + "-";
}
if (canExecute()) {
permissions = permissions + "x";
} else {
permissions = permissions + "-";
}
return permissions;
}
}

View file

@ -0,0 +1,140 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.utils;
import de.pickshadow.plugin.classes.Translation;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.Types;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull;
import java.text.DecimalFormat;
import java.util.Objects;
public class Miscellaneous {
// Converts StackTraceElement[] to a String
public static String convertStacktraceToString(@NotNull StackTraceElement[] stacktrace) {
StringBuilder stringtrace = new StringBuilder();
for (int i = 1; i < stacktrace.length; i++) {
stringtrace.append("\tat ").append(stacktrace[i]).append("\n");
}
return stringtrace.toString();
}
// Disable plugin
public static void shutdownPlugin() {
try {
Bukkit.getPluginManager().disablePlugin(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("PickShadow")));
} catch (NullPointerException e) {
Bukkit.shutdown();
}
}
// Data type conversion
/// Bytes <-> Mebibytes
public static double byteToMib(int bytes, boolean flatten) {
if (flatten) {
return truncateNumber((double) bytes / 1048576);
} else {
return (float) bytes / 1048576;
}
}
public static double byteToMib(double bytes, boolean flatten) {
if (flatten) {
return truncateNumber(bytes / 1048576);
} else {
return (float) bytes / 1048576;
}
}
public static double mibToByte(double mib, boolean flatten) {
if (flatten) {
return truncateNumber(mib * 1048576);
} else {
return mib * 1048576;
}
}
/// Mebibytes <-> Gebibytes
public static double mibToGib(double mib, boolean flatten) {
if (flatten) {
return truncateNumber(mib / 1024);
} else {
return mib / (float) 1024;
}
}
public static double gibToMib(double gib, boolean flatten) {
if (flatten) {
return truncateNumber(gib * 1024);
} else {
return gib * 1024;
}
}
// Truncate numbers
/// Double
public static double truncateNumber(double number, int keep) {
return Double.parseDouble(new DecimalFormat("#," + "#".repeat(keep)).format(number));
}
public static double truncateNumber(double number) {
return truncateNumber(number, 2);
}
/// Float
public static float truncateNumber(float number, int keep) {
return Float.parseFloat(new DecimalFormat("#," + "#".repeat(keep)).format(number));
}
public static float truncateNumber(float number) {
return truncateNumber(number, 2);
}
public static Component format(@NotNull String message, @NotNull Types.FormatType type) {
return format(message, type, false);
}
public static Component format(@NotNull String message, @NotNull Types.FormatType type, boolean disablePrefix) {
String prefix = "<reset>";
if (ObjHolder.config.enablePrefix && !disablePrefix) {
prefix = "<PREFIX>";
}
String formatted = prefix + message;
// Handle newlines
formatted = formatted.replace("\n", "\n" + "<reset>" + prefix);
// Format special effects
formatted = formatted.replace("<PREFIX>", Translation.GLOBAL_PREFIX);
formatted = formatted.replace("<BRANDING>", "<gradient:#FFFFFF:#A8A8A8>");
formatted = formatted.replace("<BRANDING_END>", "</gradient><reset>");
formatted = formatted.replace("<HIGHLIGHT>", "<aqua><bold>");
// Update color and reset tag
switch (type) {
case NORMAL:
formatted = formatted.replace("<reset>", "<reset><gold>");
case ERROR:
formatted = formatted.replace("<reset>", "<reset><red>");
}
// Jagen wir das Ding mal durch Kyori's Adventure // Run it through Kyori's Adventure
MiniMessage mm = MiniMessage.miniMessage();
return mm.deserialize(formatted);
}
public static Component format(@NotNull String translation) {
return format(translation, Types.FormatType.NORMAL);
}
}

View file

@ -0,0 +1,193 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.utils;
import com.nikialeksey.hunspell.Hunspell;
import de.pickshadow.plugin.BuildConfiguration;
import de.pickshadow.plugin.ObjHolder;
import de.pickshadow.plugin.classes.logger.LoggerInstanceImpl;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
public class SpellingHelper {
// Objects
private final LoggerInstanceImpl logger;
private Hunspell speller = null;
// Non-static
public String activeLanguage = "none";
private final String spellingFilesPathExternal;
// Static
public final static String[] languages = new String[]{ "en_US", "de_DE" };
private final static String[] types = new String[]{ "dic", "aff" };
private final static String spellingFilesPathInternal = File.separator + "spelling" + File.separator;
private final static String[] spellingBlacklist = new String[]{ "<", ">" };
private final static int spellingMaxLength = 16;
// Constructor
public SpellingHelper() {
logger = ObjHolder.logger.getInstance(getClass());
spellingFilesPathExternal = ObjHolder.main.getDataFolder() + File.separator + "spelling" + File.separator;
}
// Extractor
public String extractFiles() {
logger.verb("Extracting spelling files");
File spellingDirectory = new File(ObjHolder.main.getDataFolder() + File.separator + "spelling");
if (!spellingDirectory.exists()) {
logger.diag("Creating missing 'spelling' directory");
if (!spellingDirectory.mkdirs()) {
logger.error("Couldn't spelling files: Could not create 'spelling' directory");
return "Couldn't spelling files: Could not create 'spelling' directory";
}
}
for (String lang : languages) {
for (String type : types) {
logger.diag("Extracting spelling/" + lang + "." + type);
FileOperations op = new FileOperations(new File(spellingFilesPathExternal + lang + "." + type));
try {
if (op.exists()) continue;
op.createFile();
op.writeBytes(Objects.requireNonNull(getClass().getResourceAsStream(spellingFilesPathInternal + lang + "." + type)).readAllBytes());
} catch (IOException e) {
logger.crash("Couldn't extract spelling files: Failed extracting language '" + lang + "': Got IOException: " + e.getMessage(), e.getStackTrace());
return "Couldn't extract spelling files: Failed extracting language '" + lang + "': Got IOException: " + e.getMessage();
}
}
}
return "";
}
// Returns the active spelling language
public String getActiveLanguage() {
return activeLanguage;
}
// Updates the active spelling language
public boolean setActiveLanguage(String newLang) {
boolean isValid = false;
// Determine if newLang is valid
for (String lang : languages) {
if (Objects.equals(lang, newLang)) {
isValid = true;
break;
}
}
if (isValid) {
if (speller != null) speller.close();
speller = new Hunspell(spellingFilesPathExternal + newLang + ".dic", spellingFilesPathExternal + newLang + ".aff");
activeLanguage = newLang;
} else if (newLang == null || Objects.equals(newLang, "none")) {
isValid = true;
if (speller != null) speller.close();
speller = null;
}
// Return success status
return isValid;
}
// Provide spelling for tab completion
public String[] getSpellingCorrections(@NotNull String word) {
if (Objects.equals(activeLanguage, "none")) {
// No language is active
if (BuildConfiguration.provideVerboseLoggingForSpellingHelpers) logger.diag("No language is active, can't provide corrections for '" + word + "'");
return new String[]{ word };
}
// Check word requirements
// -> Check word length
if (word.length() > spellingMaxLength) {
// Word is longer than spellingMaxLength allows
if (BuildConfiguration.provideVerboseLoggingForSpellingHelpers) logger.diag("Word '" + word + "' is longer than " + spellingMaxLength + " characters");
return new String[]{ word };
}
// -> Check blacklist
for (String blacklist : spellingBlacklist) {
if (word.contains(blacklist)) {
// Word contains something on the blacklist
if (BuildConfiguration.provideVerboseLoggingForSpellingHelpers) logger.diag("Word '" + word + "' contains a blacklisted keyword");
return new String[]{ word };
}
}
// Check spelling
if (speller.spell(word)) {
// Word is spelled correctly
if (BuildConfiguration.provideVerboseLoggingForSpellingHelpers) logger.diag("Word '" + word + "' is spelled correctly");
return new String[]{ word };
} else {
// Word is misspelled, return list of suggestions
if (BuildConfiguration.provideVerboseLoggingForSpellingHelpers) logger.diag("Word '" + word + "' is misspelled, providing corrections: " + speller.suggest(word).toString());
return speller.suggest(word).toArray(new String[0]);
}
}
public TabCompleter getSpellingCompletion() {
return getSpellingCompletion(0);
}
public TabCompleter getSpellingCompletion(int ignoreArguments) {
return (commandSender, command, name, args) -> getSpellingCompletionRaw(commandSender, name, args, ignoreArguments);
}
public ArrayList<String> getSpellingCompletionRaw(CommandSender commandSender, String name, String[] args, int ignoreArguments) {
if (ignoreArguments < 0) {
logger.crash("ignoreArguments cannot be negative (set to " + ignoreArguments + ")");
}
int ignoredArguments = 0;
ArrayList<String[]> completion = new ArrayList<>();
// Populate with arguments
for (int i = 0; i < args.length-1; i++) {
if (ignoredArguments == ignoreArguments) {
completion.add(new String[0]);
} else {
ignoredArguments++;
}
}
// Add result from getSpellingCorrections
completion.add(getSpellingCorrections(args[args.length-1]));
if (BuildConfiguration.provideVerboseLoggingForSpellingCompletions) logger.diag("Available spelling corrections for /" + name + " executed by " + commandSender.getName() + ": " + Arrays.toString(completion.get(completion.size() - 1)));
// Check if args needs to be updated
if (ignoreArguments != 0) {
ArrayList<String> newArgs = new ArrayList<>();
ignoredArguments = 0;
for (String arg : args) {
if (ignoredArguments == ignoreArguments) newArgs.add(arg);
else ignoredArguments++;
}
args = newArgs.toArray(new String[0]);
}
return TabCompletionHelper.processDynamicCompletion(completion, args);
}
}

View file

@ -0,0 +1,83 @@
/*
PICKSHADOW SERVER PLUGIN SOURCE FILE
Copyright (c) 2024 JeremyStarTM & Contributors
Licensed under the GNU Affero General Public License v3
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.pickshadow.plugin.utils;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TabCompletionHelper {
// Creates a TabCompleter from a list of arguments
public static TabCompleter createStaticCompletion(@NotNull ArrayList<String[]> completion) {
return (commandSender, command, name, args) -> processDynamicCompletion(completion, args);
}
// Creates a ArrayList<String> from a list of arguments
public static ArrayList<String> processDynamicCompletion(@NotNull ArrayList<String[]> completion, @NotNull String[] args) {
// Create new ArrayList<String>
ArrayList<String> completionOutput = new ArrayList<>();
// Reduces new allocations when comparing later in execution
String emptyStringArray = "[@@@@PLAYERLIST@@@@]";
// Get all online player names
ArrayList<String> playersTemporary = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
playersTemporary.add(player.getName());
}
String[] players = playersTemporary.toArray(new String[0]);
// Replace all empty String[] with online players
for (int i = 0; i < completion.size(); i++) {
if (Arrays.toString(completion.get(i)).equals(emptyStringArray)) {
completion.set(i, players);
}
}
// Check if is out of bounce
if (args.length > completion.size()) {
// Is out of bounce, return empty completion
StringUtil.copyPartialMatches(args[args.length-1], List.of(new String[]{ " " }), completionOutput);
} else {
// Is in bounce, return completion
StringUtil.copyPartialMatches(args[args.length-1], List.of(completion.get(args.length-1)), completionOutput);
}
// Return processed completion
return completionOutput;
}
// Creates an empty TabCompleter
public static TabCompleter createEmptyCompletion() {
return (commandSender, command, name, args) -> StringUtil.copyPartialMatches(args[args.length-1], List.of(new String[]{ "" }), new ArrayList<>());
}
// Creates an empty ArrayList<String>
public static ArrayList<String> processEmptyCompletion(@NotNull String[] args) {
return StringUtil.copyPartialMatches(args[args.length-1], List.of(new String[]{ "" }), new ArrayList<>());
}
}

View file

@ -0,0 +1,12 @@
##############################
## PickShadow Server Plugin ##
## Configuration file ##
##############################
### DO NOT REMOVE THESE LINES OR THIS PLUGIN WILL BREAK ###
!!de.pickshadow.plugin.classes.Configuration
version: 0
### DO NOT REMOVE THESE LINES OR THIS PLUGIN WILL BREAK ###
enablePrefix: true
inviteLink: ""
defaultSpellingLanguage: "de_DE"

View file

@ -0,0 +1,99 @@
# PICKSHADOW SERVER PLUGIN SOURCE FILE
# Copyright (c) 2024 JeremyStarTM & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
name: PSSP
version: '${version}'
main: de.pickshadow.plugin.Main
api-version: '1.20'
prefix: PSSP
depend: [ FreedomChat ]
authors: [ JeremyStarTM ]
commands:
discord:
description: Gibt den Link zum PickShadow Discord Server aus.
usage: /discord
aliases: [ dc ]
permission: pickshadow.commands.discord
home:
description: Teleportiert dich zu deinem Respawnpunkt.
usage: /home
aliases: [ bed, tph, tphome ]
permission: pickshadow.commands.home
pssp:
description: Verwaltet das PickShadow Server Plugin.
usage: /pssp <reloadconfig|reloaddata|gc|playerinfo>
aliases: [ "pickshadow" ]
sysinfo:
description: Zeigt Informationen zum Server an.
usage: /sysinfo [memory, performance]
aliases: [ info, stats, tps, mspt, perf, mem, ram ]
permission: pickshadow.commands.sysinfo
troll:
description: Erlaubt es andere Spieler zu trollen.
usage: /troll <Spieler> <demo|credits|guardian|hack|malware|creeper|heavens|crash>
aliases: [ t ]
permission: pickshadow.commands.troll
broadcast:
description: Sendet eine Nachricht an alle Spieler.
usage: /broadcast <Nachricht>
aliases: [ bc, say, announce ]
permission: pickshadow.commands.broadcast
msg:
description: Sendet eine Nachricht an einen anderen Spieler.
usage: /msg <Spieler> <Nachricht>
aliases: [ "whisper", "w" ]
permission: pickshadow.commands.msg
reply:
description: Sendet eine Nachricht an den zuletzt kontaktierten Spieler.
usage: /reply <Nachricht>
aliases: [ "r" ]
permission: pickshadow.commands.reply
permissions:
pickshadow.*:
default: op
description: Erlaubt Zugriff auf alles was PSSP zu bieten hat.
children:
- pickshadow.commands.*
pickshadow.commands.*:
default: op
description: Erlaubt Zugriff auf alle Befehle.
children:
- pickshadow.commands.discord
- pickshadow.commands.home
- pickshadow.commands.pssp
- pickshadow.commands.sysinfo
- pickshadow.commands.troll
- pickshadow.commands.broadcast
- pickshadow.commands.msg
- pickshadow.commands.reply
pickshadow.commands.discord:
default: not op
pickshadow.commands.home:
default: not op
pickshadow.commands.pssp:
default: op
pickshadow.commands.sysinfo:
default: op
pickshadow.commands.troll:
default: op
pickshadow.commands.broadcast:
default: op
pickshadow.commands.msg:
default: not op
pickshadow.commands.reply:
default: not op

View file

@ -0,0 +1,729 @@
# this is the affix file of the de_DE Hunspell dictionary
# derived from the igerman98 dictionary
#
# Version: 20161207
#
# Copyright (C) 1998-2015 Bjoern Jacke <bjoern@j3e.de>
#
# License: GPLv2, GPLv3
# There should be a copy of both of this licenses included
# with every distribution of this dictionary. Modified
# versions using the GPL may only include the GPL
SET UTF-8
TRY esijanrtolcdugmphbyfvkwqxzäüößáéêàâñESIJANRTOLCDUGMPHBYFVKWQXZÄÜÖÉ-.
PFX U Y 1
PFX U 0 un .
PFX V Y 1
PFX V 0 ver .
SFX F Y 35
SFX F 0 nen in
SFX F e in e
SFX F e innen e
SFX F 0 in [^i]n
SFX F 0 innen [^i]n
SFX F 0 in [^enr]
SFX F 0 innen [^enr]
SFX F 0 in [^e]r
SFX F 0 innen [^e]r
SFX F 0 in [^r]er
SFX F 0 innen [^r]er
SFX F 0 in [^e]rer
SFX F 0 innen [^e]rer
SFX F 0 in ierer
SFX F 0 innen ierer
SFX F er in [^i]erer
SFX F er innen [^i]erer
SFX F in In in
SFX F in Innen in
SFX F e In e
SFX F e Innen e
SFX F 0 In [^i]n
SFX F 0 Innen [^i]n
SFX F 0 In [^en]
SFX F 0 Innen [^en]
SFX F 0 In [^e]r
SFX F 0 Innen [^e]r
SFX F 0 In [^r]er
SFX F 0 Innen [^r]er
SFX F 0 In [^e]rer
SFX F 0 Innen [^e]rer
SFX F 0 In ierer
SFX F 0 Innen ierer
SFX F er In [^i]erer
SFX F er Innen [^i]erer
#SFX F en innen en
#SFX F en Innen en
SFX L N 12
SFX L 0 tlich n
SFX L 0 tliche n
SFX L 0 tlicher n
SFX L 0 tliches n
SFX L 0 tlichem n
SFX L 0 tlichen n
SFX L 0 lich [^n]
SFX L 0 liche [^n]
SFX L 0 licher [^n]
SFX L 0 liches [^n]
SFX L 0 lichem [^n]
SFX L 0 lichen [^n]
#SFX H N 2
#SFX H 0 heit .
#SFX H 0 heiten .
#SFX K N 2
#SFX K 0 keit .
#SFX K 0 keiten .
SFX M N 10
SFX M 0 chen [^se]
SFX M 0 chens [^se]
SFX M ass ässchen ass
SFX M ass ässchens ass
SFX M oss össchen oss
SFX M oss össchens oss
SFX M uss üsschen uss
SFX M uss üsschens uss
SFX M e chen e
SFX M e chens e
SFX A Y 46
SFX A 0 r e
SFX A 0 n e
SFX A 0 m e
SFX A 0 s e
SFX A 0 e [^elr]
SFX A 0 er [^elr]
SFX A 0 en [^elr]
SFX A 0 em [^elr]
SFX A 0 es [^elr]
SFX A 0 e [^e][rl]
SFX A 0 er [^e][rl]
SFX A 0 en [^e][rl]
SFX A 0 em [^e][rl]
SFX A 0 es [^e][rl]
SFX A 0 e [^u]er
SFX A 0 er [^u]er
SFX A 0 en [^u]er
SFX A 0 em [^u]er
SFX A 0 es [^u]er
SFX A er re uer
SFX A er rer uer
SFX A er ren uer
SFX A er rem uer
SFX A er res uer
SFX A 0 e [eil]el
SFX A 0 er [eil]el
SFX A 0 en [eil]el
SFX A 0 em [eil]el
SFX A 0 es [eil]el
SFX A el le [^eil]el
SFX A el ler [^eil]el
SFX A el len [^eil]el
SFX A el lem [^eil]el
SFX A el les [^eil]el
SFX A lig elig [^aeiouhlräüö]lig
SFX A lig elige [^aeiouhlräüö]lig
SFX A lig eliger [^aeiouhlräüö]lig
SFX A lig eligen [^aeiouhlräüö]lig
SFX A lig eligem [^aeiouhlräüö]lig
SFX A lig eliges [^aeiouhlräüö]lig
SFX A erig rig [^hi]erig
SFX A erig rige [^hi]erig
SFX A erig riger [^hi]erig
SFX A erig rigen [^hi]erig
SFX A erig rigem [^hi]erig
SFX A erig riges [^hi]erig
SFX C Y 100
SFX C 0 ere [^elr]
SFX C 0 erer [^elr]
SFX C 0 eren [^elr]
SFX C 0 erem [^elr]
SFX C 0 eres [^elr]
SFX C 0 re e
SFX C 0 rer e
SFX C 0 ren e
SFX C 0 rem e
SFX C 0 res e
SFX C 0 ere [^e][lr]
SFX C 0 erer [^e][lr]
SFX C 0 eren [^e][lr]
SFX C 0 erem [^e][lr]
SFX C 0 eres [^e][lr]
SFX C el lere el
SFX C el lerer el
SFX C el leren el
SFX C el lerem el
SFX C el leres el
SFX C er rere uer
SFX C er rerer uer
SFX C er reren uer
SFX C er rerem uer
SFX C er reres uer
SFX C 0 ere [^u]er
SFX C 0 erer [^u]er
SFX C 0 eren [^u]er
SFX C 0 erem [^u]er
SFX C 0 eres [^u]er
SFX C lig eligere [^aeiouhlräüö]lig
SFX C lig eligerer [^aeiouhlräüö]lig
SFX C lig eligeren [^aeiouhlräüö]lig
SFX C lig eligerem [^aeiouhlräüö]lig
SFX C lig eligeres [^aeiouhlräüö]lig
SFX C erig rigere [^hi]erig
SFX C erig rigerer [^hi]erig
SFX C erig rigeren [^hi]erig
SFX C erig rigerem [^hi]erig
SFX C erig rigeres [^hi]erig
SFX C 0 est [kßsuxz]
SFX C 0 este [kßsuxz]
SFX C 0 ester [kßsuxz]
SFX C 0 esten [kßsuxz]
SFX C 0 estem [kßsuxz]
SFX C 0 estes [kßsuxz]
SFX C 0 st et
SFX C 0 ste et
SFX C 0 ster et
SFX C 0 sten et
SFX C 0 stem et
SFX C 0 stes et
SFX C 0 st igt
SFX C 0 ste igt
SFX C 0 ster igt
SFX C 0 sten igt
SFX C 0 stem igt
SFX C 0 stes igt
SFX C 0 est [^i]gt
SFX C 0 este [^i]gt
SFX C 0 ester [^i]gt
SFX C 0 esten [^i]gt
SFX C 0 estem [^i]gt
SFX C 0 estes [^i]gt
SFX C 0 est [^eg]t
SFX C 0 este [^eg]t
SFX C 0 ester [^eg]t
SFX C 0 esten [^eg]t
SFX C 0 estem [^eg]t
SFX C 0 estes [^eg]t
SFX C 0 st [^kßstxz]
SFX C 0 ste [^kßstxz]
SFX C 0 ster [^kßstxz]
SFX C 0 sten [^kßstxz]
SFX C 0 stem [^kßstxz]
SFX C 0 stes [^kßstxz]
SFX C 0 st nd
SFX C 0 ste nd
SFX C 0 ster nd
SFX C 0 sten nd
SFX C 0 stem nd
SFX C 0 stes nd
SFX C 0 est [^n]d
SFX C 0 este [^n]d
SFX C 0 ester [^n]d
SFX C 0 esten [^n]d
SFX C 0 estem [^n]d
SFX C 0 estes [^n]d
SFX C lig eligst [^aeiouhlräüö]lig
SFX C lig eligste [^aeiouhlräüö]lig
SFX C lig eligster [^aeiouhlräüö]lig
SFX C lig eligsten [^aeiouhlräüö]lig
SFX C lig eligstem [^aeiouhlräüö]lig
SFX C lig eligstes [^aeiouhlräüö]lig
SFX C erig rigst [^hi]erig
SFX C erig rigste [^hi]erig
SFX C erig rigster [^hi]erig
SFX C erig rigsten [^hi]erig
SFX C erig rigstem [^hi]erig
SFX C erig rigstes [^hi]erig
SFX E Y 1
SFX E 0 e .
SFX f Y 4
SFX f ph f ph
SFX f ph fen ph
SFX f phie fie phie
SFX f phie fien phie
SFX N Y 1
SFX N 0 n .
SFX P Y 1
SFX P 0 en .
SFX p Y 26
SFX p auf äufe auf
SFX p auf äufen auf
SFX p aus äuser [hH]aus
SFX p aus äusern [hH]aus
SFX p arkt ärkte [mM]arkt
SFX p arkt ärkten [mM]arkt
SFX p ang änge ang
SFX p ang ängen ang
SFX p uß üße uß
SFX p uß üßen uß
SFX p oß öße oß
SFX p oß ößen oß
SFX p aum äume aum
SFX p aum äumen aum
SFX p ag äge ag
SFX p ag ägen ag
SFX p ug üge ug
SFX p ug ügen ug
SFX p all älle all
SFX p all ällen all
SFX p ass ässe ass
SFX p ass ässen ass
SFX p uss üsse uss
SFX p uss üssen uss
SFX p oss össe oss
SFX p oss össen oss
# last ...oss rules are for swiss de_CH only - but do not affect de_DE
SFX R Y 3
SFX R 0 er [^e]
SFX R 0 ern [^e]
SFX R 0 r e
SFX S Y 1
SFX S 0 s .
SFX q Y 2
SFX q 0 se s
SFX q 0 sen s
SFX Q Y 1
SFX Q 0 ses s
#SFX Q 0 se s
#SFX Q 0 sen s
SFX T Y 1
SFX T 0 es .
SFX J Y 12
SFX J n ung [bgkpßsz]eln
SFX J n ungen [bgkpßsz]eln
SFX J eln lung eln
SFX J n ung ern
SFX J en ung en
SFX J eln lungen eln
SFX J n ungen ern
SFX J en ungen en
SFX J 0 ung [^n]
SFX J 0 ungen [^n]
SFX J el lung el
SFX J el lungen el
SFX B N 12
SFX B n bar e[lr]n
SFX B n bare e[lr]n
SFX B n baren e[lr]n
SFX B n barer e[lr]n
SFX B n bares e[lr]n
SFX B n barem e[lr]n
SFX B en bar en
SFX B en bare en
SFX B en baren en
SFX B en barer en
SFX B en bares en
SFX B en barem en
SFX D Y 6
SFX D 0 d n
SFX D 0 de n
SFX D 0 den n
SFX D 0 der n
SFX D 0 des n
SFX D 0 dem n
SFX W Y 5
SFX W en 0 en
SFX W n 0 [^e]n
SFX W st 0 [^s]st
SFX W t 0 sst
SFX W t 0 [^s]t
SFX I Y 16
SFX I n 0 en
SFX I eln le eln
SFX I n e eln
SFX I ern re ern
SFX I n e ern
SFX I n t e[lr]n
SFX I n t [dt]en
SFX I en t [^dimnt]en
SFX I en t eien
SFX I n t [^e]ien
SFX I n t chnen
SFX I en t [^c]h[mn]en
SFX I n t [^aäehilmnoöuür][mn]en
SFX I en t [aäeilmnoöuür][mn]en
SFX I n e un
SFX I n t un
SFX X Y 26
SFX X n t e[lr]n
SFX X n t [dtw]en
SFX X en t eien
SFX X n t [^e]ien
SFX X en t [^ditmnw]en
SFX X n t chnen
SFX X en t [^c]h[mn]en
SFX X n t [^aäehilmnoöuür][mn]en
SFX X en t [aäeilmnoöuür][mn]en
SFX X n t un
SFX X st 0 tst
SFX X n st e[lr]n
SFX X n st [dtw]en
SFX X en st [^dimnßstwzx]en
SFX X en st eien
SFX X n st [^e]ien
SFX X n st chnen
SFX X en st [^c]h[mn]en
SFX X n st [^aäehilmnoöuür][mn]en
SFX X en st [aäeilmnoöuür][mn]en
SFX X n st un
SFX X n st [ßsxz]en
SFX X n st ssen
SFX X n st schen
SFX X t st [^sz]t
SFX X t est zt
SFX Y Y 36
SFX Y n te e[lr]n
SFX Y n te [dtw]en
SFX Y en te [^dimntw]en
SFX Y en te eien
SFX Y n te [^e]ien
SFX Y n te chnen
SFX Y en te [^c]h[mn]en
SFX Y n te [^aäehilmnoöuür][mn]en
SFX Y en te [aäeilmnoöuür][mn]en
SFX Y n test e[lr]n
SFX Y n test [dtw]en
SFX Y en test [^dimntw]en
SFX Y en test eien
SFX Y n test [^e]ien
SFX Y n test chnen
SFX Y en test [^c]h[mn]en
SFX Y n test [^aäehilmnoöuür][mn]en
SFX Y en test [aäeilmnoöuür][mn]en
SFX Y n tet e[lr]n
SFX Y n tet [dtw]en
SFX Y en tet [^dimntw]en
SFX Y en tet eien
SFX Y n tet [^e]ien
SFX Y n tet chnen
SFX Y en tet [^c]h[mn]en
SFX Y n tet [^aäehilmnoöuür][mn]en
SFX Y en tet [aäeilmnoöuür][mn]en
SFX Y n ten e[lr]n
SFX Y n ten [dtw]en
SFX Y en ten [^dimntw]en
SFX Y en ten eien
SFX Y n ten [^e]ien
SFX Y n ten chnen
SFX Y en ten [^c]h[mn]en
SFX Y n ten [^aäehilmnoöuür][mn]en
SFX Y en ten [aäeilmnoöuür][mn]en
SFX Z Y 15
SFX Z 0 st [^hßsz]
SFX Z 0 st [^c]h
SFX Z 0 st [^s]ch
SFX Z 0 est [dfkstz]
SFX Z 0 est ch
SFX Z 0 est [au]ß
SFX Z 0 est ieß
SFX Z 0 est [io]ss
SFX Z 0 t [^dt]
SFX Z 0 et [dt]
SFX Z 0 n e
SFX Z 0 en ie
SFX Z 0 en [^e]
SFX Z 0 est iess
SFX Z 0 est [au]ss
# last two ...ss rules only used for swiss de_CH - but de_DE is unaffected
SFX O Y 21
SFX O n tes e[lr]n
SFX O n tes [dtw]en
SFX O en tes [^dmntw]en
SFX O n tes chnen
SFX O en tes [^c]h[mn]en
SFX O n tes [^aäehilmnoöuür][mn]en
SFX O en tes [aäeilmnoöuür][mn]en
SFX O n ter e[lr]n
SFX O n ter [dtw]en
SFX O en ter [^dmntw]en
SFX O n ter chnen
SFX O en ter [^c]h[mn]en
SFX O n ter [^aäehilmnoöuür][mn]en
SFX O en ter [aäeilmnoöuür][mn]en
SFX O n tem e[lr]n
SFX O n tem [dtw]en
SFX O en tem [^dmntw]en
SFX O n tem chnen
SFX O en tem [^c]h[mn]en
SFX O n tem [^aäehilmnoöuür][mn]en
SFX O en tem [aäeilmnoöuür][mn]en
REP 28
REP f ph
REP ph f
REP ß ss
REP ss ß
REP s ss
REP ss s
REP i ie
REP ie i
REP ee e
REP o oh
REP oh o
REP a ah
REP ah a
REP e eh
REP eh e
REP ae ä
REP oe ö
REP ue ü
REP Ae Ä
REP Oe Ö
REP Ue Ü
REP d t
REP t d
REP th t
REP t th
REP r rh
REP ch k
REP k ch
#REP eee ee-E
# this one will allow "-Eltern" - Hunspell 1.1.5 bug, but CHECKSHARPS obsoletes LANG de_DE
#LANG de_DE
CHECKSHARPS
COMPOUNDBEGIN x
COMPOUNDMIDDLE y
COMPOUNDEND z
FORBIDDENWORD d
# Prefixes are allowed at the beginning of compounds,
# suffixes are allowed at the end of compounds by default:
# (prefix)?(root)+(affix)?
# Affixes with COMPOUNDPERMITFLAG may be inside of compounds.
COMPOUNDPERMITFLAG c
ONLYINCOMPOUND o
# my PSEUDOROOT h(elper) flag
NEEDAFFIX h
# forbid uppercase characters at compound word bounds
# BUT I want to take care about it myself ;-)
# CHECKCOMPOUNDCASE
KEEPCASE w
# Affixes signed with CIRCUMFIX flag may be on a word when this word also has a prefix with CIRCUMFIX flag and vice versa.
# for decapitalizing nouns with fogemorphemes
CIRCUMFIX f
# this one would make a separate dict entry "Denkmalsschutz" invalidate the
# compound of "Denkmal"+"schutz". We do not want this feature here...
# CHECKCOMPOUNDREP
# make not all possible suggestions for typos of Flicken or some rare words
NOSUGGEST n
WORDCHARS ß-.
# - setting this to 2 decreases performance by 1/10 but is needed for "öl" and "ei"
# - setting this to 1 for handling Fuge-elements with dashes (Arbeits-) dash will
# be a special word but - is handled as a affix now
COMPOUNDMIN 2
# this ones are for Duden R36 (old orthography)
#CHECKCOMPOUNDPATTERN 2 #oldspell
#CHECKCOMPOUNDPATTERN ee e #oldspell
#CHECKCOMPOUNDPATTERN oo o #oldspell
# also need oo o
# this one needs to be flagable to be used for old orthography
#CHECKCOMPOUNDTRIPLE
PFX i Y 1
PFX i 0 -/coyf .
SFX j Y 3
SFX j 0 0/xoc .
SFX j 0 -/zocf .
SFX j 0 -/cz .
# Female forms for compound/Compound words:
# attention: [^e][^n] does also filter out "...er" !
SFX g Y 12
SFX g 0 innen/xyoc [^n]
SFX g en innen/xyoc en
SFX g 0 Innen/xyoc [^n]
SFX g en Innen/xyoc en
SFX g 0 innen/xyocf [^n]
SFX g en innen/xyocf en
SFX g 0 Innen/xyocf [^n]
SFX g en Innen/xyocf en
SFX g 0 innen-/cz [^n]
SFX g en innen-/cz en
SFX g 0 Innen-/cz [^n]
SFX g en Innen-/cz en
PFX k Y 2
PFX k 0 -/coxf .
PFX k 0 0/coy .
SFX e Y 2
SFX e 0 0/yoc .
SFX e 0 -/zc .
# for Uppercased end-words to prepend - and lowercase: (Tier/EPSm) (EX: Bettbezüge und *-laken*)
# AND
# for lowercased end-words to prepend - and re-uppercase : (tier/EPSozm) (EX: Arbeits*-Tier*)
#PFX m A -a/co A
#PFX m a -/ a
PFX m Y 58
PFX m A -a A
PFX m B -b B
PFX m C -c C
PFX m D -d D
PFX m E -e E
PFX m F -f F
PFX m G -g G
PFX m H -h H
PFX m I -i I
PFX m J -j J
PFX m K -k K
PFX m L -l L
PFX m M -m M
PFX m N -n N
PFX m O -o O
PFX m P -p P
PFX m Q -q Q
PFX m R -r R
PFX m S -s S
PFX m T -t T
PFX m U -u U
PFX m V -v V
PFX m W -w W
PFX m X -x X
PFX m Y -y Y
PFX m Z -z Z
PFX m Ä -ä Ä
PFX m Ö -ö Ö
PFX m Ü -ü Ü
PFX m a -A/co a
PFX m b -B/co b
PFX m c -C/co c
PFX m d -D/co d
PFX m e -E/co e
PFX m f -F/co f
PFX m g -G/co g
PFX m h -H/co h
PFX m i -I/co i
PFX m j -J/co j
PFX m k -K/co k
PFX m l -L/co l
PFX m m -M/co m
PFX m n -N/co n
PFX m o -O/co o
PFX m p -P/co p
PFX m q -Q/co q
PFX m r -R/co r
PFX m s -S/co s
PFX m t -T/co t
PFX m u -U/co u
PFX m v -V/co v
PFX m w -W/co w
PFX m x -X/co x
PFX m y -Y/co y
PFX m z -Z/co z
PFX m ä -Ä/co ä
PFX m ö -Ö/co ö
PFX m ü -Ü/co ü
# Decapitalizing: (not used ATM... )
# /co(f) : compound permit, in coumpount only, (decapitalizing with fogemorphemes)
#PFX l Y 29
#PFX l A a/co A
#PFX l Ä ä/co Ä
#PFX l B b/co B
#PFX l C c/co C
#PFX l D d/co D
#PFX l E e/co E
#PFX l F f/co F
#PFX l G g/co G
#PFX l H h/co H
#PFX l I i/co I
#PFX l J j/co J
#PFX l K k/co K
#PFX l L l/co L
#PFX l M m/co M
#PFX l N n/co N
#PFX l O o/co O
#PFX l Ö ö/co Ö
#PFX l P p/co P
#PFX l Q q/co Q
#PFX l R r/co R
#PFX l S s/co S
#PFX l T t/co T
#PFX l U u/co U
#PFX l Ü ü/co Ü
#PFX l V v/co V
#PFX l W w/co W
#PFX l X x/co X
#PFX l Y y/co Y
#PFX l Z z/co Z
# private hunspell flags:
# --x : not for capmain (rare words)
# With "BREAK -" some wrong forms are accepted but that is needed for US-Wirtschaft etc.
# So enabling this is the lesser evil. No perfect solution found so far...
BREAK 2
BREAK -
BREAK .

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,205 @@
SET UTF-8
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
ICONV 1
ICONV '
NOSUGGEST !
# ordinal numbers
COMPOUNDMIN 1
# only in compounds: 1th, 2th, 3th
ONLYINCOMPOUND c
# compound rules:
# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
COMPOUNDRULE 2
COMPOUNDRULE n*1t
COMPOUNDRULE n*mp
WORDCHARS 0123456789'
PFX A Y 1
PFX A 0 re .
PFX I Y 1
PFX I 0 in .
PFX U Y 1
PFX U 0 un .
PFX C Y 1
PFX C 0 de .
PFX E Y 1
PFX E 0 dis .
PFX F Y 1
PFX F 0 con .
PFX K Y 1
PFX K 0 pro .
SFX V N 2
SFX V e ive e
SFX V 0 ive [^e]
SFX N Y 3
SFX N e ion e
SFX N y ication y
SFX N 0 en [^ey]
SFX X Y 3
SFX X e ions e
SFX X y ications y
SFX X 0 ens [^ey]
SFX H N 2
SFX H y ieth y
SFX H 0 th [^y]
SFX Y Y 1
SFX Y 0 ly .
SFX G Y 2
SFX G e ing e
SFX G 0 ing [^e]
SFX J Y 2
SFX J e ings e
SFX J 0 ings [^e]
SFX D Y 4
SFX D 0 d e
SFX D y ied [^aeiou]y
SFX D 0 ed [^ey]
SFX D 0 ed [aeiou]y
SFX T N 4
SFX T 0 st e
SFX T y iest [^aeiou]y
SFX T 0 est [aeiou]y
SFX T 0 est [^ey]
SFX R Y 4
SFX R 0 r e
SFX R y ier [^aeiou]y
SFX R 0 er [aeiou]y
SFX R 0 er [^ey]
SFX Z Y 4
SFX Z 0 rs e
SFX Z y iers [^aeiou]y
SFX Z 0 ers [aeiou]y
SFX Z 0 ers [^ey]
SFX S Y 4
SFX S y ies [^aeiou]y
SFX S 0 s [aeiou]y
SFX S 0 es [sxzh]
SFX S 0 s [^sxzhy]
SFX P Y 3
SFX P y iness [^aeiou]y
SFX P 0 ness [aeiou]y
SFX P 0 ness [^y]
SFX M Y 1
SFX M 0 's .
SFX B Y 3
SFX B 0 able [^aeiou]
SFX B 0 able ee
SFX B e able [^aeiou]e
SFX L Y 1
SFX L 0 ment .
REP 90
REP a ei
REP ei a
REP a ey
REP ey a
REP ai ie
REP ie ai
REP alot a_lot
REP are air
REP are ear
REP are eir
REP air are
REP air ere
REP ere air
REP ere ear
REP ere eir
REP ear are
REP ear air
REP ear ere
REP eir are
REP eir ere
REP ch te
REP te ch
REP ch ti
REP ti ch
REP ch tu
REP tu ch
REP ch s
REP s ch
REP ch k
REP k ch
REP f ph
REP ph f
REP gh f
REP f gh
REP i igh
REP igh i
REP i uy
REP uy i
REP i ee
REP ee i
REP j di
REP di j
REP j gg
REP gg j
REP j ge
REP ge j
REP s ti
REP ti s
REP s ci
REP ci s
REP k cc
REP cc k
REP k qu
REP qu k
REP kw qu
REP o eau
REP eau o
REP o ew
REP ew o
REP oo ew
REP ew oo
REP ew ui
REP ui ew
REP oo ui
REP ui oo
REP ew u
REP u ew
REP oo u
REP u oo
REP u oe
REP oe u
REP u ieu
REP ieu u
REP ue ew
REP ew ue
REP uff ough
REP oo ieu
REP ieu oo
REP ier ear
REP ear ier
REP ear air
REP air ear
REP w qu
REP qu w
REP z ss
REP ss z
REP shun tion
REP shun sion
REP shun cion
REP size cise

File diff suppressed because it is too large Load diff