diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 7e31d85c..038ae5cc 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -2,4 +2,4 @@ blank_issues_enabled: false
contact_links:
- name: 🗣️ Discord Chat
url: https://discord.com/invite/rduPF3yk62
- about: Ask questions and discuss with others on my Discord server.
\ No newline at end of file
+ about: Support Discord, please ask questions and seek support here.
\ No newline at end of file
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
deleted file mode 100644
index f4a116a5..00000000
--- a/.github/pull_request_template.md
+++ /dev/null
@@ -1,6 +0,0 @@
------
-
-- [ ] Have you explained what your changes do, and why they add value to BuildSystem?
-
-**Please note: we will close your Pull Request without comment if you do not check the box above and provide ALL
-requested information.**
diff --git a/.github/workflows/publish-to-maven.yml b/.github/workflows/publish-to-maven.yml
new file mode 100644
index 00000000..0c48cd51
--- /dev/null
+++ b/.github/workflows/publish-to-maven.yml
@@ -0,0 +1,27 @@
+name: Publish project to Maven repository
+
+on:
+ push:
+ branches: [ master ]
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Git Repository
+ uses: actions/checkout@v3.5.3
+
+ - name: Set up JDK
+ uses: actions/setup-java@v3.11.0
+ with:
+ distribution: 'temurin'
+ java-version: 17
+
+ - name: Grant execute permission for gradlew
+ run: chmod +x gradlew
+
+ - name: Publish with Gradle
+ run: ./gradlew build publish
+ env:
+ MAVEN_NAME: ${{ secrets.MAVEN_NAME }}
+ MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }}
\ No newline at end of file
diff --git a/HEADER.txt b/HEADER.txt
new file mode 100644
index 00000000..7388d2ee
--- /dev/null
+++ b/HEADER.txt
@@ -0,0 +1,15 @@
+Copyright (c) 2018-2023, Thomas Meaney
+Copyright (c) contributors
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 5bb95972..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2023, Thomas Meaney
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by einTosti.
-4. Neither the name of einTosti nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 00000000..2694e496
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,858 @@
+-----------------
+BuildSystem License
+-----------------
+
+BuildSystem as a whole is licensed under:
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+----------------
+commons-lang License
+----------------
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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
+
+ http://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.
+
+----------------
+LuckPerms License
+----------------
+
+MIT License
+
+Copyright (c) lucko (Luck)
+Copyright (c) contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
index 0f2ab47a..f9fb9428 100644
--- a/README.md
+++ b/README.md
@@ -115,6 +115,41 @@ not to forget: let each player decide which settings whey think are best for the

+## Developer API
+
+**Maven:**
+
+```xml
+
+
+ eintosti-releases
+ https://repo.eintosti.de/releases
+
+```
+
+```xml
+
+
+ de.eintosti
+ buildsystem-api
+ version
+
+ ```
+
+**Or alternatively, with Gradle:**
+
+```kotlin
+repositories {
+ maven {
+ url = uri("https://repo.eintosti.de/releases")
+ }
+}
+
+dependencies {
+ compileOnly("de.eintosti:buildsystem-api:version")
+}
+```
+
## Contributing
### To compile...
@@ -146,4 +181,4 @@ that come with them.
## License
-This project is licensed under the [BSD 4-Clause License](LICENSE).
+This project is licensed under the [GNU General Public License v3.0](LICENSE.txt).
\ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt
index 97ddecd2..51e1ab7b 100644
--- a/buildSrc/src/main/kotlin/CommonConfig.kt
+++ b/buildSrc/src/main/kotlin/CommonConfig.kt
@@ -17,7 +17,7 @@ fun Project.applyCommonConfiguration() {
}
maven {
name = "PaperMC"
- url = uri("https://papermc.io/repo/repository/maven-public/")
+ url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = "OSS Sonatype Snapshots"
diff --git a/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/CustomBlocks_1_12_R1.java b/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/CustomBlocks_1_12_R1.java
index 8095b00e..aaf2f60b 100644
--- a/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/CustomBlocks_1_12_R1.java
+++ b/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/CustomBlocks_1_12_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_12_R1;
diff --git a/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/GameRules_1_12_R1.java b/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/GameRules_1_12_R1.java
index 04759df8..848de0e8 100644
--- a/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/GameRules_1_12_R1.java
+++ b/buildsystem-abstraction/adapter-1_12/src/main/java/de/eintosti/buildsystem/version/v1_12_R1/GameRules_1_12_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_12_R1;
diff --git a/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/CustomBlocks_1_13_R1.java b/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/CustomBlocks_1_13_R1.java
index 2d539834..055e77f3 100644
--- a/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/CustomBlocks_1_13_R1.java
+++ b/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/CustomBlocks_1_13_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_13_R1;
diff --git a/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/GameRules_1_13_R1.java b/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/GameRules_1_13_R1.java
index 3f6b349a..d074b505 100644
--- a/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/GameRules_1_13_R1.java
+++ b/buildsystem-abstraction/adapter-1_13/src/main/java/de/eintosti/buildsystem/version/v1_13_R1/GameRules_1_13_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_13_R1;
diff --git a/buildsystem-abstraction/adapter-1_14/src/main/java/de/eintosti/buildsystem/version/v1_14_R1/CustomBlocks_1_14_R1.java b/buildsystem-abstraction/adapter-1_14/src/main/java/de/eintosti/buildsystem/version/v1_14_R1/CustomBlocks_1_14_R1.java
index 6fa00b15..5fadd112 100644
--- a/buildsystem-abstraction/adapter-1_14/src/main/java/de/eintosti/buildsystem/version/v1_14_R1/CustomBlocks_1_14_R1.java
+++ b/buildsystem-abstraction/adapter-1_14/src/main/java/de/eintosti/buildsystem/version/v1_14_R1/CustomBlocks_1_14_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_14_R1;
diff --git a/buildsystem-abstraction/adapter-1_17/src/main/java/de/eintosti/buildsystem/version/v1_17_R1/CustomBlocks_1_17_R1.java b/buildsystem-abstraction/adapter-1_17/src/main/java/de/eintosti/buildsystem/version/v1_17_R1/CustomBlocks_1_17_R1.java
index eec984bc..7b1b4ff3 100644
--- a/buildsystem-abstraction/adapter-1_17/src/main/java/de/eintosti/buildsystem/version/v1_17_R1/CustomBlocks_1_17_R1.java
+++ b/buildsystem-abstraction/adapter-1_17/src/main/java/de/eintosti/buildsystem/version/v1_17_R1/CustomBlocks_1_17_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_17_R1;
diff --git a/buildsystem-abstraction/adapter-1_20/src/main/java/de/eintosti/buildsystem/version/v1_20_R1/CustomBlocks_1_20_R1.java b/buildsystem-abstraction/adapter-1_20/src/main/java/de/eintosti/buildsystem/version/v1_20_R1/CustomBlocks_1_20_R1.java
index 38bd0328..0a31e505 100644
--- a/buildsystem-abstraction/adapter-1_20/src/main/java/de/eintosti/buildsystem/version/v1_20_R1/CustomBlocks_1_20_R1.java
+++ b/buildsystem-abstraction/adapter-1_20/src/main/java/de/eintosti/buildsystem/version/v1_20_R1/CustomBlocks_1_20_R1.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.v1_20_R1;
diff --git a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlock.java b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlock.java
index db4a1f50..f224b7e6 100644
--- a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlock.java
+++ b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlock.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.customblocks;
diff --git a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlocks.java b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlocks.java
index ceb02e79..2c2282b1 100644
--- a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlocks.java
+++ b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/customblocks/CustomBlocks.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.customblocks;
diff --git a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/AbstractGameRulesInventory.java b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/AbstractGameRulesInventory.java
index ebcbdd25..75233744 100644
--- a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/AbstractGameRulesInventory.java
+++ b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/AbstractGameRulesInventory.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.gamerules;
diff --git a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/GameRules.java b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/GameRules.java
index 8877050e..48208e51 100644
--- a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/GameRules.java
+++ b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/gamerules/GameRules.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.gamerules;
diff --git a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/DirectionUtil.java b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/DirectionUtil.java
index 4b1e6923..baf9e859 100644
--- a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/DirectionUtil.java
+++ b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/DirectionUtil.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.util;
diff --git a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/MinecraftVersion.java b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/MinecraftVersion.java
index 143c7fff..f6081c94 100644
--- a/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/MinecraftVersion.java
+++ b/buildsystem-abstraction/common/src/main/java/de/eintosti/buildsystem/version/util/MinecraftVersion.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.version.util;
diff --git a/buildsystem-api/build.gradle.kts b/buildsystem-api/build.gradle.kts
new file mode 100644
index 00000000..f7e8da91
--- /dev/null
+++ b/buildsystem-api/build.gradle.kts
@@ -0,0 +1,58 @@
+applyCommonConfiguration()
+
+plugins {
+ java
+ `maven-publish`
+}
+
+dependencies {
+ compileOnly(libs.spigot)
+ compileOnly(libs.annotations)
+ compileOnly(libs.xseries)
+}
+
+java {
+ withSourcesJar()
+ withJavadocJar()
+}
+
+tasks {
+ withType {
+ title = "BuildSystem API (v" + project.version + ")"
+ val opt = options as StandardJavadocDocletOptions
+ opt.overview("javadoc/overview.html")
+ opt.encoding("UTF-8")
+ opt.charSet("UTF-8")
+ opt.links("https://docs.oracle.com/javase/8/docs/api/")
+ opt.links("https://hub.spigotmc.org/javadocs/spigot/")
+ opt.links("https://javadoc.io/static/org.jetbrains/annotations/24.0.1/")
+ opt.isLinkSource = true
+ opt.isUse = true
+ opt.keyWords()
+ }
+}
+
+publishing {
+ repositories {
+ maven {
+ name = "BuildSystem"
+ url = if (project.version.toString().endsWith("-SNAPSHOT")) {
+ uri("https://repo.eintosti.de/snapshots")
+ } else {
+ uri("https://repo.eintosti.de/releases")
+ }
+ credentials(PasswordCredentials::class)
+ authentication {
+ create("basic")
+ }
+ }
+ }
+ publications {
+ create("maven") {
+ groupId = "de.eintosti"
+ artifactId = "buildsystem-api"
+ version = project.version.toString()
+ from(components["java"])
+ }
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/javadoc/overview.html b/buildsystem-api/javadoc/overview.html
new file mode 100644
index 00000000..347f3a2b
--- /dev/null
+++ b/buildsystem-api/javadoc/overview.html
@@ -0,0 +1,11 @@
+
+
+ BuildSystem is a utility plugin targeted towards build-teams.
+ It allows worlds to be easily managed and also provides handy tools to assist with building.
+
+
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/BuildSystem.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/BuildSystem.java
new file mode 100644
index 00000000..36a31c6e
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/BuildSystem.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api;
+
+import de.eintosti.buildsystem.api.player.BuildPlayer;
+import de.eintosti.buildsystem.api.player.PlayerManager;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.WorldManager;
+
+/**
+ * The BuildSystem API.
+ */
+public interface BuildSystem {
+
+ /**
+ * Gets the {@link WorldManager}, responsible for managing {@link BuildWorld} instances.
+ *
+ * @return The world manager
+ */
+ WorldManager getWorldManager();
+
+ /**
+ * Gets the {@link PlayerManager}, responsible for managing {@link BuildPlayer} instances.
+ *
+ * @return The player manager
+ */
+ PlayerManager getPlayerManager();
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/BuildSystemProvider.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/BuildSystemProvider.java
new file mode 100644
index 00000000..66f3d4a9
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/BuildSystemProvider.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api;
+
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Provides static access to the {@link BuildSystem} API.
+ */
+public class BuildSystemProvider {
+
+ private static BuildSystem instance = null;
+
+ /**
+ * Gets an instance of the {@link BuildSystem} API.
+ *
+ * @return An instance of the BuildSystem API
+ * @throws IllegalStateException if the API is not loaded yet
+ */
+ @NotNull
+ public static BuildSystem get() {
+ BuildSystem instance = BuildSystemProvider.instance;
+ if (instance == null) {
+ throw new IllegalStateException("BuildSystem has not loaded yet!");
+ }
+ return instance;
+ }
+
+ @ApiStatus.Internal
+ static void register(BuildSystem instance) {
+ BuildSystemProvider.instance = instance;
+ }
+
+ @ApiStatus.Internal
+ static void unregister() {
+ BuildSystemProvider.instance = null;
+ }
+
+ @ApiStatus.Internal
+ private BuildSystemProvider() {
+ throw new AssertionError();
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/package-info.java
new file mode 100644
index 00000000..ee688909
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Main events package.
+ */
+package de.eintosti.buildsystem.api.event;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldEvent.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldEvent.java
new file mode 100644
index 00000000..df915a4e
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldEvent.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.event.world;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Represents a {@link BuildWorld} related event.
+ */
+public class BuildWorldEvent extends Event {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final BuildWorld buildWorld;
+
+ @ApiStatus.Internal
+ public BuildWorldEvent(BuildWorld buildWorld) {
+ this.buildWorld = buildWorld;
+ }
+
+ /**
+ * Gets the {@link BuildWorld} involved in this event
+ *
+ * @return The world involved in this event
+ */
+ public BuildWorld getBuildWorld() {
+ return buildWorld;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldLoadEvent.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldLoadEvent.java
new file mode 100644
index 00000000..09f981cd
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldLoadEvent.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.event.world;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import org.bukkit.event.Cancellable;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Called when a {@link BuildWorld} is loaded.
+ */
+public class BuildWorldLoadEvent extends BuildWorldEvent implements Cancellable {
+
+ private boolean cancelled = false;
+
+ @ApiStatus.Internal
+ public BuildWorldLoadEvent(BuildWorld buildWorld) {
+ super(buildWorld);
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldPostLoadEvent.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldPostLoadEvent.java
new file mode 100644
index 00000000..c31663ca
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldPostLoadEvent.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.event.world;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Called after a {@link BuildWorld} has loaded.
+ */
+public class BuildWorldPostLoadEvent extends BuildWorldEvent {
+
+ @ApiStatus.Internal
+ public BuildWorldPostLoadEvent(BuildWorld buildWorld) {
+ super(buildWorld);
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldPostUnloadEvent.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldPostUnloadEvent.java
new file mode 100644
index 00000000..70d7b6d6
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldPostUnloadEvent.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.event.world;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Called after a {@link BuildWorld} has unloaded.
+ */
+public class BuildWorldPostUnloadEvent extends BuildWorldEvent {
+
+ @ApiStatus.Internal
+ public BuildWorldPostUnloadEvent(BuildWorld buildWorld) {
+ super(buildWorld);
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldUnloadEvent.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldUnloadEvent.java
new file mode 100644
index 00000000..d9c5f873
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/BuildWorldUnloadEvent.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.event.world;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import org.bukkit.event.Cancellable;
+import org.jetbrains.annotations.ApiStatus;
+
+/**
+ * Called when a {@link BuildWorld} is unloaded.
+ */
+public class BuildWorldUnloadEvent extends BuildWorldEvent implements Cancellable {
+
+ private boolean cancelled = false;
+
+ @ApiStatus.Internal
+ public BuildWorldUnloadEvent(BuildWorld buildWorld) {
+ super(buildWorld);
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/package-info.java
new file mode 100644
index 00000000..97b116d0
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/event/world/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Events relating to a {@link de.eintosti.buildsystem.api.world.BuildWorld}.
+ */
+package de.eintosti.buildsystem.api.event.world;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/package-info.java
new file mode 100644
index 00000000..aba7a42b
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Main package for the {@link de.eintosti.buildsystem.api.BuildSystem} API interface.
+ */
+package de.eintosti.buildsystem.api;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/BuildPlayer.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/BuildPlayer.java
new file mode 100644
index 00000000..a9e35c74
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/BuildPlayer.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.player;
+
+import de.eintosti.buildsystem.api.settings.Settings;
+
+import java.util.UUID;
+
+public interface BuildPlayer {
+
+ /**
+ * Gets the unique-id of the player.
+ *
+ * @return The player's UUID
+ */
+ UUID getUniqueId();
+
+ /**
+ * Gets the player's per-player settings.
+ *
+ * @return The player's settings
+ */
+ Settings getSettings();
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/PlayerManager.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/PlayerManager.java
new file mode 100644
index 00000000..e054cbff
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/PlayerManager.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.player;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.Visibility;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.Unmodifiable;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.UUID;
+
+public interface PlayerManager {
+
+ /**
+ * Gets a build-player object by the given uuid.
+ *
+ * @param uuid The uuid to look up
+ * @return The player, if found, otherwise {@code null}
+ */
+ BuildPlayer getBuildPlayer(UUID uuid);
+
+ /**
+ * Gets a build-player object by the given player.
+ *
+ * @param player The uuid to look up
+ * @return The player, if found, otherwise {@code null}
+ */
+ BuildPlayer getBuildPlayer(Player player);
+
+ /**
+ * Gets a collection of all {@link BuildPlayer}s.
+ *
+ * @return A collection of all build-players.
+ */
+ @Unmodifiable
+ Collection getBuildPlayers();
+
+ /**
+ * Gets a set of all players currently in "build mode".
+ *
+ * @return A set of all players in "build mode".
+ * @see #isInBuildMode(Player)
+ */
+ Set getBuildModePlayers();
+
+ /**
+ * Gets whether a player is currently in "build mode".
+ *
+ * @param player The player
+ * @return {@code true} if the player is in "build mode", otherwise {@code false}
+ */
+ boolean isInBuildMode(Player player);
+
+ /**
+ * Gets whether the given player is allowed to create a new {@link BuildWorld}.
+ * This depends on the following factors:
+ *
+ *
Is the maximum amount of worlds set by the config less than the amount of existing worlds?
+ *
Is the maximum amount of worlds created by the player less than the amount of worlds said player is allowed to create?
+ *
+ *
+ * @param player The player trying to create a world
+ * @param visibility The visibility of the world trying to be created
+ * @return {@code true} if the player is allowed to create a world, otherwise {@code false}
+ */
+ boolean canCreateWorld(Player player, Visibility visibility);
+
+ /**
+ * Returns the maximum amount of {@link BuildWorld}s a player can create.
+ *
+ * If the player has the permission {@code buildsystem.admin}, unlimited worlds can be created.
+ * Otherwise, there are two different permissions to set said amount:
+ *
+ * To set the maximum of...
+ *
+ *
...public worlds, use {@literal buildsystem.create.public.}
+ *
...private worlds, use {@literal buildsystem.create.private.}
+ *
+ *
+ * @param player The player object
+ * @param visibility The visibility of the worlds to check the maximum of. Possible values: {@link Visibility#PUBLIC} or {@link Visibility#PRIVATE}
+ * @return If set, the maximum amount of worlds a player can create, otherwise -1
+ */
+ int getMaxWorlds(Player player, Visibility visibility);
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/package-info.java
new file mode 100644
index 00000000..0af5abba
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/player/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * {@link de.eintosti.buildsystem.api.player.BuildPlayer} functionality.
+ */
+package de.eintosti.buildsystem.api.player;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/DesignColor.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/DesignColor.java
new file mode 100644
index 00000000..9d5ca5bc
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/DesignColor.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.settings;
+
+public enum DesignColor {
+ RED,
+ ORANGE,
+ YELLOW,
+ PINK,
+ MAGENTA,
+ PURPLE,
+ BROWN,
+ LIME,
+ GREEN,
+ BLUE,
+ CYAN,
+ LIGHT_BLUE,
+ WHITE,
+ GRAY,
+ LIGHT_GRAY,
+ BLACK;
+
+ public static DesignColor matchColor(String colorName) {
+ try {
+ return valueOf(colorName);
+ } catch (IllegalArgumentException e) {
+ return DesignColor.BLACK;
+ }
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/NavigatorType.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/NavigatorType.java
new file mode 100644
index 00000000..9f43d5aa
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/NavigatorType.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.settings;
+
+public enum NavigatorType {
+ OLD,
+ NEW;
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/Settings.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/Settings.java
new file mode 100644
index 00000000..faabac4d
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/Settings.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.settings;
+
+import org.bukkit.GameMode;
+import org.bukkit.potion.PotionEffectType;
+
+public interface Settings {
+
+ /**
+ * Gets the mode the navigator is set to.
+ *
+ * @return The navigator type
+ */
+ NavigatorType getNavigatorType();
+
+ /**
+ * Sets the navigator type.
+ *
+ * The {@link NavigatorType#OLD} is the classic chest menu, whereas {@link NavigatorType#NEW} is a new 3D selector.
+ *
+ * @param navigatorType The navigator type
+ */
+ void setNavigatorType(NavigatorType navigatorType);
+
+ /**
+ * Gets the design color used in menus.
+ *
+ * @return The design color
+ */
+ DesignColor getDesignColor();
+
+ /**
+ * Sets the design color used in menus.
+ *
+ * @param designColor The design color
+ */
+ void setDesignColor(DesignColor designColor);
+
+ /**
+ * Gets the set of rules by which worlds are displayed in the navigator.
+ *
+ * @return The world display rules
+ */
+ WorldDisplay getWorldDisplay();
+
+ /**
+ * Sets the world display rule set
+ *
+ * @param worldDisplay The world display
+ */
+ void setWorldDisplay(WorldDisplay worldDisplay);
+
+ /**
+ * Gets whether the player's inventory is to be cleared when joining the server.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isClearInventory();
+
+ /**
+ * Sets whether the player's inventory is to be cleared when joining the server.
+ *
+ * @param clearInventory If the inventory is to be cleared
+ */
+ void setClearInventory(boolean clearInventory);
+
+ /**
+ * Gets whether the interaction with blocks is disabled.
+ *
+ * @return {@code true} if disabled, otherwise {@code false}
+ */
+ boolean isDisableInteract();
+
+ /**
+ * Sets whether the interaction with blocks should be disabled.
+ *
+ * @param disableInteract If the interaction with blocks is to be disabled
+ */
+ void setDisableInteract(boolean disableInteract);
+
+ /**
+ * Gets whether all online players are to be hidden.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isHidePlayers();
+
+ /**
+ * Sets whether all online players are to be hidden.
+ *
+ * @param hidePlayers If the players are to be hidden
+ */
+ void setHidePlayers(boolean hidePlayers);
+
+ /**
+ * Gets whether signs should be placed without opening the text input.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isInstantPlaceSigns();
+
+ /**
+ * Sets whether signs should be placed without opening the text input.
+ *
+ * @param instantPlaceSigns If signs are to be placed instantly
+ */
+ void setInstantPlaceSigns(boolean instantPlaceSigns);
+
+ /**
+ * Gets whether the navigator is kept in the player's inventory after a clear.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isKeepNavigator();
+
+ /**
+ * Sets whether the navigator is kept in the player's inventory after a clear.
+ *
+ * @param keepNavigator If the navigator is to kept
+ */
+ void setKeepNavigator(boolean keepNavigator);
+
+ /**
+ * Gets whether the player has permanent {@link PotionEffectType#NIGHT_VISION}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isNightVision();
+
+ /**
+ * Sets whether the player has permanent {@link PotionEffectType#NIGHT_VISION}.
+ *
+ * @param nightVision If the night vision is to be enabled
+ */
+ void setNightVision(boolean nightVision);
+
+ /**
+ * Gets whether fling against a wall puts the player in {@link GameMode#SPECTATOR}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isNoClip();
+
+ /**
+ * Sets whether fling against a wall puts the player in {@link GameMode#SPECTATOR}.
+ *
+ * @param noClip If no-clip is to be enabled
+ */
+ void setNoClip(boolean noClip);
+
+ /**
+ * Gets whether plants can be placed anywhere.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isPlacePlants();
+
+ /**
+ * Sets whether plants can be placed anywhere.
+ *
+ * @param placePlants If plants are to be placed anywhere
+ */
+ void setPlacePlants(boolean placePlants);
+
+ /**
+ * Gets whether the scoreboard is enabled.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isScoreboard();
+
+ /**
+ * Sets whether the scoreboard is enabled.
+ *
+ * @param scoreboard If the scoreboard is to be enabled
+ */
+ void setScoreboard(boolean scoreboard);
+
+ /**
+ * Gets whether only one half of a slab will be broken when breaking double slabs.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isSlabBreaking();
+
+ /**
+ * Sets whether only one half of a slab will be broken when breaking double slabs.
+ *
+ * @param slabBreaking If precise slab breaking is to be enabled
+ */
+ void setSlabBreaking(boolean slabBreaking);
+
+ /**
+ * Gets whether the player will be teleported to the spawn, if set, when joining the server.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isSpawnTeleport();
+
+ /**
+ * Sets whether the player will be teleported to the spawn, if set, when joining the server.
+ *
+ * @param spawnTeleport If the player is to be teleported to the spawn
+ */
+ void setSpawnTeleport(boolean spawnTeleport);
+
+ /**
+ * Gets whether right-clicking iron (trap-)doors will be open/close them.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ boolean isOpenTrapDoors();
+
+ /**
+ * Sets whether right-clicking iron (trap-)doors will be open/close them.
+ *
+ * @param openTrapDoors If the iron (trap-)doors are to be opened/closed via right-click
+ */
+ void setOpenTrapDoors(boolean openTrapDoors);
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldDisplay.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldDisplay.java
new file mode 100644
index 00000000..bab75f3c
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldDisplay.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.settings;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+
+public interface WorldDisplay {
+
+ /**
+ * Gets the order in which the {@link BuildWorld}s are sorted.
+ *
+ * @return The world sort order
+ */
+ WorldSort getWorldSort();
+
+ /**
+ * Sets the order in which the {@link BuildWorld}s are sorted.
+ *
+ * @param worldSort The world sort order
+ */
+ void setWorldSort(WorldSort worldSort);
+
+ /**
+ * Gets the filter which removed non-matching {@link BuildWorld}s from the navigator
+ *
+ * @return The world filter
+ */
+ WorldFilter getWorldFilter();
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldFilter.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldFilter.java
new file mode 100644
index 00000000..6f6cf73a
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldFilter.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.settings;
+
+import de.eintosti.buildsystem.api.world.BuildWorld;
+
+import java.util.function.Predicate;
+
+public interface WorldFilter {
+
+ enum Mode {
+ NONE("world_filter_mode_none"),
+ STARTS_WITH("world_filter_mode_starts_with"),
+ CONTAINS("world_filter_mode_contains"),
+ MATCHES("world_filter_mode_matches");
+
+ private final String loreKey;
+
+ Mode(String loreKey) {
+ this.loreKey = loreKey;
+ }
+
+ public String getLoreKey() {
+ return loreKey;
+ }
+
+ public Mode getNext() {
+ switch (this) {
+ default: // NONE
+ return STARTS_WITH;
+ case STARTS_WITH:
+ return CONTAINS;
+ case CONTAINS:
+ return MATCHES;
+ case MATCHES:
+ return NONE;
+ }
+ }
+ }
+
+ /**
+ * Gets the current mode.
+ *
+ * @return The mode
+ */
+ Mode getMode();
+
+ /**
+ * Sets the current mode.
+ *
+ * @param mode The mode
+ */
+ void setMode(Mode mode);
+
+ /**
+ * Gets the text which the filter is applied to.
+ *
+ * @return The text the filter is applied to
+ */
+ String getText();
+
+ /**
+ * Sets the text which the filter is applied to.
+ *
+ * @param text The text
+ */
+ void setText(String text);
+
+ /**
+ * Apply the filter to a {@link BuildWorld}.
+ *
+ * @return The filter predicate
+ */
+ Predicate apply();
+}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/navigator/settings/WorldSort.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldSort.java
similarity index 72%
rename from buildsystem-core/src/main/java/de/eintosti/buildsystem/navigator/settings/WorldSort.java
rename to buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldSort.java
index 7c847914..b44ffc66 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/navigator/settings/WorldSort.java
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/WorldSort.java
@@ -1,16 +1,21 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-package de.eintosti.buildsystem.navigator.settings;
-
-import de.eintosti.buildsystem.Messages;
-import org.bukkit.entity.Player;
-
-import java.util.List;
+package de.eintosti.buildsystem.api.settings;
public enum WorldSort {
NAME_A_TO_Z("world_sort_name_az"),
@@ -28,8 +33,8 @@ public enum WorldSort {
this.loreKey = loreKey;
}
- public List getItemLore(Player player) {
- return Messages.getStringList(loreKey, player);
+ public String getLoreKey() {
+ return loreKey;
}
public static WorldSort matchWorldSort(String type) {
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/package-info.java
new file mode 100644
index 00000000..a22441be
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/settings/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * {@link de.eintosti.buildsystem.api.settings.Settings} functionality.
+ */
+package de.eintosti.buildsystem.api.settings;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/BuildWorld.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/BuildWorld.java
new file mode 100644
index 00000000..590f6cec
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/BuildWorld.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world;
+
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.api.world.data.WorldType;
+import de.eintosti.buildsystem.api.world.generator.CustomGenerator;
+import org.bukkit.Difficulty;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.UUID;
+
+public interface BuildWorld {
+
+ /**
+ * Get the bukkit world linked to the build-world.
+ *
+ * @return The bukkit world
+ */
+ World getWorld();
+
+ /**
+ * Get the name of the world.
+ *
+ * @return The world's name
+ */
+ String getName();
+
+ /**
+ * Set the name of the world.
+ *
+ * @param name The name to set to
+ */
+ void setName(String name);
+
+ /**
+ * Gets whether the world has a creator
+ *
+ * @return {@code true} if the world has a creator, {@code false} otherwise
+ */
+ boolean hasCreator();
+
+ /**
+ * Get the name of the player who created the world.
+ *
+ * In older versions of the plugin, the creator was not saved which is why {@code null} can be returned.
+ *
+ * @return The name of the player who created the world
+ */
+ @Nullable
+ String getCreator();
+
+ /**
+ * Set the name of the creator.
+ *
+ * @param creator The name of the creator
+ */
+ void setCreator(String creator);
+
+ /**
+ * Get the unique-id of the player who created the world.
+ *
+ * In older versions of the plugin, the creator was not saved which is why {@code null} can be returned.
+ *
+ * @return The unique-id of the player who created the world
+ */
+ @Nullable
+ UUID getCreatorId();
+
+ /**
+ * Set the unique-id of the creator.
+ *
+ * @param creatorId The unique-id of the creator
+ */
+ void setCreatorId(UUID creatorId);
+
+ /**
+ * Gets whether the given player is the creator of the world.
+ *
+ * @param player The player to check
+ * @return {@code true} if the player is the creator, {@code false} otherwise
+ */
+ boolean isCreator(Player player);
+
+ /**
+ * Get world's type.
+ *
+ * @return The {@link WorldType} of the world
+ */
+ WorldType getType();
+
+ /**
+ * Gets the world's data.
+ *
+ * @return The {@link WorldData} of the world
+ */
+ WorldData getData();
+
+ /**
+ * Get the creation date of the world.
+ *
+ * @return The amount of milliseconds that have passed since {@code January 1, 1970 UTC}, until the world was created.
+ */
+ long getCreationDate();
+
+ /**
+ * Get the custom chunk generator used to generate the world.
+ *
+ * @return The custom chunk generator used to generate the world.
+ */
+ @Nullable
+ CustomGenerator getCustomGenerator();
+
+ /**
+ * Cycles to the next {@link Difficulty}.
+ */
+ void cycleDifficulty();
+
+ /**
+ * Get a list of all builders who can modify the world.
+ *
+ * @return the list of all builders
+ */
+ List getBuilders();
+
+ /**
+ * Get a list of all {@link Builder} names
+ *
+ * @return A list of all builder names
+ */
+ List getBuilderNames();
+
+ /**
+ * Get a builder by the given uuid.
+ *
+ * @param uuid The player's unique-id
+ * @return The builder object, if any, or {@code null}
+ */
+ @Nullable
+ Builder getBuilder(UUID uuid);
+
+ /**
+ * Get whether the given uuid matches that of an added builder.
+ *
+ * @param uuid The unique-id of the player to be checked
+ * @return Whether the player is a builder
+ */
+ boolean isBuilder(UUID uuid);
+
+ /**
+ * Get whether the given player has been added as a {@link Builder}.
+ *
+ * @param player The player to be checked
+ * @return Whether the {@link Player} is a builder
+ * @see #isBuilder(UUID)
+ */
+ boolean isBuilder(Player player);
+
+ /**
+ * Add a {@link Builder} to the current list of builders
+ *
+ * @param builder The builder object
+ */
+ void addBuilder(Builder builder);
+
+ /**
+ * Remove a {@link Builder} from the current list of builders
+ *
+ * @param builder The builder object
+ */
+ void removeBuilder(Builder builder);
+
+ /**
+ * Add a {@link Builder} to the current list of builders
+ *
+ * @param uuid The builder's unique ID
+ * @see #removeBuilder(Builder)
+ */
+ void removeBuilder(UUID uuid);
+
+ /**
+ * Get whether the world has been loaded, allowing a player to enter it.
+ *
+ * @return {@code true} if the world is loaded, otherwise {@code false}
+ */
+ boolean isLoaded();
+
+ /**
+ * Unloads the world.
+ *
+ * In order for the world to be unloaded, the following criteria must be met:
+ *
+ *
There cannot be any players in the world
+ *
The world is not allowed to be the spawn world
+ *
The world is not allowed to be on the blacklist of worlds which cannot be unloaded
+ *
+ */
+ void unload();
+
+ /**
+ * Attempts to unload the world without checking if players are in the world.
+ *
+ * As with {@link #unload()}, in order for the world to be unloaded, the following criteria must be met:
+ *
+ *
The world is not allowed to be the spawn world
+ *
The world is not allowed to be on the blacklist of worlds which cannot be unloaded
+ *
+ *
+ * @param save Should chunks be saved before unloading
+ */
+ void forceUnload(boolean save);
+
+ /**
+ * Loads the world.
+ */
+ void load();
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/BuildWorldCreator.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/BuildWorldCreator.java
new file mode 100644
index 00000000..611beb8c
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/BuildWorldCreator.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world;
+
+import de.eintosti.buildsystem.api.world.data.WorldType;
+import de.eintosti.buildsystem.api.world.generator.CustomGenerator;
+import org.bukkit.Difficulty;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.generator.ChunkGenerator;
+import org.jetbrains.annotations.Nullable;
+
+public interface BuildWorldCreator {
+
+ /**
+ * Sets the name of the world.
+ *
+ * @param name The world name
+ * @return The world creator object
+ */
+ BuildWorldCreator setName(String name);
+
+ /**
+ * Sets the creator of the world.
+ *
+ * @param creator The creator, may be {@code null}
+ * @return The world creator object
+ */
+ BuildWorldCreator setCreator(@Nullable Builder creator);
+
+ /**
+ * Sets the template which the world should be copied from.
+ *
+ * Only used if the world type is {@link WorldType#TEMPLATE}
+ *
+ * @param template The template name
+ * @return The creator object
+ */
+ BuildWorldCreator setTemplate(String template);
+
+ /**
+ * Sets the type of the world.
+ *
+ * @param type The world type
+ * @return The world creator object
+ */
+ BuildWorldCreator setType(WorldType type);
+
+ /**
+ * Sets the custom {@link ChunkGenerator} of the world.
+ *
+ * @param customGenerator The custom chunk generator
+ * @return The world creator object
+ */
+ BuildWorldCreator setCustomGenerator(CustomGenerator customGenerator);
+
+ BuildWorldCreator setPrivate(boolean privateWorld);
+
+ BuildWorldCreator setDifficulty(Difficulty difficulty);
+
+ BuildWorldCreator setCreationDate(long creationDate);
+
+ /**
+ * Depending on the {@link BuildWorld}'s {@link WorldType}, the corresponding {@link World} will be generated in a different way.
+ * Then, if the creation of the world was successful and the config is set accordingly, the player is teleported to the world.
+ *
+ * @param player The player who is creating the world
+ */
+ void createWorld(Player player);
+
+ /**
+ * Imports an existing world as a {@link BuildWorld}.
+ *
+ * @param player The player who is importing the world
+ * @param teleport Should the player be teleported to the world after importing is finished
+ */
+ void importWorld(Player player, boolean teleport);
+
+ @Nullable
+ World generateBukkitWorld();
+
+ /**
+ * Generate the {@link World} linked to a {@link BuildWorld}.
+ *
+ * @param checkVersion Should the world version be checked
+ * @return The world object
+ */
+ @Nullable
+ World generateBukkitWorld(boolean checkVersion);
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/Builder.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/Builder.java
new file mode 100644
index 00000000..eabf42d2
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/Builder.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world;
+
+import org.bukkit.entity.Player;
+
+import java.util.UUID;
+
+public interface Builder {
+
+ /**
+ * Returns a unique and persistent id for the builder.
+ * Should be equal to the corresponding {@link Player}'s unique id.
+ *
+ * @return The uuid
+ * @see Player#getUniqueId()
+ */
+ UUID getUuid();
+
+ /**
+ * Gets the name of the builder.
+ *
+ * @return The builder name
+ */
+ String getName();
+
+ /**
+ * Sets the name of the builder.
+ *
+ * @param name The name to change to
+ */
+ void setName(String name);
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/WorldManager.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/WorldManager.java
new file mode 100644
index 00000000..59f5f86a
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/WorldManager.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world;
+
+import de.eintosti.buildsystem.api.world.data.Visibility;
+import de.eintosti.buildsystem.api.world.data.WorldType;
+import de.eintosti.buildsystem.api.world.generator.Generator;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.generator.ChunkGenerator;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.Unmodifiable;
+
+import java.util.Collection;
+import java.util.List;
+
+public interface WorldManager {
+
+ /**
+ * Gets the {@link BuildWorld} by the given name.
+ *
+ * @param worldName The name of the world
+ * @return The world object if one was found, {@code null} otherwise
+ */
+ BuildWorld getBuildWorld(String worldName);
+
+ /**
+ * Gets the {@link BuildWorld} by the given {@link World}.
+ *
+ * @param world The bukkit world object
+ * @return The world object if one was found, {@code null} otherwise
+ */
+ BuildWorld getBuildWorld(World world);
+
+ /**
+ * Gets a list of all {@link BuildWorld}s.
+ *
+ * @return A list of all worlds
+ */
+ @Unmodifiable
+ Collection getBuildWorlds();
+
+ /**
+ * Gets a list of all {@link BuildWorld}s created by the given player.
+ *
+ * @param player The player who created the world
+ * @return A list of all worlds created by the given player.
+ */
+ List getBuildWorldsCreatedByPlayer(Player player);
+
+ /**
+ * Gets a list of all {@link BuildWorld}s created by the given player.
+ *
+ * @param player The player who created the world
+ * @param visibility The visibility the world should have
+ * @return A list of all worlds created by the given player.
+ */
+ List getBuildWorldsCreatedByPlayer(Player player, Visibility visibility);
+
+ /**
+ * Checks if a world with the given name already exists.
+ *
+ * @param worldName The name of the world
+ * @return Whether if a world with the given name already exists
+ */
+ boolean worldExists(String worldName);
+
+ /**
+ * Change the name of a {@link BuildWorld} to a given name.
+ *
+ * @param buildWorld The build world object
+ * @param newName The name the world should be renamed to
+ */
+ void renameWorld(BuildWorld buildWorld, String newName);
+
+ /**
+ * Gets the {@link ChunkGenerator} for the generation of a {@link BuildWorld} with {@link WorldType#CUSTOM}.
+ *
+ * @param plugin The name of the plugin providing the generator
+ * @param generatorId Unique ID, if any, that was specified to indicate which generator was requested
+ * @param worldName Name of the world that the chunk generator should be applied to.
+ * @return The chunk generator for use in the world generation
+ */
+ @Nullable
+ ChunkGenerator getChunkGenerator(String plugin, String generatorId, String worldName);
+
+ /**
+ * Gets a builder for creating new {@link BuildWorld}s.
+ *
+ * @param worldName The name of the world to create
+ * @return The world creator
+ */
+ BuildWorldCreator newWorldCreator(String worldName);
+
+ /**
+ * Import a {@link BuildWorld} from a world directory.
+ *
+ * @param worldName The name of the world to import
+ * @param creator The builder who should be set as the creator
+ * @param generator The generator type used by the world
+ * @param generatorName The name of the custom generator if generator type is {@link Generator#CUSTOM}
+ * @return {@code true} if the world was successfully imported, otherwise {@code false}
+ */
+ boolean importWorld(String worldName, Builder creator, Generator generator, String generatorName);
+
+ /**
+ * Delete an existing {@link BuildWorld}.
+ * In comparison to {@link #unimportWorld(BuildWorld, boolean)}, deleting a world deletes the world's directory.
+ *
+ * @param buildWorld The world to be deleted
+ */
+ void deleteWorld(BuildWorld buildWorld);
+
+ /**
+ * Unimport an existing {@link BuildWorld}.
+ * In comparison to {@link #deleteWorld(BuildWorld)}, unimporting a world does not delete the world's directory.
+ *
+ * @param buildWorld The build world object
+ * @param save Should the world be saved before unimporting
+ */
+ void unimportWorld(BuildWorld buildWorld, boolean save);
+
+ /**
+ * Teleport a player to a {@link BuildWorld}.
+ *
+ * @param player The player to be teleported
+ * @param worldName The name of the world
+ */
+ void teleport(Player player, String worldName);
+
+ /**
+ * Checks if the provided player is allowed to enter the {@link BuildWorld}.
+ *
+ * @param player The player
+ * @param buildWorld The world
+ * @return {@code true} if the player is allowed to enter, otherwise {@code false}
+ */
+ boolean canEnter(Player player, BuildWorld buildWorld);
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/Visibility.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/Visibility.java
new file mode 100644
index 00000000..13a01310
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/Visibility.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world.data;
+
+public enum Visibility {
+ /**
+ * Public worlds are displayed in the world navigator.
+ */
+ PUBLIC,
+
+ /**
+ * Private worlds are displayed in an extra menu - the private world navigator.
+ */
+ PRIVATE,
+
+ /**
+ * Used for when the visibility of a world can be ignored.
+ */
+ IGNORE;
+
+ public static Visibility matchVisibility(boolean isPrivateWorld) {
+ return isPrivateWorld ? PRIVATE : PUBLIC;
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldData.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldData.java
new file mode 100644
index 00000000..c2013dcc
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldData.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world.data;
+
+import com.cryptomorin.xseries.XMaterial;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import org.bukkit.Difficulty;
+import org.bukkit.Location;
+import org.jetbrains.annotations.Nullable;
+
+public interface WorldData {
+
+ /**
+ * Gets the {@link BuildWorld}'s custom spawn in the format {@code x;y;z;yaw;pitch}.
+ *
+ * @return The custom spawn as a string
+ * @see #getCustomSpawnLocation()
+ */
+ Type customSpawn();
+
+ /**
+ * Gets the {@link BuildWorld}'s custom spawn as a location.
+ *
+ * @return The custom spawn as a location
+ */
+ @Nullable
+ Location getCustomSpawnLocation();
+
+ /**
+ * Gets the permission needed to enter the {@link BuildWorld}.
+ *
+ * @return The permission
+ */
+ Type permission();
+
+ /**
+ * Gets the project description of the {@link BuildWorld}.
+ *
+ * @return The project description
+ */
+ Type project();
+
+ /**
+ * Gets the difficulty of the {@link BuildWorld}.
+ *
+ * @return The bukkit world's difficulty
+ */
+ Type difficulty();
+
+ /**
+ * Gets the material used to display the {@link BuildWorld} in the navigator.
+ *
+ * @return The material
+ */
+ Type material();
+
+ /**
+ * Gets the current status of the {@link BuildWorld}.
+ *
+ * @return The current status
+ */
+ Type status();
+
+ /**
+ * Gets whether blocks can be broken in the {@link BuildWorld}.
+ *
+ * @return {@code true} if allowed, otherwise {@code false}
+ */
+ Type blockBreaking();
+
+ /**
+ * Gets whether blocks interaction are enabled in the {@link BuildWorld}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ Type blockInteractions();
+
+ /**
+ * Gets whether blocks can be placed in the {@link BuildWorld}.
+ *
+ * @return {@code true} if allowed, otherwise {@code false}
+ */
+ Type blockPlacement();
+
+ /**
+ * Gets whether the "builders feature" is enabled in the {@link BuildWorld}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ Type buildersEnabled();
+
+ /**
+ * Gets whether explosions are enabled in the {@link BuildWorld}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ Type explosions();
+
+ /**
+ * Gets whether entities have an AI in the {@link BuildWorld}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ Type mobAi();
+
+ /**
+ * Gets whether physics is applied to blocks in the {@link BuildWorld}.
+ *
+ * @return {@code true} if enabled, otherwise {@code false}
+ */
+ Type physics();
+
+ /**
+ * Gets whether the visibility of the {@link BuildWorld} is set to private.
+ *
+ * @return {@code true} if private, otherwise {@code false}
+ */
+ Type privateWorld();
+
+ /**
+ * Gets the timestamp of the last time the {@link BuildWorld} was last edited.
+ *
+ * @return The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
+ */
+ Type lastEdited();
+
+ /**
+ * Gets the timestamp of the last time the {@link BuildWorld} was last loaded.
+ *
+ * @return The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
+ */
+ Type lastLoaded();
+
+ /**
+ * Gets the timestamp of the last time the {@link BuildWorld} was last unloaded.
+ *
+ * @return The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
+ */
+ Type lastUnloaded();
+
+ interface Type {
+
+ /**
+ * Gets the current value.
+ *
+ * @return The current value
+ */
+ T get();
+
+ /**
+ * Sets the current value.
+ *
+ * @param value The value to set to
+ */
+ void set(T value);
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/world/data/WorldStatus.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldStatus.java
similarity index 62%
rename from buildsystem-core/src/main/java/de/eintosti/buildsystem/world/data/WorldStatus.java
rename to buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldStatus.java
index 8e5e291b..3d3ca3b8 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/world/data/WorldStatus.java
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldStatus.java
@@ -1,15 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-package de.eintosti.buildsystem.world.data;
+package de.eintosti.buildsystem.api.world.data;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.world.BuildWorld;
-import org.bukkit.entity.Player;
+import de.eintosti.buildsystem.api.world.BuildWorld;
public enum WorldStatus {
@@ -45,22 +53,21 @@ public enum WorldStatus {
*/
HIDDEN("status_hidden", 6);
- private final String typeNameKey;
+ private final String key;
private final int stage;
- WorldStatus(String typeNameKey, int stage) {
- this.typeNameKey = typeNameKey;
+ WorldStatus(String key, int stage) {
+ this.key = key;
this.stage = stage;
}
/**
* Gets the display name of the status.
*
- * @param player The player to parse the placeholders against
* @return The type's display name
*/
- public String getName(Player player) {
- return Messages.getString(typeNameKey, player);
+ public String getKey() {
+ return key;
}
/**
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/world/data/WorldType.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldType.java
similarity index 60%
rename from buildsystem-core/src/main/java/de/eintosti/buildsystem/world/data/WorldType.java
rename to buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldType.java
index a1769fea..9a0728b8 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/world/data/WorldType.java
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/WorldType.java
@@ -1,15 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-package de.eintosti.buildsystem.world.data;
+package de.eintosti.buildsystem.api.world.data;
-import de.eintosti.buildsystem.Messages;
import org.bukkit.World.Environment;
-import org.bukkit.entity.Player;
public enum WorldType {
/**
@@ -62,22 +70,18 @@ public enum WorldType {
*/
UNKNOWN(null);
- private final String typeNameKey;
+ private final String key;
- WorldType(String typeNameKey) {
- this.typeNameKey = typeNameKey;
+ WorldType(String key) {
+ this.key = key;
}
/**
* Get the display name of the {@link WorldType}.
*
- * @param player The player to parse the placeholders against
* @return The type's display name
*/
- public String getName(Player player) {
- if (typeNameKey == null) {
- return "-";
- }
- return Messages.getString(typeNameKey, player);
+ public String getKey() {
+ return key;
}
}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/package-info.java
new file mode 100644
index 00000000..bb0a1b75
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/data/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Classes relevant to storing {@link de.eintosti.buildsystem.api.world.data.WorldData}.
+ */
+package de.eintosti.buildsystem.api.world.data;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/CustomGenerator.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/CustomGenerator.java
new file mode 100644
index 00000000..cb9e9a72
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/CustomGenerator.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world.generator;
+
+import org.bukkit.generator.ChunkGenerator;
+
+public interface CustomGenerator {
+
+ /**
+ * Gets the name of the chunk generator.
+ *
+ * @return The name
+ */
+ String getName();
+
+ /**
+ * Gets the chunk generator.
+ *
+ * @return The chunk generator
+ */
+ ChunkGenerator getChunkGenerator();
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/Generator.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/Generator.java
new file mode 100644
index 00000000..4d4aea35
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/Generator.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api.world.generator;
+
+public enum Generator {
+ /**
+ * A normal world
+ */
+ NORMAL,
+
+ /**
+ * A flat world
+ */
+ FLAT,
+
+ /**
+ * A void world
+ */
+ VOID,
+
+ /**
+ * A custom world
+ */
+ CUSTOM;
+}
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/package-info.java
new file mode 100644
index 00000000..b51f461f
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/generator/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Classes relevant to world generation.
+ */
+package de.eintosti.buildsystem.api.world.generator;
\ No newline at end of file
diff --git a/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/package-info.java b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/package-info.java
new file mode 100644
index 00000000..ce313a6e
--- /dev/null
+++ b/buildsystem-api/src/main/java/de/eintosti/buildsystem/api/world/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * {@link de.eintosti.buildsystem.api.world.BuildWorld} functionality.
+ */
+package de.eintosti.buildsystem.api.world;
\ No newline at end of file
diff --git a/buildsystem-core/build.gradle.kts b/buildsystem-core/build.gradle.kts
index fea4cc30..95126e34 100644
--- a/buildsystem-core/build.gradle.kts
+++ b/buildsystem-core/build.gradle.kts
@@ -23,6 +23,7 @@ repositories {
}
dependencies {
+ api(project(":buildsystem-api"))
project.project(":buildsystem-abstraction").subprojects.forEach {
implementation(project(it.path))
}
@@ -31,11 +32,14 @@ dependencies {
compileOnly(libs.authlib)
compileOnly(libs.paperlib)
compileOnly(libs.luckperms)
- compileOnly(libs.placeholderapi)
+ compileOnly(libs.placeholderapi) { isTransitive = false }
compileOnly(libs.worldedit)
compileOnly(libs.annotations)
implementation(libs.paperlib)
+ implementation(libs.adventure.api)
+ implementation(libs.adventure.minimessage)
+ implementation(libs.adventure.platform)
implementation(libs.xseries) { isTransitive = false }
implementation(libs.fastboard)
implementation(libs.nbt) { isTransitive = false }
@@ -60,11 +64,12 @@ tasks {
archiveFileName.set("${rootProject.name}-${project.version}.jar")
val shadePath = "de.eintosti.buildsystem.util.external"
- relocate("io.papermc.lib", "$shadePath.paperlib")
relocate("com.cryptomorin.xseries", "$shadePath.xseries")
- relocate("fr.mrmicky.fastboard", "$shadePath.fastboard")
relocate("dev.dewy.nbt", "$shadePath.nbt")
+ relocate("fr.mrmicky.fastboard", "$shadePath.fastboard")
+ relocate("io.papermc.lib", "$shadePath.paperlib")
relocate("org.bstats", "$shadePath.bstats")
+ relocate("net.kyori.adventure", "$shadePath.adventure")
}
processResources {
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/BuildSystem.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/BuildSystemPlugin.java
similarity index 83%
rename from buildsystem-core/src/main/java/de/eintosti/buildsystem/BuildSystem.java
rename to buildsystem-core/src/main/java/de/eintosti/buildsystem/BuildSystemPlugin.java
index 369ddac1..027e5ef9 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/BuildSystem.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/BuildSystemPlugin.java
@@ -1,12 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem;
+import de.eintosti.buildsystem.api.BuildSystem;
+import de.eintosti.buildsystem.api.BuildSystemApi;
+import de.eintosti.buildsystem.api.settings.NavigatorType;
import de.eintosti.buildsystem.command.BackCommand;
import de.eintosti.buildsystem.command.BlocksCommand;
import de.eintosti.buildsystem.command.BuildCommand;
@@ -29,19 +42,20 @@
import de.eintosti.buildsystem.expansion.placeholderapi.PlaceholderApiExpansion;
import de.eintosti.buildsystem.internal.CraftBukkitVersion;
import de.eintosti.buildsystem.listener.*;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.messages.MessagesProvider;
import de.eintosti.buildsystem.navigator.ArmorStandManager;
import de.eintosti.buildsystem.navigator.inventory.ArchiveInventory;
import de.eintosti.buildsystem.navigator.inventory.NavigatorInventory;
import de.eintosti.buildsystem.navigator.inventory.PrivateInventory;
import de.eintosti.buildsystem.navigator.inventory.WorldsInventory;
-import de.eintosti.buildsystem.navigator.settings.NavigatorType;
import de.eintosti.buildsystem.player.BlocksInventory;
-import de.eintosti.buildsystem.player.BuildPlayer;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import de.eintosti.buildsystem.player.LogoutLocation;
-import de.eintosti.buildsystem.player.PlayerManager;
+import de.eintosti.buildsystem.settings.CraftSettings;
import de.eintosti.buildsystem.settings.DesignInventory;
import de.eintosti.buildsystem.settings.NoClipManager;
-import de.eintosti.buildsystem.settings.Settings;
import de.eintosti.buildsystem.settings.SettingsInventory;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.settings.SpeedInventory;
@@ -59,16 +73,17 @@
import de.eintosti.buildsystem.version.customblocks.CustomBlocks;
import de.eintosti.buildsystem.version.gamerules.GameRules;
import de.eintosti.buildsystem.version.util.MinecraftVersion;
-import de.eintosti.buildsystem.world.BuildWorld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import de.eintosti.buildsystem.world.SpawnManager;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.StatusInventory;
import de.eintosti.buildsystem.world.modification.BuilderInventory;
import de.eintosti.buildsystem.world.modification.CreateInventory;
import de.eintosti.buildsystem.world.modification.DeleteInventory;
import de.eintosti.buildsystem.world.modification.EditInventory;
import de.eintosti.buildsystem.world.modification.GameRuleInventory;
import de.eintosti.buildsystem.world.modification.SetupInventory;
+import de.eintosti.buildsystem.world.modification.StatusInventory;
+import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.AdvancedPie;
import org.bstats.charts.SimplePie;
@@ -77,14 +92,16 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
+import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
+import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
-public class BuildSystem extends JavaPlugin {
+public class BuildSystemPlugin extends JavaPlugin {
public static final int SPIGOT_ID = 60441;
public static final int METRICS_ID = 7427;
@@ -95,10 +112,10 @@ public class BuildSystem extends JavaPlugin {
private ArmorStandManager armorStandManager;
private InventoryUtils inventoryUtils;
private NoClipManager noClipManager;
- private PlayerManager playerManager;
+ private BuildPlayerManager playerManager;
private SettingsManager settingsManager;
private SpawnManager spawnManager;
- private WorldManager worldManager;
+ private BuildWorldManager worldManager;
private ArchiveInventory archiveInventory;
private BlocksInventory blocksInventory;
@@ -123,16 +140,19 @@ public class BuildSystem extends JavaPlugin {
private LuckPermsExpansion luckPermsExpansion;
private PlaceholderApiExpansion placeholderApiExpansion;
+ private BuildSystemApi api;
+ private BukkitAudiences adventure;
+
@Override
public void onLoad() {
createTemplateFolder();
- Messages.createMessageFile();
+ new MessagesProvider(this).setup();
}
@Override
public void onEnable() {
- this.getConfig().options().copyDefaults(true);
- this.saveConfig();
+ getConfig().options().copyDefaults(true);
+ saveConfig();
this.configValues = new ConfigValues(this);
initClasses();
@@ -146,20 +166,25 @@ public void onEnable() {
registerListeners();
registerExpansions();
- performUpdateCheck();
+ this.worldManager.load();
+ this.playerManager.load();
+ this.spawnManager.load();
+
+ this.api = new BuildSystemApi(this);
+ this.api.register();
+ getServer().getServicesManager().register(BuildSystem.class, api, this, ServicePriority.Normal);
- worldManager.load();
- playerManager.load();
- spawnManager.load();
+ this.adventure = BukkitAudiences.create(this);
Bukkit.getOnlinePlayers().forEach(pl -> {
- BuildPlayer buildPlayer = playerManager.createBuildPlayer(pl);
- Settings settings = buildPlayer.getSettings();
+ CraftBuildPlayer buildPlayer = playerManager.createBuildPlayer(pl);
+ CraftSettings settings = buildPlayer.getSettings();
settingsManager.startScoreboard(pl, settings);
noClipManager.startNoClip(pl, settings);
});
registerStats();
+ performUpdateCheck();
Bukkit.getConsoleSender().sendMessage(String.format("%sBuildSystem » Plugin %senabled%s!", ChatColor.RESET, ChatColor.GREEN, ChatColor.RESET));
}
@@ -167,26 +192,33 @@ public void onEnable() {
@Override
public void onDisable() {
Bukkit.getOnlinePlayers().forEach(pl -> {
- BuildPlayer buildPlayer = playerManager.getBuildPlayer(pl);
+ CraftBuildPlayer buildPlayer = this.playerManager.getBuildPlayer(pl);
buildPlayer.getCachedValues().resetCachedValues(pl);
buildPlayer.setLogoutLocation(new LogoutLocation(pl.getWorld().getName(), pl.getLocation()));
- settingsManager.stopScoreboard(pl);
- noClipManager.stopNoClip(pl.getUniqueId());
- playerManager.closeNavigator(pl);
+ this.settingsManager.stopScoreboard(pl);
+ this.noClipManager.stopNoClip(pl.getUniqueId());
+ this.playerManager.closeNavigator(pl);
});
reloadConfig();
reloadConfigData(false);
saveConfig();
- worldManager.save();
- playerManager.save();
- spawnManager.save();
- inventoryUtils.save();
+ this.worldManager.save();
+ this.playerManager.save();
+ this.spawnManager.save();
+ this.inventoryUtils.save();
unregisterExpansions();
+ this.api.unregister();
+
+ if (this.adventure != null) {
+ this.adventure.close();
+ this.adventure = null;
+ }
+
Bukkit.getConsoleSender().sendMessage(String.format("%sBuildSystem » Plugin %sdisabled%s!", ChatColor.RESET, ChatColor.RED, ChatColor.RESET));
}
@@ -212,12 +244,12 @@ private boolean initVersionedClasses() {
private void initClasses() {
this.armorStandManager = new ArmorStandManager();
- this.playerManager = new PlayerManager(this);
+ this.playerManager = new BuildPlayerManager(this);
this.inventoryUtils = new InventoryUtils(this);
this.inventoryUtils.loadTypes();
this.inventoryUtils.loadStatus();
this.noClipManager = new NoClipManager(this);
- this.worldManager = new WorldManager(this);
+ this.worldManager = new BuildWorldManager(this);
this.settingsManager = new SettingsManager(this);
this.spawnManager = new SpawnManager(this);
@@ -353,6 +385,13 @@ private void unregisterExpansions() {
}
}
+ public @NonNull BukkitAudiences adventure() {
+ if (this.adventure == null) {
+ throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
+ }
+ return this.adventure;
+ }
+
private void performUpdateCheck() {
if (!configValues.isUpdateChecker()) {
return;
@@ -387,7 +426,7 @@ private void createTemplateFolder() {
}
public void sendPermissionMessage(CommandSender sender) {
- Messages.sendMessage(sender, "no_permissions");
+ MessagesOld.sendMessage(sender, "no_permissions");
}
public void reloadConfigData(boolean init) {
@@ -395,12 +434,12 @@ public void reloadConfigData(boolean init) {
getSettingsManager().stopScoreboard(pl);
}
- configValues.setConfigValues();
+ this.configValues.setConfigValues();
if (init) {
initVersionedClasses();
- worldManager.getBuildWorlds().forEach(BuildWorld::manageUnload);
- if (configValues.isScoreboard()) {
+ this.worldManager.getCraftBuildWorlds().forEach(CraftBuildWorld::manageUnload);
+ if (this.configValues.isScoreboard()) {
getSettingsManager().startScoreboard();
} else {
getSettingsManager().stopScoreboard();
@@ -420,7 +459,7 @@ public InventoryUtils getInventoryUtil() {
return inventoryUtils;
}
- public PlayerManager getPlayerManager() {
+ public BuildPlayerManager getPlayerManager() {
return playerManager;
}
@@ -436,7 +475,7 @@ public SpawnManager getSpawnManager() {
return spawnManager;
}
- public WorldManager getWorldManager() {
+ public BuildWorldManager getWorldManager() {
return worldManager;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/api/BuildSystemApi.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/api/BuildSystemApi.java
new file mode 100644
index 00000000..8f457d5e
--- /dev/null
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/api/BuildSystemApi.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.api;
+
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.player.PlayerManager;
+import de.eintosti.buildsystem.api.world.WorldManager;
+
+public class BuildSystemApi implements BuildSystem {
+
+ private final BuildSystemPlugin plugin;
+
+ public BuildSystemApi(BuildSystemPlugin plugin) {
+ this.plugin = plugin;
+ }
+
+ @Override
+ public WorldManager getWorldManager() {
+ return plugin.getWorldManager();
+ }
+
+ @Override
+ public PlayerManager getPlayerManager() {
+ return plugin.getPlayerManager();
+ }
+
+ public void register() {
+ BuildSystemProvider.register(this);
+ }
+
+ public void unregister() {
+ BuildSystemProvider.unregister();
+ }
+}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BackCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BackCommand.java
index b059b8f4..93a0e8f7 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BackCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BackCommand.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.player.BuildPlayer;
-import de.eintosti.buildsystem.player.PlayerManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import io.papermc.lib.PaperLib;
import org.bukkit.Location;
import org.bukkit.command.Command;
@@ -24,10 +34,10 @@
public class BackCommand implements CommandExecutor {
- private final BuildSystem plugin;
- private final PlayerManager playerManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildPlayerManager playerManager;
- public BackCommand(BuildSystem plugin) {
+ public BackCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.playerManager = plugin.getPlayerManager();
plugin.getCommand("back").setExecutor(this);
@@ -36,7 +46,7 @@ public BackCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -49,7 +59,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
if (args.length == 0) {
teleportBack(player);
} else {
- Messages.sendMessage(player, "back_usage");
+ MessagesOld.sendMessage(player, "back_usage");
}
return true;
@@ -57,11 +67,11 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
private void teleportBack(Player player) {
UUID playerUuid = player.getUniqueId();
- BuildPlayer buildPlayer = playerManager.getBuildPlayer(playerUuid);
+ CraftBuildPlayer buildPlayer = playerManager.getBuildPlayer(playerUuid);
Location previousLocation = buildPlayer.getPreviousLocation();
if (previousLocation == null) {
- Messages.sendMessage(player, "back_failed");
+ MessagesOld.sendMessage(player, "back_failed");
return;
}
@@ -71,7 +81,7 @@ private void teleportBack(Player player) {
return;
}
XSound.ENTITY_ZOMBIE_INFECT.play(player);
- Messages.sendMessage(player, "back_teleported");
+ MessagesOld.sendMessage(player, "back_teleported");
buildPlayer.setPreviousLocation(null);
});
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BlocksCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BlocksCommand.java
index f996df37..aadd501f 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BlocksCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BlocksCommand.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -17,9 +27,9 @@
public class BlocksCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public BlocksCommand(BuildSystem plugin) {
+ public BlocksCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("blocks").setExecutor(this);
}
@@ -27,7 +37,7 @@ public BlocksCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildCommand.java
index de6d4ee1..d25dc110 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildCommand.java
@@ -1,18 +1,28 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.player.BuildPlayer;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import de.eintosti.buildsystem.player.CachedValues;
-import de.eintosti.buildsystem.player.PlayerManager;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@@ -26,10 +36,10 @@
public class BuildCommand implements CommandExecutor {
- private final BuildSystem plugin;
- private final PlayerManager playerManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildPlayerManager playerManager;
- public BuildCommand(BuildSystem plugin) {
+ public BuildCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.playerManager = plugin.getPlayerManager();
plugin.getCommand("build").setExecutor(this);
@@ -38,7 +48,7 @@ public BuildCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -62,7 +72,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
Player target = Bukkit.getPlayer(args[0]);
if (target == null) {
- Messages.sendMessage(player, "build_player_not_found");
+ MessagesOld.sendMessage(player, "build_player_not_found");
return true;
}
@@ -71,7 +81,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
}
default: {
- Messages.sendMessage(player, "build_usage");
+ MessagesOld.sendMessage(player, "build_usage");
break;
}
}
@@ -81,7 +91,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
private void toggleBuildMode(Player target, Player sender, boolean self) {
UUID targetUuid = target.getUniqueId();
- BuildPlayer buildPlayer = playerManager.getBuildPlayer(targetUuid);
+ CraftBuildPlayer buildPlayer = playerManager.getBuildPlayer(targetUuid);
CachedValues cachedValues = buildPlayer.getCachedValues();
if (playerManager.getBuildModePlayers().remove(targetUuid)) {
@@ -90,11 +100,11 @@ private void toggleBuildMode(Player target, Player sender, boolean self) {
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(target);
if (self) {
- Messages.sendMessage(target, "build_deactivated_self");
+ MessagesOld.sendMessage(target, "build_deactivated_self");
} else {
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(sender);
- Messages.sendMessage(sender, "build_deactivated_other_sender", new AbstractMap.SimpleEntry<>("%target%", target.getName()));
- Messages.sendMessage(target, "build_deactivated_other_target", new AbstractMap.SimpleEntry<>("%sender%", sender.getName()));
+ MessagesOld.sendMessage(sender, "build_deactivated_other_sender", new AbstractMap.SimpleEntry<>("%target%", target.getName()));
+ MessagesOld.sendMessage(target, "build_deactivated_other_target", new AbstractMap.SimpleEntry<>("%sender%", sender.getName()));
}
} else {
playerManager.getBuildModePlayers().add(targetUuid);
@@ -104,11 +114,11 @@ private void toggleBuildMode(Player target, Player sender, boolean self) {
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(target);
if (self) {
- Messages.sendMessage(target, "build_activated_self");
+ MessagesOld.sendMessage(target, "build_activated_self");
} else {
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(sender);
- Messages.sendMessage(sender, "build_activated_other_sender", new AbstractMap.SimpleEntry<>("%target%", target.getName()));
- Messages.sendMessage(target, "build_activated_other_target", new AbstractMap.SimpleEntry<>("%sender%", sender.getName()));
+ MessagesOld.sendMessage(sender, "build_activated_other_sender", new AbstractMap.SimpleEntry<>("%target%", target.getName()));
+ MessagesOld.sendMessage(target, "build_activated_other_target", new AbstractMap.SimpleEntry<>("%sender%", sender.getName()));
}
}
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildSystemCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildSystemCommand.java
index d60a63cb..806aadeb 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildSystemCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/BuildSystemCommand.java
@@ -1,15 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
import com.google.common.collect.Lists;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -21,9 +31,9 @@
public class BuildSystemCommand extends PagedCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public BuildSystemCommand(BuildSystem plugin) {
+ public BuildSystemCommand(BuildSystemPlugin plugin) {
super("buildsystem_permission", "buildsystem_title_with_page");
this.plugin = plugin;
@@ -33,7 +43,7 @@ public BuildSystemCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
Player player = (Player) sender;
@@ -45,10 +55,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
int page = Integer.parseInt(args[0]);
sendMessage(player, page);
} catch (NumberFormatException e) {
- Messages.sendMessage(player, "buildsystem_invalid_page");
+ MessagesOld.sendMessage(player, "buildsystem_invalid_page");
}
} else {
- Messages.sendMessage(player, "buildsystem_usage");
+ MessagesOld.sendMessage(player, "buildsystem_usage");
}
return true;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ConfigCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ConfigCommand.java
index a57f0aad..757d65d5 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ConfigCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ConfigCommand.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -16,9 +26,9 @@
public class ConfigCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public ConfigCommand(BuildSystem plugin) {
+ public ConfigCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("config").setExecutor(this);
}
@@ -31,7 +41,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
}
if (args.length != 1) {
- Messages.sendMessage(sender, "config_usage");
+ MessagesOld.sendMessage(sender, "config_usage");
return true;
}
@@ -40,10 +50,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
case "reload":
plugin.reloadConfig();
plugin.reloadConfigData(true);
- Messages.sendMessage(sender, "config_reloaded");
+ MessagesOld.sendMessage(sender, "config_reloaded");
break;
default:
- Messages.sendMessage(sender, "config_usage");
+ MessagesOld.sendMessage(sender, "config_usage");
break;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ExplosionsCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ExplosionsCommand.java
index fd49b521..4e61cf61 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ExplosionsCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/ExplosionsCommand.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
@@ -24,10 +34,10 @@
public class ExplosionsCommand implements CommandExecutor {
- private final BuildSystem plugin;
- private final WorldManager worldManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildWorldManager worldManager;
- public ExplosionsCommand(BuildSystem plugin) {
+ public ExplosionsCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.worldManager = plugin.getWorldManager();
plugin.getCommand("explosions").setExecutor(this);
@@ -36,7 +46,7 @@ public ExplosionsCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -55,7 +65,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
toggleExplosions(player, Bukkit.getWorld(args[0]));
break;
default:
- Messages.sendMessage(player, "explosions_usage");
+ MessagesOld.sendMessage(player, "explosions_usage");
break;
}
@@ -64,23 +74,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
private void toggleExplosions(Player player, World bukkitWorld) {
if (bukkitWorld == null) {
- Messages.sendMessage(player, "explosions_unknown_world");
+ MessagesOld.sendMessage(player, "explosions_unknown_world");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
- Messages.sendMessage(player, "explosions_world_not_imported");
+ MessagesOld.sendMessage(player, "explosions_world_not_imported");
return;
}
WorldData worldData = buildWorld.getData();
if (!worldData.explosions().get()) {
worldData.explosions().set(true);
- Messages.sendMessage(player, "explosions_activated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "explosions_activated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
} else {
worldData.explosions().set(false);
- Messages.sendMessage(player, "explosions_deactivated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "explosions_deactivated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/GamemodeCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/GamemodeCommand.java
index 19cd50de..3810e73c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/GamemodeCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/GamemodeCommand.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
@@ -21,9 +31,9 @@
public class GamemodeCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public GamemodeCommand(BuildSystem plugin) {
+ public GamemodeCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("gamemode").setExecutor(this);
}
@@ -31,7 +41,7 @@ public GamemodeCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -46,22 +56,22 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
case "survival":
case "s":
case "0":
- setGamemode(player, args, GameMode.SURVIVAL, Messages.getString("gamemode_survival", player));
+ setGamemode(player, args, GameMode.SURVIVAL, MessagesOld.getString("gamemode_survival", player));
break;
case "creative":
case "c":
case "1":
- setGamemode(player, args, GameMode.CREATIVE, Messages.getString("gamemode_creative", player));
+ setGamemode(player, args, GameMode.CREATIVE, MessagesOld.getString("gamemode_creative", player));
break;
case "adventure":
case "a":
case "2":
- setGamemode(player, args, GameMode.ADVENTURE, Messages.getString("gamemode_adventure", player));
+ setGamemode(player, args, GameMode.ADVENTURE, MessagesOld.getString("gamemode_adventure", player));
break;
case "spectator":
case "sp":
case "3":
- setGamemode(player, args, GameMode.SPECTATOR, Messages.getString("gamemode_spectator", player));
+ setGamemode(player, args, GameMode.SPECTATOR, MessagesOld.getString("gamemode_spectator", player));
break;
default:
sendUsageMessage(player);
@@ -86,7 +96,7 @@ private void setGamemode(Player player, String[] args, GameMode gameMode, String
}
private void sendUsageMessage(Player player) {
- Messages.sendMessage(player, "gamemode_usage");
+ MessagesOld.sendMessage(player, "gamemode_usage");
}
private void setPlayerGamemode(Player player, GameMode gameMode, String gameModeName) {
@@ -96,7 +106,7 @@ private void setPlayerGamemode(Player player, GameMode gameMode, String gameMode
}
player.setGameMode(gameMode);
- Messages.sendMessage(player, "gamemode_set_self", new AbstractMap.SimpleEntry<>("%gamemode%", gameModeName));
+ MessagesOld.sendMessage(player, "gamemode_set_self", new AbstractMap.SimpleEntry<>("%gamemode%", gameModeName));
}
private void setTargetGamemode(Player player, String[] args, GameMode gameMode, String gameModeName) {
@@ -107,13 +117,13 @@ private void setTargetGamemode(Player player, String[] args, GameMode gameMode,
Player target = Bukkit.getPlayerExact(args[1]);
if (target == null) {
- Messages.sendMessage(player, "gamemode_player_not_found");
+ MessagesOld.sendMessage(player, "gamemode_player_not_found");
return;
}
target.setGameMode(gameMode);
- Messages.sendMessage(target, "gamemode_set_self", new AbstractMap.SimpleEntry<>("%gamemode%", gameModeName));
- Messages.sendMessage(player, "gamemode_set_other",
+ MessagesOld.sendMessage(target, "gamemode_set_self", new AbstractMap.SimpleEntry<>("%gamemode%", gameModeName));
+ MessagesOld.sendMessage(player, "gamemode_set_other",
new AbstractMap.SimpleEntry<>("%target%", target.getName()),
new AbstractMap.SimpleEntry<>("%gamemode%", gameModeName)
);
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/NoAICommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/NoAICommand.java
index 60a06d31..6647e93e 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/NoAICommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/NoAICommand.java
@@ -1,18 +1,28 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.util.EntityAIManager;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
@@ -27,10 +37,10 @@
public class NoAICommand implements CommandExecutor {
- private final BuildSystem plugin;
- private final WorldManager worldManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildWorldManager worldManager;
- public NoAICommand(BuildSystem plugin) {
+ public NoAICommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.worldManager = plugin.getWorldManager();
plugin.getCommand("noai").setExecutor(this);
@@ -39,7 +49,7 @@ public NoAICommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -58,7 +68,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
toggleAI(player, Bukkit.getWorld(args[0]));
break;
default:
- Messages.sendMessage(player, "noai_usage");
+ MessagesOld.sendMessage(player, "noai_usage");
break;
}
@@ -67,23 +77,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
private void toggleAI(Player player, World bukkitWorld) {
if (bukkitWorld == null) {
- Messages.sendMessage(player, "noai_unknown_world");
+ MessagesOld.sendMessage(player, "noai_unknown_world");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
- Messages.sendMessage(player, "noai_world_not_imported");
+ MessagesOld.sendMessage(player, "noai_world_not_imported");
return;
}
WorldData worldData = buildWorld.getData();
if (worldData.mobAi().get()) {
worldData.mobAi().set(false);
- Messages.sendMessage(player, "noai_activated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "noai_activated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
} else {
worldData.mobAi().set(true);
- Messages.sendMessage(player, "noai_deactivated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "noai_deactivated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
boolean mobAI = worldData.mobAi().get();
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PagedCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PagedCommand.java
index 722052c8..864aaf54 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PagedCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PagedCommand.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.messages.MessagesOld;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
@@ -36,7 +46,7 @@ protected void sendMessage(Player player, int pageNum) {
List page = createPage(commands, numPages, pageNum);
page.add(0, new TextComponent("§7§m----------------------------------------------------"));
- page.add(1, new TextComponent(Messages.getString(this.title, player)
+ page.add(1, new TextComponent(MessagesOld.getString(this.title, player)
.replace("%page%", String.valueOf(pageNum))
.replace("%max%", String.valueOf(numPages))
.concat("\n"))
@@ -71,12 +81,12 @@ protected TextComponent createComponent(Player player, String commandKey, String
return new TextComponent();
}
- TextComponent commandComponent = new TextComponent("§b" + Messages.getString(commandKey, player));
+ TextComponent commandComponent = new TextComponent("§b" + MessagesOld.getString(commandKey, player));
TextComponent textComponent = new TextComponent(" §8» " + text);
commandComponent.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, suggest));
commandComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
- new ComponentBuilder(Messages.getString(this.permission, player, new AbstractMap.SimpleEntry<>("%permission%", permission))).create()
+ new ComponentBuilder(MessagesOld.getString(this.permission, player, new AbstractMap.SimpleEntry<>("%permission%", permission))).create()
));
commandComponent.addExtra(textComponent);
return commandComponent;
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PhysicsCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PhysicsCommand.java
index cb775144..0d6fd3c4 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PhysicsCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/PhysicsCommand.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
@@ -24,10 +34,10 @@
public class PhysicsCommand implements CommandExecutor {
- private final BuildSystem plugin;
- private final WorldManager worldManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildWorldManager worldManager;
- public PhysicsCommand(BuildSystem plugin) {
+ public PhysicsCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.worldManager = plugin.getWorldManager();
plugin.getCommand("physics").setExecutor(this);
@@ -36,7 +46,7 @@ public PhysicsCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -55,13 +65,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
//TODO: Check each world for permission individually?
if (args[0].equalsIgnoreCase("all") && worldManager.getBuildWorld("all") == null) {
worldManager.getBuildWorlds().forEach(buildWorld -> buildWorld.getData().physics().set(true));
- Messages.sendMessage(player, "physics_activated_all");
+ MessagesOld.sendMessage(player, "physics_activated_all");
} else {
togglePhysics(player, Bukkit.getWorld(args[0]));
}
break;
default:
- Messages.sendMessage(player, "physics_usage");
+ MessagesOld.sendMessage(player, "physics_usage");
break;
}
return true;
@@ -69,23 +79,23 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
private void togglePhysics(Player player, World bukkitWorld) {
if (bukkitWorld == null) {
- Messages.sendMessage(player, "physics_unknown_world");
+ MessagesOld.sendMessage(player, "physics_unknown_world");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
- Messages.sendMessage(player, "physics_world_not_imported");
+ MessagesOld.sendMessage(player, "physics_world_not_imported");
return;
}
WorldData worldData = buildWorld.getData();
if (!worldData.physics().get()) {
worldData.physics().set(true);
- Messages.sendMessage(player, "physics_activated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "physics_activated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
} else {
worldData.physics().set(false);
- Messages.sendMessage(player, "physics_deactivated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "physics_deactivated", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SettingsCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SettingsCommand.java
index 906ca21f..8ffb0d6d 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SettingsCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SettingsCommand.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -17,9 +27,9 @@
public class SettingsCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public SettingsCommand(BuildSystem plugin) {
+ public SettingsCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("settings").setExecutor(this);
}
@@ -27,7 +37,7 @@ public SettingsCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SetupCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SetupCommand.java
index c145f75f..1d4b5190 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SetupCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SetupCommand.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -17,9 +27,9 @@
public class SetupCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public SetupCommand(BuildSystem plugin) {
+ public SetupCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("setup").setExecutor(this);
}
@@ -27,7 +37,7 @@ public SetupCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SkullCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SkullCommand.java
index dc4546cb..c15014ae 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SkullCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SkullCommand.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.util.InventoryUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -21,10 +31,10 @@
public class SkullCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final InventoryUtils inventoryUtils;
- public SkullCommand(BuildSystem plugin) {
+ public SkullCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.inventoryUtils = plugin.getInventoryUtil();
plugin.getCommand("skull").setExecutor(this);
@@ -33,7 +43,7 @@ public SkullCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -46,21 +56,21 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
switch (args.length) {
case 0:
player.getInventory().addItem(inventoryUtils.getSkull("§b" + player.getName(), player.getName()));
- Messages.sendMessage(player, "skull_player_received", new AbstractMap.SimpleEntry<>("%player%", player.getName()));
+ MessagesOld.sendMessage(player, "skull_player_received", new AbstractMap.SimpleEntry<>("%player%", player.getName()));
break;
case 1:
String skullName = args[0];
if (skullName.length() > 16) {
- ItemStack customSkull = inventoryUtils.getUrlSkull(Messages.getString("custom_skull_item", player), skullName);
+ ItemStack customSkull = inventoryUtils.getUrlSkull(MessagesOld.getString("custom_skull_item", player), skullName);
player.getInventory().addItem(customSkull);
- Messages.sendMessage(player, "skull_custom_received");
+ MessagesOld.sendMessage(player, "skull_custom_received");
} else {
player.getInventory().addItem(inventoryUtils.getSkull("§b" + skullName, skullName));
- Messages.sendMessage(player, "skull_player_received", new AbstractMap.SimpleEntry<>("%player%", skullName));
+ MessagesOld.sendMessage(player, "skull_player_received", new AbstractMap.SimpleEntry<>("%player%", skullName));
}
break;
default:
- Messages.sendMessage(player, "skull_usage");
+ MessagesOld.sendMessage(player, "skull_usage");
break;
}
return true;
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpawnCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpawnCommand.java
index ab91bbe8..725476ea 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpawnCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpawnCommand.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.world.BuildWorld;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import de.eintosti.buildsystem.world.SpawnManager;
-import de.eintosti.buildsystem.world.WorldManager;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
@@ -24,11 +34,11 @@
public class SpawnCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final SpawnManager spawnManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public SpawnCommand(BuildSystem plugin) {
+ public SpawnCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.spawnManager = plugin.getSpawnManager();
this.worldManager = plugin.getWorldManager();
@@ -38,7 +48,7 @@ public SpawnCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -47,15 +57,15 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
switch (args.length) {
case 0:
if (!spawnManager.teleport(player)) {
- Messages.sendMessage(player, "spawn_unavailable");
+ MessagesOld.sendMessage(player, "spawn_unavailable");
} else if (plugin.getConfigValues().isSpawnTeleportMessage()) {
- Messages.sendMessage(player, "spawn_teleported");
+ MessagesOld.sendMessage(player, "spawn_teleported");
}
break;
case 1:
if (!player.hasPermission("buildsystem.spawn")) {
- Messages.sendMessage(player, "spawn_usage");
+ MessagesOld.sendMessage(player, "spawn_usage");
return true;
}
@@ -66,12 +76,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
if (buildWorld == null) {
- Messages.sendMessage(player, "spawn_world_not_imported");
+ MessagesOld.sendMessage(player, "spawn_world_not_imported");
return true;
}
spawnManager.set(playerLocation, buildWorld.getName());
- Messages.sendMessage(player, "spawn_set",
+ MessagesOld.sendMessage(player, "spawn_set",
new AbstractMap.SimpleEntry<>("%x%", round(playerLocation.getX())),
new AbstractMap.SimpleEntry<>("%y%", round(playerLocation.getY())),
new AbstractMap.SimpleEntry<>("%z%", round(playerLocation.getZ())),
@@ -80,17 +90,17 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
break;
case "remove":
spawnManager.remove();
- Messages.sendMessage(player, "spawn_remove");
+ MessagesOld.sendMessage(player, "spawn_remove");
break;
default:
- Messages.sendMessage(player, "spawn_admin");
+ MessagesOld.sendMessage(player, "spawn_admin");
break;
}
break;
default:
String key = player.hasPermission("buildsystem.spawn") ? "spawn_admin" : "spawn_usage";
- Messages.sendMessage(player, key);
+ MessagesOld.sendMessage(player, key);
break;
}
return true;
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpeedCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpeedCommand.java
index c882b00e..e6b06995 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpeedCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/SpeedCommand.java
@@ -1,15 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -20,9 +30,9 @@
public class SpeedCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public SpeedCommand(BuildSystem plugin) {
+ public SpeedCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("speed").setExecutor(this);
}
@@ -30,7 +40,7 @@ public SpeedCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -64,12 +74,12 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
setSpeed(player, 1.0f, speedString);
break;
default:
- Messages.sendMessage(player, "speed_usage");
+ MessagesOld.sendMessage(player, "speed_usage");
break;
}
break;
default:
- Messages.sendMessage(player, "speed_usage");
+ MessagesOld.sendMessage(player, "speed_usage");
break;
}
@@ -79,10 +89,10 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
private void setSpeed(Player player, float speed, String speedString) {
if (player.isFlying()) {
player.setFlySpeed(speed - 0.1f);
- Messages.sendMessage(player, "speed_set_flying", new AbstractMap.SimpleEntry<>("%speed%", speedString));
+ MessagesOld.sendMessage(player, "speed_set_flying", new AbstractMap.SimpleEntry<>("%speed%", speedString));
} else {
player.setWalkSpeed(speed);
- Messages.sendMessage(player, "speed_set_walking", new AbstractMap.SimpleEntry<>("%speed%", speedString));
+ MessagesOld.sendMessage(player, "speed_set_walking", new AbstractMap.SimpleEntry<>("%speed%", speedString));
}
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TimeCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TimeCommand.java
index 96ce498a..ec8a7b59 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TimeCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TimeCommand.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.config.ConfigValues;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
@@ -23,11 +33,11 @@
public class TimeCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final ConfigValues configValues;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public TimeCommand(BuildSystem plugin) {
+ public TimeCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.configValues = plugin.getConfigValues();
this.worldManager = plugin.getWorldManager();
@@ -38,7 +48,7 @@ public TimeCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -56,20 +66,20 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
switch (args.length) {
case 0: {
world.setTime(configValues.getNoonTime());
- Messages.sendMessage(player, "day_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
+ MessagesOld.sendMessage(player, "day_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
break;
}
case 1: {
if (world == null) {
- Messages.sendMessage(player, "day_unknown_world");
+ MessagesOld.sendMessage(player, "day_unknown_world");
return true;
}
world.setTime(configValues.getNoonTime());
- Messages.sendMessage(player, "day_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
+ MessagesOld.sendMessage(player, "day_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
break;
}
default:
- Messages.sendMessage(player, "day_usage");
+ MessagesOld.sendMessage(player, "day_usage");
break;
}
break;
@@ -84,20 +94,20 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
switch (args.length) {
case 0: {
world.setTime(configValues.getNightTime());
- Messages.sendMessage(player, "night_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
+ MessagesOld.sendMessage(player, "night_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
break;
}
case 1: {
if (world == null) {
- Messages.sendMessage(player, "night_unknown_world");
+ MessagesOld.sendMessage(player, "night_unknown_world");
return true;
}
world.setTime(configValues.getNightTime());
- Messages.sendMessage(player, "night_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
+ MessagesOld.sendMessage(player, "night_set", new AbstractMap.SimpleEntry<>("%world%", world.getName()));
break;
}
default:
- Messages.sendMessage(player, "night_usage");
+ MessagesOld.sendMessage(player, "night_usage");
break;
}
break;
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TopCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TopCommand.java
index bafe0172..27ec822c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TopCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/TopCommand.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import io.papermc.lib.PaperLib;
import org.bukkit.Location;
import org.bukkit.command.Command;
@@ -21,10 +31,10 @@
public class TopCommand implements CommandExecutor {
- private final BuildSystem plugin;
- private final WorldManager worldManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildWorldManager worldManager;
- public TopCommand(BuildSystem plugin) {
+ public TopCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.worldManager = plugin.getWorldManager();
plugin.getCommand("top").setExecutor(this);
@@ -33,7 +43,7 @@ public TopCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
@@ -44,7 +54,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
}
if (args.length != 0) {
- Messages.sendMessage(player, "top_usage");
+ MessagesOld.sendMessage(player, "top_usage");
return true;
}
@@ -59,7 +69,7 @@ private void sendToTop(Player player) {
.getLocation();
if (!worldManager.isSafeLocation(blockLocation) || blockLocation.getBlock().getY() < playerLocation.getBlock().getY()) {
- Messages.sendMessage(player, "top_failed");
+ MessagesOld.sendMessage(player, "top_failed");
return;
}
@@ -69,7 +79,7 @@ private void sendToTop(Player player) {
return;
}
XSound.ENTITY_ZOMBIE_INFECT.play(player);
- Messages.sendMessage(player, "top_teleported");
+ MessagesOld.sendMessage(player, "top_teleported");
});
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/WorldsCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/WorldsCommand.java
index 5234a44b..6b6cc649 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/WorldsCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/WorldsCommand.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
import de.eintosti.buildsystem.command.subcommand.worlds.*;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -21,9 +31,9 @@
public class WorldsCommand implements CommandExecutor {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public WorldsCommand(BuildSystem plugin) {
+ public WorldsCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getCommand("worlds").setExecutor(this);
}
@@ -31,7 +41,7 @@ public WorldsCommand(BuildSystem plugin) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
if (!(sender instanceof Player)) {
- plugin.getLogger().warning(Messages.getString("sender_not_player", null));
+ plugin.getLogger().warning(MessagesOld.getString("sender_not_player", null));
return true;
}
Player player = (Player) sender;
@@ -49,7 +59,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
WorldsTabComplete.WorldsArgument argument = WorldsTabComplete.WorldsArgument.matchArgument(args[0]);
if (argument == null) {
- Messages.sendMessage(player, "worlds_unknown_command");
+ MessagesOld.sendMessage(player, "worlds_unknown_command");
return true;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/Argument.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/Argument.java
index fe91b494..db2bb4ca 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/Argument.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/Argument.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand;
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/SubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/SubCommand.java
index ff72b4b6..4f220425 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/SubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/SubCommand.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand;
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/AddBuilderSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/AddBuilderSubCommand.java
index cf9574d7..da6f92cf 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/AddBuilderSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/AddBuilderSubCommand.java
@@ -1,23 +1,33 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.PlayerChatInput;
import de.eintosti.buildsystem.util.UUIDFetcher;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.Builder;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuilder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -26,30 +36,30 @@
public class AddBuilderSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public AddBuilderSubCommand(BuildSystem plugin, String worldName) {
+ public AddBuilderSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_addbuilder_usage");
+ MessagesOld.sendMessage(player, "worlds_addbuilder_usage");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_addbuilder_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_addbuilder_unknown_world");
return;
}
@@ -65,37 +75,37 @@ public void getAddBuilderInput(Player player, BuildWorld buildWorld, boolean clo
new PlayerChatInput(plugin, player, "enter_player_name", input -> {
String builderName = input.trim();
Player builderPlayer = Bukkit.getPlayerExact(builderName);
- Builder builder;
+ CraftBuilder builder;
UUID builderId;
if (builderPlayer == null) {
builderId = UUIDFetcher.getUUID(builderName);
if (builderId == null) {
- Messages.sendMessage(player, "worlds_addbuilder_player_not_found");
+ MessagesOld.sendMessage(player, "worlds_addbuilder_player_not_found");
player.closeInventory();
return;
}
- builder = new Builder(builderId, builderName);
+ builder = new CraftBuilder(builderId, builderName);
} else {
- builder = new Builder(builderPlayer);
+ builder = new CraftBuilder(builderPlayer);
builderId = builderPlayer.getUniqueId();
}
if (builderId.equals(player.getUniqueId()) && buildWorld.isCreator(player)) {
- Messages.sendMessage(player, "worlds_addbuilder_already_creator");
+ MessagesOld.sendMessage(player, "worlds_addbuilder_already_creator");
player.closeInventory();
return;
}
if (buildWorld.isBuilder(builderId)) {
- Messages.sendMessage(player, "worlds_addbuilder_already_added");
+ MessagesOld.sendMessage(player, "worlds_addbuilder_already_added");
player.closeInventory();
return;
}
buildWorld.addBuilder(builder);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
- Messages.sendMessage(player, "worlds_addbuilder_added", new AbstractMap.SimpleEntry<>("%builder%", builderName));
+ MessagesOld.sendMessage(player, "worlds_addbuilder_added", new AbstractMap.SimpleEntry<>("%builder%", builderName));
if (closeInventory) {
player.closeInventory();
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/BuildersSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/BuildersSubCommand.java
index 8365c57c..17ebf9cb 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/BuildersSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/BuildersSubCommand.java
@@ -1,47 +1,57 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.entity.Player;
public class BuildersSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public BuildersSubCommand(BuildSystem plugin, String worldName) {
+ public BuildersSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_builders_usage");
+ MessagesOld.sendMessage(player, "worlds_builders_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_builders_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_builders_unknown_world");
return;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/DeleteSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/DeleteSubCommand.java
index 0cd6754a..c2d6c5b9 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/DeleteSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/DeleteSubCommand.java
@@ -1,47 +1,57 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.entity.Player;
public class DeleteSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public DeleteSubCommand(BuildSystem plugin, String worldName) {
+ public DeleteSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_delete_usage");
+ MessagesOld.sendMessage(player, "worlds_delete_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_delete_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_delete_unknown_world");
return;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/EditSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/EditSubCommand.java
index bbdb99b1..805cc64c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/EditSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/EditSubCommand.java
@@ -1,49 +1,59 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
import com.cryptomorin.xseries.messages.Titles;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.entity.Player;
public class EditSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public EditSubCommand(BuildSystem plugin, String worldName) {
+ public EditSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_edit_usage");
+ MessagesOld.sendMessage(player, "worlds_edit_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_edit_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_edit_unknown_world");
return;
}
@@ -52,7 +62,7 @@ public void execute(Player player, String[] args) {
plugin.getEditInventory().openInventory(player, buildWorld);
} else {
XSound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR.play(player);
- Titles.sendTitle(player, 5, 70, 20, " ", Messages.getString("world_not_loaded", player));
+ Titles.sendTitle(player, 5, 70, 20, " ", MessagesOld.getString("world_not_loaded", player));
}
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/HelpSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/HelpSubCommand.java
index 4c5d4447..18c2f2b4 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/HelpSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/HelpSubCommand.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.google.common.collect.Lists;
-import de.eintosti.buildsystem.Messages;
import de.eintosti.buildsystem.command.PagedCommand;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
@@ -33,10 +43,10 @@ public void execute(Player player, String[] args) {
int page = Integer.parseInt(args[1]);
sendMessage(player, page);
} catch (NumberFormatException e) {
- Messages.sendMessage(player, "worlds_help_invalid_page");
+ MessagesOld.sendMessage(player, "worlds_help_invalid_page");
}
} else {
- Messages.sendMessage(player, "worlds_help_usage");
+ MessagesOld.sendMessage(player, "worlds_help_usage");
}
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportAllSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportAllSubCommand.java
index f8088623..8859145b 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportAllSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportAllSubCommand.java
@@ -1,22 +1,32 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.generator.Generator;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.ArgumentParser;
import de.eintosti.buildsystem.util.UUIDFetcher;
-import de.eintosti.buildsystem.world.Builder;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.generator.Generator;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuilder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -25,9 +35,9 @@
public class ImportAllSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public ImportAllSubCommand(BuildSystem plugin) {
+ public ImportAllSubCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
}
@@ -39,13 +49,13 @@ public void execute(Player player, String[] args) {
}
if (args.length != 1) {
- Messages.sendMessage(player, "worlds_importall_usage");
+ MessagesOld.sendMessage(player, "worlds_importall_usage");
return;
}
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (worldManager.isImportingAllWorlds()) {
- Messages.sendMessage(player, "worlds_importall_already_started");
+ MessagesOld.sendMessage(player, "worlds_importall_already_started");
return;
}
@@ -64,18 +74,18 @@ public void execute(Player player, String[] args) {
});
if (directories == null || directories.length == 0) {
- Messages.sendMessage(player, "worlds_importall_no_worlds");
+ MessagesOld.sendMessage(player, "worlds_importall_no_worlds");
return;
}
ArgumentParser parser = new ArgumentParser(args);
Generator generator = Generator.VOID;
- Builder builder = new Builder(null, "-");
+ CraftBuilder builder = new CraftBuilder(null, "-");
if (parser.isArgument("g")) {
String generatorArg = parser.getValue("g");
if (generatorArg == null) {
- Messages.sendMessage(player, "worlds_importall_usage");
+ MessagesOld.sendMessage(player, "worlds_importall_usage");
return;
}
try {
@@ -87,15 +97,15 @@ public void execute(Player player, String[] args) {
if (parser.isArgument("c")) {
String creatorArg = parser.getValue("c");
if (creatorArg == null) {
- Messages.sendMessage(player, "worlds_importall_usage");
+ MessagesOld.sendMessage(player, "worlds_importall_usage");
return;
}
UUID creatorId = UUIDFetcher.getUUID(creatorArg);
if (creatorId == null) {
- Messages.sendMessage(player, "worlds_importall_player_not_found");
+ MessagesOld.sendMessage(player, "worlds_importall_player_not_found");
return;
}
- builder = new Builder(creatorId, creatorArg);
+ builder = new CraftBuilder(creatorId, creatorArg);
}
worldManager.importWorlds(player, directories, generator, builder);
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportSubCommand.java
index 77606c9d..bcd30bda 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ImportSubCommand.java
@@ -1,23 +1,33 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.generator.Generator;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.ArgumentParser;
import de.eintosti.buildsystem.util.UUIDFetcher;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.Builder;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.generator.Generator;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuilder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -28,10 +38,10 @@
public class ImportSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public ImportSubCommand(BuildSystem plugin, String worldName) {
+ public ImportSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@@ -44,21 +54,21 @@ public void execute(Player player, String[] args) {
}
if (args.length < 2) {
- Messages.sendMessage(player, "worlds_import_usage");
+ MessagesOld.sendMessage(player, "worlds_import_usage");
return;
}
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld != null) {
- Messages.sendMessage(player, "worlds_import_world_is_imported");
+ MessagesOld.sendMessage(player, "worlds_import_world_is_imported");
return;
}
File worldFolder = new File(Bukkit.getWorldContainer(), args[1]);
File levelFile = new File(worldFolder, "level.dat");
if (!worldFolder.isDirectory() || !levelFile.exists()) {
- Messages.sendMessage(player, "worlds_import_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_import_unknown_world");
return;
}
@@ -67,14 +77,14 @@ public void execute(Player player, String[] args) {
.findFirst()
.orElse(null);
if (invalidChar != null) {
- Messages.sendMessage(player, "worlds_import_invalid_character",
+ MessagesOld.sendMessage(player, "worlds_import_invalid_character",
new AbstractMap.SimpleEntry<>("%world%", worldName),
new AbstractMap.SimpleEntry<>("%char%", invalidChar)
);
return;
}
- Builder creator = new Builder(null, "-");
+ CraftBuilder creator = new CraftBuilder(null, "-");
Generator generator = Generator.VOID;
String generatorName = null;
@@ -84,7 +94,7 @@ public void execute(Player player, String[] args) {
if (parser.isArgument("g")) {
String generatorArg = parser.getValue("g");
if (generatorArg == null) {
- Messages.sendMessage(player, "worlds_import_usage");
+ MessagesOld.sendMessage(player, "worlds_import_usage");
return;
}
try {
@@ -98,21 +108,21 @@ public void execute(Player player, String[] args) {
if (parser.isArgument("c")) {
String creatorArg = parser.getValue("c");
if (creatorArg == null) {
- Messages.sendMessage(player, "worlds_import_usage");
+ MessagesOld.sendMessage(player, "worlds_import_usage");
return;
}
UUID creatorId = UUIDFetcher.getUUID(creatorArg);
if (creatorId == null) {
- Messages.sendMessage(player, "worlds_import_player_not_found");
+ MessagesOld.sendMessage(player, "worlds_import_player_not_found");
return;
}
- creator = new Builder(creatorId, creatorArg);
+ creator = new CraftBuilder(creatorId, creatorArg);
}
}
- Messages.sendMessage(player, "worlds_import_started", new AbstractMap.SimpleEntry<>("%world%", worldName));
+ MessagesOld.sendMessage(player, "worlds_import_started", new AbstractMap.SimpleEntry<>("%world%", worldName));
if (worldManager.importWorld(player, worldName, creator, generator, generatorName, true)) {
- Messages.sendMessage(player, "worlds_import_finished");
+ MessagesOld.sendMessage(player, "worlds_import_finished");
}
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/InfoSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/InfoSubCommand.java
index df9ced16..50305ca0 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/InfoSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/InfoSubCommand.java
@@ -1,20 +1,31 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldData;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -22,57 +33,57 @@
public class InfoSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public InfoSubCommand(BuildSystem plugin, String worldName) {
+ public InfoSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_info_usage");
+ MessagesOld.sendMessage(player, "worlds_info_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_info_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_info_unknown_world");
return;
}
//TODO: Print information about the custom generator?
WorldData worldData = buildWorld.getData();
- Messages.sendMessage(player, "world_info",
+ MessagesOld.sendMessage(player, "world_info",
new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()),
new AbstractMap.SimpleEntry<>("%creator%", buildWorld.getCreator()),
new AbstractMap.SimpleEntry<>("%item%", worldData.material().get().name()),
- new AbstractMap.SimpleEntry<>("%type%", buildWorld.getType().getName(player)),
+ new AbstractMap.SimpleEntry<>("%type%", MessagesOld.getDataString(buildWorld.getType().getKey(), player)),
new AbstractMap.SimpleEntry<>("%private%", worldData.privateWorld().get()),
new AbstractMap.SimpleEntry<>("%builders_enabled%", worldData.buildersEnabled().get()),
new AbstractMap.SimpleEntry<>("%builders%", buildWorld.getBuildersInfo(player)),
new AbstractMap.SimpleEntry<>("%block_breaking%", worldData.blockBreaking().get()),
new AbstractMap.SimpleEntry<>("%block_placement%", worldData.blockPlacement().get()),
- new AbstractMap.SimpleEntry<>("%status%", worldData.status().get().getName(player)),
+ new AbstractMap.SimpleEntry<>("%status%", MessagesOld.getDataString(worldData.status().get().getKey(), player)),
new AbstractMap.SimpleEntry<>("%project%", worldData.project().get()),
new AbstractMap.SimpleEntry<>("%permission%", worldData.permission().get()),
new AbstractMap.SimpleEntry<>("%time%", buildWorld.getWorldTime()),
- new AbstractMap.SimpleEntry<>("%creation%", Messages.formatDate(buildWorld.getCreationDate())),
+ new AbstractMap.SimpleEntry<>("%creation%", MessagesOld.formatDate(buildWorld.getCreationDate())),
new AbstractMap.SimpleEntry<>("%physics%", worldData.physics().get()),
new AbstractMap.SimpleEntry<>("%explosions%", worldData.explosions().get()),
new AbstractMap.SimpleEntry<>("%mobai%", worldData.mobAi().get()),
new AbstractMap.SimpleEntry<>("%custom_spawn%", getCustomSpawn(buildWorld)),
- new AbstractMap.SimpleEntry<>("%lastedited%", Messages.formatDate(worldData.lastEdited().get())),
- new AbstractMap.SimpleEntry<>("%lastloaded%", Messages.formatDate(worldData.lastLoaded().get())),
- new AbstractMap.SimpleEntry<>("%lastunloaded%", Messages.formatDate(worldData.lastUnloaded().get()))
+ new AbstractMap.SimpleEntry<>("%lastedited%", MessagesOld.formatDate(worldData.lastEdited().get())),
+ new AbstractMap.SimpleEntry<>("%lastloaded%", MessagesOld.formatDate(worldData.lastLoaded().get())),
+ new AbstractMap.SimpleEntry<>("%lastunloaded%", MessagesOld.formatDate(worldData.lastUnloaded().get()))
);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ItemSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ItemSubCommand.java
index 767b4064..12c68df6 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ItemSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/ItemSubCommand.java
@@ -1,25 +1,35 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class ItemSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public ItemSubCommand(BuildSystem plugin) {
+ public ItemSubCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
}
@@ -30,9 +40,9 @@ public void execute(Player player, String[] args) {
return;
}
- ItemStack navigator = plugin.getInventoryUtil().getItemStack(plugin.getConfigValues().getNavigatorItem(), Messages.getString("navigator_item", player));
+ ItemStack navigator = plugin.getInventoryUtil().getItemStack(plugin.getConfigValues().getNavigatorItem(), MessagesOld.getString("navigator_item", player));
player.getInventory().addItem(navigator);
- Messages.sendMessage(player, "worlds_item_receive");
+ MessagesOld.sendMessage(player, "worlds_item_receive");
}
@Override
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveBuilderSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveBuilderSubCommand.java
index 20e3a392..dc0947ab 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveBuilderSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveBuilderSubCommand.java
@@ -1,22 +1,32 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.PlayerChatInput;
import de.eintosti.buildsystem.util.UUIDFetcher;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -25,30 +35,30 @@
public class RemoveBuilderSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public RemoveBuilderSubCommand(BuildSystem plugin, String worldName) {
+ public RemoveBuilderSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_removebuilder_usage");
+ MessagesOld.sendMessage(player, "worlds_removebuilder_usage");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_removebuilder_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_removebuilder_unknown_world");
return;
}
@@ -64,7 +74,7 @@ private void getRemoveBuilderInput(Player player, BuildWorld buildWorld) {
if (builderPlayer == null) {
builderId = UUIDFetcher.getUUID(builderName);
if (builderId == null) {
- Messages.sendMessage(player, "worlds_removebuilder_player_not_found");
+ MessagesOld.sendMessage(player, "worlds_removebuilder_player_not_found");
player.closeInventory();
return;
}
@@ -73,20 +83,20 @@ private void getRemoveBuilderInput(Player player, BuildWorld buildWorld) {
}
if (builderId.equals(player.getUniqueId()) && buildWorld.isCreator(player)) {
- Messages.sendMessage(player, "worlds_removebuilder_not_yourself");
+ MessagesOld.sendMessage(player, "worlds_removebuilder_not_yourself");
player.closeInventory();
return;
}
if (!buildWorld.isBuilder(builderId)) {
- Messages.sendMessage(player, "worlds_removebuilder_not_builder");
+ MessagesOld.sendMessage(player, "worlds_removebuilder_not_builder");
player.closeInventory();
return;
}
buildWorld.removeBuilder(builderId);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
- Messages.sendMessage(player, "worlds_removebuilder_removed", new AbstractMap.SimpleEntry<>("%builder%", builderName));
+ MessagesOld.sendMessage(player, "worlds_removebuilder_removed", new AbstractMap.SimpleEntry<>("%builder%", builderName));
player.closeInventory();
});
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveSpawnSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveSpawnSubCommand.java
index 89362aeb..74415345 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveSpawnSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RemoveSpawnSubCommand.java
@@ -1,34 +1,44 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.entity.Player;
import java.util.AbstractMap;
public class RemoveSpawnSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public RemoveSpawnSubCommand(BuildSystem plugin) {
+ public RemoveSpawnSubCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
String playerWorldName = player.getWorld().getName();
if (!worldManager.isPermitted(player, getArgument().getPermission(), playerWorldName)) {
plugin.sendPermissionMessage(player);
@@ -37,12 +47,12 @@ public void execute(Player player, String[] args) {
BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld().getName());
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_removespawn_world_not_imported");
+ MessagesOld.sendMessage(player, "worlds_removespawn_world_not_imported");
return;
}
buildWorld.getData().customSpawn().set(null);
- Messages.sendMessage(player, "worlds_removespawn_world_spawn_removed", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_removespawn_world_spawn_removed", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
@Override
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RenameSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RenameSubCommand.java
index 91c6a72c..2556fd87 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RenameSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/RenameSubCommand.java
@@ -1,49 +1,59 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.PlayerChatInput;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.entity.Player;
public class RenameSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public RenameSubCommand(BuildSystem plugin, String worldName) {
+ public RenameSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_rename_usage");
+ MessagesOld.sendMessage(player, "worlds_rename_usage");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_rename_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_rename_unknown_world");
return;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetCreatorSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetCreatorSubCommand.java
index 40550fa4..3592388c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetCreatorSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetCreatorSubCommand.java
@@ -1,52 +1,62 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.PlayerChatInput;
import de.eintosti.buildsystem.util.UUIDFetcher;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.entity.Player;
import java.util.AbstractMap;
public class SetCreatorSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public SetCreatorSubCommand(BuildSystem plugin, String worldName) {
+ public SetCreatorSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_setcreator_usage");
+ MessagesOld.sendMessage(player, "worlds_setcreator_usage");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_setcreator_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_setcreator_unknown_world");
return;
}
@@ -61,7 +71,7 @@ public void execute(Player player, String[] args) {
plugin.getPlayerManager().forceUpdateSidebar(buildWorld);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
- Messages.sendMessage(player, "worlds_setcreator_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_setcreator_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
player.closeInventory();
});
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetItemSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetItemSubCommand.java
index 9dcc78b3..c37c5a62 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetItemSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetItemSubCommand.java
@@ -1,20 +1,30 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -23,41 +33,41 @@
public class SetItemSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public SetItemSubCommand(BuildSystem plugin, String worldName) {
+ public SetItemSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_setitem_usage");
+ MessagesOld.sendMessage(player, "worlds_setitem_usage");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_setitem_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_setitem_unknown_world");
return;
}
ItemStack itemStack = player.getItemInHand();
if (itemStack.getType() == Material.AIR) {
- Messages.sendMessage(player, "worlds_setitem_hand_empty");
+ MessagesOld.sendMessage(player, "worlds_setitem_hand_empty");
return;
}
buildWorld.getData().material().set(XMaterial.matchXMaterial(itemStack));
- Messages.sendMessage(player, "worlds_setitem_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_setitem_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
@Override
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetPermissionSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetPermissionSubCommand.java
index a64f53d1..bb3a4fc7 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetPermissionSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetPermissionSubCommand.java
@@ -1,64 +1,74 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.PlayerChatInput;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.entity.Player;
import java.util.AbstractMap;
public class SetPermissionSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public SetPermissionSubCommand(BuildSystem plugin, String worldName) {
+ public SetPermissionSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_setpermission_usage");
+ MessagesOld.sendMessage(player, "worlds_setpermission_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_setpermission_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_setpermission_unknown_world");
return;
}
getPermissionInput(player, buildWorld, true);
}
- public void getPermissionInput(Player player, BuildWorld buildWorld, boolean closeInventory) {
+ public void getPermissionInput(Player player, CraftBuildWorld buildWorld, boolean closeInventory) {
new PlayerChatInput(plugin, player, "enter_world_permission", input -> {
buildWorld.getData().permission().set(input.trim());
plugin.getPlayerManager().forceUpdateSidebar(buildWorld);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
- Messages.sendMessage(player, "worlds_setpermission_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_setpermission_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
if (closeInventory) {
player.closeInventory();
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetProjectSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetProjectSubCommand.java
index 5fb47d6f..1b1a321c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetProjectSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetProjectSubCommand.java
@@ -1,64 +1,74 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
import de.eintosti.buildsystem.util.PlayerChatInput;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.entity.Player;
import java.util.AbstractMap;
public class SetProjectSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public SetProjectSubCommand(BuildSystem plugin, String worldName) {
+ public SetProjectSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_setproject_usage");
+ MessagesOld.sendMessage(player, "worlds_setproject_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_setproject_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_setproject_unknown_world");
return;
}
getProjectInput(player, buildWorld, true);
}
- public void getProjectInput(Player player, BuildWorld buildWorld, boolean closeInventory) {
+ public void getProjectInput(Player player, CraftBuildWorld buildWorld, boolean closeInventory) {
new PlayerChatInput(plugin, player, "enter_world_project", input -> {
buildWorld.getData().project().set(input.trim());
plugin.getPlayerManager().forceUpdateSidebar(buildWorld);
XSound.ENTITY_PLAYER_LEVELUP.play(player);
- Messages.sendMessage(player, "worlds_setproject_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_setproject_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
if (closeInventory) {
player.closeInventory();
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetSpawnSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetSpawnSubCommand.java
index 1ffd35c4..3b6d19ae 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetSpawnSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetSpawnSubCommand.java
@@ -1,19 +1,29 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -21,15 +31,15 @@
public class SetSpawnSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public SetSpawnSubCommand(BuildSystem plugin) {
+ public SetSpawnSubCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
String playerWorldName = player.getWorld().getName();
if (!worldManager.isPermitted(player, getArgument().getPermission(), playerWorldName)) {
plugin.sendPermissionMessage(player);
@@ -38,14 +48,14 @@ public void execute(Player player, String[] args) {
BuildWorld buildWorld = worldManager.getBuildWorld(playerWorldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_setspawn_world_not_imported");
+ MessagesOld.sendMessage(player, "worlds_setspawn_world_not_imported");
return;
}
Location loc = player.getLocation();
String locString = loc.getX() + ";" + loc.getY() + ";" + loc.getZ() + ";" + loc.getYaw() + ";" + loc.getPitch();
buildWorld.getData().customSpawn().set(locString);
- Messages.sendMessage(player, "worlds_setspawn_world_spawn_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_setspawn_world_spawn_set", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
@Override
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetStatusSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetStatusSubCommand.java
index f4865502..613ae644 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetStatusSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/SetStatusSubCommand.java
@@ -1,47 +1,57 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.entity.Player;
public class SetStatusSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public SetStatusSubCommand(BuildSystem plugin, String worldName) {
+ public SetStatusSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_setstatus_usage");
+ MessagesOld.sendMessage(player, "worlds_setstatus_usage");
return;
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_setstatus_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_setstatus_unknown_world");
return;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/TeleportSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/TeleportSubCommand.java
index fc353af3..27bcfa34 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/TeleportSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/TeleportSubCommand.java
@@ -1,28 +1,38 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
public class TeleportSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public TeleportSubCommand(BuildSystem plugin) {
+ public TeleportSubCommand(BuildSystemPlugin plugin) {
this.plugin = plugin;
}
@@ -34,20 +44,20 @@ public void execute(Player player, String[] args) {
}
if (args.length != 2) {
- Messages.sendMessage(player, "worlds_tp_usage");
+ MessagesOld.sendMessage(player, "worlds_tp_usage");
return;
}
- WorldManager worldManager = plugin.getWorldManager();
- BuildWorld buildWorld = worldManager.getBuildWorld(args[1]);
+ BuildWorldManager worldManager = plugin.getWorldManager();
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(args[1]);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_tp_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_tp_unknown_world");
return;
}
World bukkitWorld = Bukkit.getServer().getWorld(args[1]);
if (buildWorld.isLoaded() && bukkitWorld == null) {
- Messages.sendMessage(player, "worlds_tp_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_tp_unknown_world");
return;
}
@@ -55,7 +65,7 @@ public void execute(Player player, String[] args) {
if (player.hasPermission(permission) || permission.equalsIgnoreCase("-")) {
worldManager.teleport(player, buildWorld);
} else {
- Messages.sendMessage(player, "worlds_tp_entry_forbidden");
+ MessagesOld.sendMessage(player, "worlds_tp_entry_forbidden");
}
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/UnimportSubCommand.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/UnimportSubCommand.java
index 9ac6a1f4..cdccf223 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/UnimportSubCommand.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/command/subcommand/worlds/UnimportSubCommand.java
@@ -1,54 +1,64 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.command.subcommand.worlds;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.command.subcommand.Argument;
import de.eintosti.buildsystem.command.subcommand.SubCommand;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.tabcomplete.WorldsTabComplete;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.entity.Player;
import java.util.AbstractMap;
public class UnimportSubCommand implements SubCommand {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final String worldName;
- public UnimportSubCommand(BuildSystem plugin, String worldName) {
+ public UnimportSubCommand(BuildSystemPlugin plugin, String worldName) {
this.plugin = plugin;
this.worldName = worldName;
}
@Override
public void execute(Player player, String[] args) {
- WorldManager worldManager = plugin.getWorldManager();
+ BuildWorldManager worldManager = plugin.getWorldManager();
if (!worldManager.isPermitted(player, getArgument().getPermission(), worldName)) {
plugin.sendPermissionMessage(player);
return;
}
if (args.length > 2) {
- Messages.sendMessage(player, "worlds_unimport_usage");
+ MessagesOld.sendMessage(player, "worlds_unimport_usage");
return;
}
BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
- Messages.sendMessage(player, "worlds_unimport_unknown_world");
+ MessagesOld.sendMessage(player, "worlds_unimport_unknown_world");
return;
}
worldManager.unimportWorld(player, buildWorld, true);
- Messages.sendMessage(player, "worlds_unimport_finished", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
+ MessagesOld.sendMessage(player, "worlds_unimport_finished", new AbstractMap.SimpleEntry<>("%world%", buildWorld.getName()));
}
@Override
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigValues.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigValues.java
index 80ca3adf..e6787cf6 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigValues.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigValues.java
@@ -1,14 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.config;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.data.Visibility;
import org.bukkit.Difficulty;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@@ -22,7 +33,7 @@
public class ConfigValues {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private String dateFormat;
private String timeUntilUnload;
@@ -68,7 +79,7 @@ public class ConfigValues {
private Map defaultGameRules;
private Set blackListedWorldsToUnload;
- public ConfigValues(BuildSystem plugin) {
+ public ConfigValues(BuildSystemPlugin plugin) {
this.plugin = plugin;
setConfigValues();
}
@@ -303,8 +314,15 @@ public int getImportDelay() {
return importDelay;
}
- public int getMaxWorldAmount(boolean privateWorld) {
- return privateWorld ? maxPrivateWorldAmount : maxPublicWorldAmount;
+ public int getMaxWorldAmount(Visibility visibility) {
+ switch (visibility) {
+ case PUBLIC:
+ return maxPublicWorldAmount;
+ case PRIVATE:
+ return maxPrivateWorldAmount;
+ default:
+ throw new IllegalArgumentException("Invalid visibility. Use PUBLIC or PRIVATE");
+ }
}
public Map getDefaultGameRules() {
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigurationFile.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigurationFile.java
index 4af6c133..351b76d8 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigurationFile.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/ConfigurationFile.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.config;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -20,7 +30,7 @@ public abstract class ConfigurationFile {
private final File file;
private final FileConfiguration configuration;
- public ConfigurationFile(BuildSystem plugin, String fileName) {
+ public ConfigurationFile(BuildSystemPlugin plugin, String fileName) {
this.file = new File(plugin.getDataFolder(), fileName);
this.configuration = YamlConfiguration.loadConfiguration(file);
loadFile();
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/PlayersConfig.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/PlayersConfig.java
index 50558dfc..84e25058 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/PlayersConfig.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/PlayersConfig.java
@@ -1,24 +1,34 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.config;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.player.BuildPlayer;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import java.util.Collection;
public class PlayersConfig extends ConfigurationFile {
- public PlayersConfig(BuildSystem plugin) {
+ public PlayersConfig(BuildSystemPlugin plugin) {
super(plugin, "players.yml");
}
- public void savePlayers(Collection buildPlayers) {
+ public void savePlayers(Collection buildPlayers) {
buildPlayers.forEach(buildPlayer -> getFile().set("players." + buildPlayer.getUniqueId().toString(), buildPlayer.serialize()));
saveFile();
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SetupConfig.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SetupConfig.java
index 9b61175f..eab04691 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SetupConfig.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SetupConfig.java
@@ -1,20 +1,30 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.config;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.data.WorldStatus;
-import de.eintosti.buildsystem.world.data.WorldType;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
+import de.eintosti.buildsystem.api.world.data.WorldType;
public class SetupConfig extends ConfigurationFile {
- public SetupConfig(BuildSystem plugin) {
+ public SetupConfig(BuildSystemPlugin plugin) {
super(plugin, "setup.yml");
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SpawnConfig.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SpawnConfig.java
index f6a08944..e2663431 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SpawnConfig.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/SpawnConfig.java
@@ -1,18 +1,28 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.config;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import org.bukkit.Location;
public class SpawnConfig extends ConfigurationFile {
- public SpawnConfig(BuildSystem plugin) {
+ public SpawnConfig(BuildSystemPlugin plugin) {
super(plugin, "spawn.yml");
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/WorldConfig.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/WorldConfig.java
index 7d1baf4e..9dc38e0d 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/WorldConfig.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/config/WorldConfig.java
@@ -1,16 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.config;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.BuildWorldCreator;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
+import de.eintosti.buildsystem.world.CraftBuildWorldCreator;
import org.bukkit.World;
import java.util.ArrayList;
@@ -20,21 +31,22 @@
public class WorldConfig extends ConfigurationFile {
- private final BuildSystem plugin;
+
+ private final BuildSystemPlugin plugin;
private final Logger logger;
- public WorldConfig(BuildSystem plugin) {
+ public WorldConfig(BuildSystemPlugin plugin) {
super(plugin, "worlds.yml");
this.plugin = plugin;
this.logger = plugin.getLogger();
}
- public void saveWorlds(Collection buildWorlds) {
+ public void saveWorlds(Collection buildWorlds) {
buildWorlds.forEach(buildWorld -> getFile().set("worlds." + buildWorld.getName(), buildWorld.serialize()));
saveFile();
}
- public void loadWorlds(WorldManager worldManager) {
+ public void loadWorlds(BuildWorldManager worldManager) {
boolean loadAllWorlds = !plugin.getConfigValues().isUnloadWorlds();
if (loadAllWorlds) {
logger.info("*** All worlds will be loaded now ***");
@@ -70,7 +82,7 @@ private LoadResult loadWorld(BuildWorld buildWorld, boolean alwaysLoad) {
return LoadResult.NOT_BLACKLISTED;
}
- World world = new BuildWorldCreator(plugin, buildWorld).generateBukkitWorld();
+ World world = new CraftBuildWorldCreator(plugin, buildWorld).generateBukkitWorld();
if (world == null) {
return LoadResult.FAILED;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/player/PlayerInventoryClearEvent.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/player/PlayerInventoryClearEvent.java
index a78dd603..23dbbadd 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/player/PlayerInventoryClearEvent.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/player/PlayerInventoryClearEvent.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.event.player;
@@ -19,7 +29,7 @@
*/
public class PlayerInventoryClearEvent extends PlayerEvent {
- private static final HandlerList HANDLERS = new HandlerList();
+ private static final HandlerList HANDLER_LIST = new HandlerList();
private final List navigatorSlots;
@@ -28,10 +38,6 @@ public PlayerInventoryClearEvent(Player player, List navigatorSlots) {
this.navigatorSlots = navigatorSlots;
}
- public static HandlerList getHandlerList() {
- return HANDLERS;
- }
-
public List getNavigatorSlots() {
return navigatorSlots;
}
@@ -39,6 +45,10 @@ public List getNavigatorSlots() {
@NotNull
@Override
public HandlerList getHandlers() {
- return HANDLERS;
+ return HANDLER_LIST;
+ }
+
+ public static HandlerList getHandlerList() {
+ return HANDLER_LIST;
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldEvent.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldEvent.java
deleted file mode 100644
index 38295b85..00000000
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package de.eintosti.buildsystem.event.world;
-
-import de.eintosti.buildsystem.world.BuildWorld;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Represents a {@link BuildWorld} related event.
- */
-public class BuildWorldEvent extends Event {
-
- private static final HandlerList HANDLERS = new HandlerList();
-
- private final BuildWorld buildWorld;
-
- public BuildWorldEvent(BuildWorld buildWorld) {
- this.buildWorld = buildWorld;
- }
-
- public static HandlerList getHandlerList() {
- return HANDLERS;
- }
-
- public BuildWorld getBuildWorld() {
- return buildWorld;
- }
-
- @NotNull
- @Override
- public HandlerList getHandlers() {
- return HANDLERS;
- }
-}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldLoadEvent.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldLoadEvent.java
deleted file mode 100644
index ab9095f4..00000000
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldLoadEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package de.eintosti.buildsystem.event.world;
-
-import de.eintosti.buildsystem.world.BuildWorld;
-import org.bukkit.event.Cancellable;
-
-/**
- * Called when a {@link BuildWorld} is loaded.
- */
-public class BuildWorldLoadEvent extends BuildWorldEvent implements Cancellable {
-
- private boolean cancelled = false;
-
- public BuildWorldLoadEvent(BuildWorld buildWorld) {
- super(buildWorld);
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldPostLoadEvent.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldPostLoadEvent.java
deleted file mode 100644
index 0140dcc5..00000000
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldPostLoadEvent.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package de.eintosti.buildsystem.event.world;
-
-import de.eintosti.buildsystem.world.BuildWorld;
-
-/**
- * Called after a {@link BuildWorld} has loaded.
- */
-public class BuildWorldPostLoadEvent extends BuildWorldEvent {
-
- public BuildWorldPostLoadEvent(BuildWorld buildWorld) {
- super(buildWorld);
- }
-}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldPostUnloadEvent.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldPostUnloadEvent.java
deleted file mode 100644
index fcc977bc..00000000
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldPostUnloadEvent.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package de.eintosti.buildsystem.event.world;
-
-import de.eintosti.buildsystem.world.BuildWorld;
-
-/**
- * Called after a {@link BuildWorld} has unloaded.
- */
-public class BuildWorldPostUnloadEvent extends BuildWorldEvent {
-
- public BuildWorldPostUnloadEvent(BuildWorld buildWorld) {
- super(buildWorld);
- }
-}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldUnloadEvent.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldUnloadEvent.java
deleted file mode 100644
index 83461ac0..00000000
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/event/world/BuildWorldUnloadEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package de.eintosti.buildsystem.event.world;
-
-import de.eintosti.buildsystem.world.BuildWorld;
-import org.bukkit.event.Cancellable;
-
-/**
- * Called when a {@link BuildWorld} is unloaded.
- */
-public class BuildWorldUnloadEvent extends BuildWorldEvent implements Cancellable {
-
- private boolean cancelled = false;
-
- public BuildWorldUnloadEvent(BuildWorld buildWorld) {
- super(buildWorld);
- }
-
- @Override
- public boolean isCancelled() {
- return cancelled;
- }
-
- @Override
- public void setCancelled(boolean cancel) {
- this.cancelled = cancel;
- }
-}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/LuckPermsExpansion.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/LuckPermsExpansion.java
index 45995579..8caef2d1 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/LuckPermsExpansion.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/LuckPermsExpansion.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.expansion.luckperms;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.expansion.luckperms.calculators.BuildModeCalculator;
import de.eintosti.buildsystem.expansion.luckperms.calculators.RoleCalculator;
import net.luckperms.api.LuckPerms;
@@ -21,11 +31,11 @@
public class LuckPermsExpansion {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final ContextManager contextManager;
private final List> registeredCalculators;
- public LuckPermsExpansion(BuildSystem plugin) {
+ public LuckPermsExpansion(BuildSystemPlugin plugin) {
LuckPerms luckPerms = plugin.getServer().getServicesManager().load(LuckPerms.class);
if (luckPerms == null) {
throw new IllegalStateException("LuckPerms API not loaded.");
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/BuildModeCalculator.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/BuildModeCalculator.java
index 1314315d..7b21f21b 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/BuildModeCalculator.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/BuildModeCalculator.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.expansion.luckperms.calculators;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.player.PlayerManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import net.luckperms.api.context.ContextCalculator;
import net.luckperms.api.context.ContextConsumer;
import net.luckperms.api.context.ContextSet;
@@ -21,9 +31,9 @@ public class BuildModeCalculator implements ContextCalculator {
private static final String KEY = "buildsystem:build-mode";
- private final PlayerManager playerManager;
+ private final BuildPlayerManager playerManager;
- public BuildModeCalculator(BuildSystem plugin) {
+ public BuildModeCalculator(BuildSystemPlugin plugin) {
this.playerManager = plugin.getPlayerManager();
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/RoleCalculator.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/RoleCalculator.java
index 92dbb4bc..3e638ba1 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/RoleCalculator.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/luckperms/calculators/RoleCalculator.java
@@ -1,15 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.expansion.luckperms.calculators;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import net.luckperms.api.context.ContextCalculator;
import net.luckperms.api.context.ContextConsumer;
import net.luckperms.api.context.ContextSet;
@@ -22,9 +32,9 @@ public class RoleCalculator implements ContextCalculator {
private static final String KEY = "buildsystem:role";
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public RoleCalculator(BuildSystem plugin) {
+ public RoleCalculator(BuildSystemPlugin plugin) {
this.worldManager = plugin.getWorldManager();
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/placeholderapi/PlaceholderApiExpansion.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/placeholderapi/PlaceholderApiExpansion.java
index a18f4038..80a4a4db 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/placeholderapi/PlaceholderApiExpansion.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/expansion/placeholderapi/PlaceholderApiExpansion.java
@@ -1,19 +1,29 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.expansion.placeholderapi;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.settings.Settings;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.settings.CraftSettings;
import de.eintosti.buildsystem.settings.SettingsManager;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -23,11 +33,11 @@ public class PlaceholderApiExpansion extends PlaceholderExpansion {
private static final String SETTINGS_KEY = "settings";
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final SettingsManager settingsManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public PlaceholderApiExpansion(BuildSystem plugin) {
+ public PlaceholderApiExpansion(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.settingsManager = plugin.getSettingsManager();
this.worldManager = plugin.getWorldManager();
@@ -126,7 +136,7 @@ public String onPlaceholderRequest(Player player, @NotNull String identifier) {
*/
@Nullable
private String parseSettingsPlaceholder(Player player, String identifier) {
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
String settingIdentifier = identifier.split("_")[1];
switch (settingIdentifier.toLowerCase()) {
@@ -159,7 +169,7 @@ private String parseSettingsPlaceholder(Player player, String identifier) {
case "spawnteleport":
return String.valueOf(settings.isSpawnTeleport());
case "opentrapdoors":
- return String.valueOf(settings.isTrapDoor());
+ return String.valueOf(settings.isOpenTrapDoors());
default:
return null;
}
@@ -186,7 +196,7 @@ private String parseBuildWorldPlaceholder(Player player, String identifier) {
identifier = splitString[0];
}
- BuildWorld buildWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(worldName);
if (buildWorld == null) {
return "-";
}
@@ -202,7 +212,7 @@ private String parseBuildWorldPlaceholder(Player player, String identifier) {
case "buildersenabled":
return String.valueOf(worldData.buildersEnabled().get());
case "creation":
- return Messages.formatDate(buildWorld.getCreationDate());
+ return MessagesOld.formatDate(buildWorld.getCreationDate());
case "creator":
return buildWorld.getCreator();
case "creatorid":
@@ -210,11 +220,11 @@ private String parseBuildWorldPlaceholder(Player player, String identifier) {
case "explosions":
return String.valueOf(worldData.explosions().get());
case "lastedited":
- return Messages.formatDate(worldData.lastEdited().get());
+ return MessagesOld.formatDate(worldData.lastEdited().get());
case "lastloaded":
- return Messages.formatDate(worldData.lastLoaded().get());
+ return MessagesOld.formatDate(worldData.lastLoaded().get());
case "lastunloaded":
- return Messages.formatDate(worldData.lastUnloaded().get());
+ return MessagesOld.formatDate(worldData.lastUnloaded().get());
case "loaded":
return String.valueOf(buildWorld.isLoaded());
case "material":
@@ -232,11 +242,11 @@ private String parseBuildWorldPlaceholder(Player player, String identifier) {
case "spawn":
return worldData.customSpawn().get();
case "status":
- return worldData.status().get().getName(player);
+ return MessagesOld.getDataString(worldData.status().get().getKey(), player);
case "time":
return buildWorld.getWorldTime();
case "type":
- return buildWorld.getType().getName(player);
+ return MessagesOld.getDataString(buildWorld.getType().getKey(), player);
case "world":
return buildWorld.getName();
default:
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/internal/CraftBukkitVersion.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/internal/CraftBukkitVersion.java
index d05bbba4..37139869 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/internal/CraftBukkitVersion.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/internal/CraftBukkitVersion.java
@@ -1,15 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.internal;
import com.google.common.collect.Lists;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.version.customblocks.CustomBlocks;
import de.eintosti.buildsystem.version.gamerules.GameRules;
import de.eintosti.buildsystem.version.util.MinecraftVersion;
@@ -57,7 +67,7 @@ public enum CraftBukkitVersion {
private final Class extends CustomBlocks> customBlocks;
private final Class extends GameRules> gameRules;
- private final BuildSystem plugin = JavaPlugin.getPlugin(BuildSystem.class);
+ private final BuildSystemPlugin plugin = JavaPlugin.getPlugin(BuildSystemPlugin.class);
CraftBukkitVersion(int dataVersion, Class extends CustomBlocks> customBlocks, Class extends GameRules> gameRules) {
this.dataVersion = dataVersion;
@@ -188,10 +198,10 @@ public GameRules initGameRules() {
try {
Constructor extends GameRules> constructor = gameRules.getConstructor(String.class, List.class, List.class, List.class);
return constructor.newInstance(
- Messages.getString("worldeditor_gamerules_title", null),
- Messages.getStringList("worldeditor_gamerules_boolean_enabled", null),
- Messages.getStringList("worldeditor_gamerules_boolean_disabled", null),
- Messages.getStringList("worldeditor_gamerules_integer", null)
+ MessagesOld.getString("worldeditor_gamerules_title", null),
+ MessagesOld.getStringList("worldeditor_gamerules_boolean_enabled", null),
+ MessagesOld.getStringList("worldeditor_gamerules_boolean_disabled", null),
+ MessagesOld.getStringList("worldeditor_gamerules_integer", null)
);
} catch (Exception e) {
e.printStackTrace();
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerChatListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerChatListener.java
index 8fd5c111..62df6e05 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerChatListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerChatListener.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.util.color.ColorAPI;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -17,7 +27,7 @@
public class AsyncPlayerChatListener implements Listener {
- public AsyncPlayerChatListener(BuildSystem plugin) {
+ public AsyncPlayerChatListener(BuildSystemPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerPreLoginListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerPreLoginListener.java
index 522f26ea..518f7b6e 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerPreLoginListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/AsyncPlayerPreLoginListener.java
@@ -1,20 +1,30 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.player.BuildPlayer;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import de.eintosti.buildsystem.player.LogoutLocation;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.settings.Settings;
-import de.eintosti.buildsystem.world.BuildWorld;
+import de.eintosti.buildsystem.settings.CraftSettings;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import de.eintosti.buildsystem.world.SpawnManager;
-import de.eintosti.buildsystem.world.WorldManager;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -24,12 +34,12 @@
public class AsyncPlayerPreLoginListener implements Listener {
- private final BuildSystem plugin;
- private final PlayerManager playerManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildPlayerManager playerManager;
private final SpawnManager spawnManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public AsyncPlayerPreLoginListener(BuildSystem plugin) {
+ public AsyncPlayerPreLoginListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.playerManager = plugin.getPlayerManager();
this.spawnManager = plugin.getSpawnManager();
@@ -40,12 +50,12 @@ public AsyncPlayerPreLoginListener(BuildSystem plugin) {
@EventHandler
public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
UUID uuid = event.getUniqueId();
- BuildPlayer buildPlayer = playerManager.getBuildPlayer(uuid);
+ CraftBuildPlayer buildPlayer = playerManager.getBuildPlayer(uuid);
if (buildPlayer == null) {
return;
}
- Settings settings = buildPlayer.getSettings();
+ CraftSettings settings = buildPlayer.getSettings();
if (settings.isSpawnTeleport() && spawnManager.spawnExists()) {
return;
}
@@ -59,7 +69,7 @@ public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
if (buildWorld == null) {
buildPlayer.setLogoutLocation(null);
} else {
- Bukkit.getScheduler().runTask(plugin, () -> buildWorld.load());
+ Bukkit.getScheduler().runTask(plugin, buildWorld::load);
}
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPhysicsListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPhysicsListener.java
index 13ab26d8..498ad556 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPhysicsListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPhysicsListener.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
@@ -36,9 +46,9 @@
public class BlockPhysicsListener implements Listener {
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public BlockPhysicsListener(BuildSystem plugin) {
+ public BlockPhysicsListener(BuildSystemPlugin plugin) {
this.worldManager = plugin.getWorldManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPlaceListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPlaceListener.java
index 677714d6..a7caddf7 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPlaceListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BlockPlaceListener.java
@@ -1,18 +1,28 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.version.customblocks.CustomBlock;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -25,12 +35,12 @@
public class BlockPlaceListener implements Listener {
- private final BuildSystem plugin;
- private final WorldManager worldManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildWorldManager worldManager;
private final Map blockLookup;
- public BlockPlaceListener(BuildSystem plugin) {
+ public BlockPlaceListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.worldManager = plugin.getWorldManager();
this.blockLookup = initBlockLookup();
@@ -40,7 +50,7 @@ public BlockPlaceListener(BuildSystem plugin) {
private Map initBlockLookup() {
Map lookup = new HashMap<>();
for (CustomBlock customBlock : CustomBlock.values()) {
- lookup.put(Messages.getString(customBlock.getKey(), null), customBlock.getKey());
+ lookup.put(MessagesOld.getString(customBlock.getKey(), null), customBlock.getKey());
}
return lookup;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildModePreventationListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildModePreventationListener.java
index 7bbdc29c..806f9848 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildModePreventationListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildModePreventationListener.java
@@ -1,15 +1,25 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.config.ConfigValues;
-import de.eintosti.buildsystem.player.PlayerManager;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -20,9 +30,9 @@
public class BuildModePreventationListener implements Listener {
private final ConfigValues configValues;
- private final PlayerManager playerManager;
+ private final BuildPlayerManager playerManager;
- public BuildModePreventationListener(BuildSystem plugin) {
+ public BuildModePreventationListener(BuildSystemPlugin plugin) {
this.configValues = plugin.getConfigValues();
this.playerManager = plugin.getPlayerManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildWorldResetUnloadListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildWorldResetUnloadListener.java
index d91d6838..cc73c6f0 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildWorldResetUnloadListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/BuildWorldResetUnloadListener.java
@@ -1,8 +1,25 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -11,9 +28,9 @@
public class BuildWorldResetUnloadListener implements Listener {
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public BuildWorldResetUnloadListener(BuildSystem plugin) {
+ public BuildWorldResetUnloadListener(BuildSystemPlugin plugin) {
this.worldManager = plugin.getWorldManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@@ -21,7 +38,7 @@ public BuildWorldResetUnloadListener(BuildSystem plugin) {
@EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
World from = event.getFrom();
- BuildWorld buildWorld = worldManager.getBuildWorld(from.getName());
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(from.getName());
if (buildWorld != null) {
buildWorld.resetUnloadTask();
}
@@ -30,7 +47,7 @@ public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
World from = event.getPlayer().getWorld();
- BuildWorld buildWorld = worldManager.getBuildWorld(from.getName());
+ CraftBuildWorld buildWorld = worldManager.getBuildWorld(from.getName());
if (buildWorld != null) {
buildWorld.resetUnloadTask();
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EditSessionListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EditSessionListener.java
index 00983369..a04deb4c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EditSessionListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EditSessionListener.java
@@ -1,9 +1,19 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
@@ -13,19 +23,19 @@
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.util.eventbus.Subscribe;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldStatus;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
public class EditSessionListener implements Listener {
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public EditSessionListener(BuildSystem plugin) {
+ public EditSessionListener(BuildSystemPlugin plugin) {
this.worldManager = plugin.getWorldManager();
WorldEdit.getInstance().getEventBus().register(this);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntityDamageListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntityDamageListener.java
index afe3b74d..5e331bae 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntityDamageListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntityDamageListener.java
@@ -1,9 +1,9 @@
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.config.ConfigValues;
-import de.eintosti.buildsystem.world.BuildWorld;
import io.papermc.lib.PaperLib;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
@@ -14,9 +14,9 @@
public class EntityDamageListener implements Listener {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
- public EntityDamageListener(BuildSystem plugin) {
+ public EntityDamageListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntitySpawnListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntitySpawnListener.java
index ff210d38..4242db99 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntitySpawnListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/EntitySpawnListener.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
import de.eintosti.buildsystem.util.EntityAIManager;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -20,9 +30,9 @@
public class EntitySpawnListener implements Listener {
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public EntitySpawnListener(BuildSystem plugin) {
+ public EntitySpawnListener(BuildSystemPlugin plugin) {
this.worldManager = plugin.getWorldManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/FoodLevelChangeListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/FoodLevelChangeListener.java
index 31af7ddd..7827e12c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/FoodLevelChangeListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/FoodLevelChangeListener.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldStatus;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -19,9 +29,9 @@
public class FoodLevelChangeListener implements Listener {
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public FoodLevelChangeListener(BuildSystem plugin) {
+ public FoodLevelChangeListener(BuildSystemPlugin plugin) {
this.worldManager = plugin.getWorldManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCloseListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCloseListener.java
index a7811764..38f5b108 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCloseListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCloseListener.java
@@ -1,18 +1,28 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
+import de.eintosti.buildsystem.api.world.data.WorldType;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.util.InventoryUtils;
-import de.eintosti.buildsystem.world.data.WorldStatus;
-import de.eintosti.buildsystem.world.data.WorldType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -24,14 +34,14 @@ public class InventoryCloseListener implements Listener {
private final InventoryUtils inventoryUtils;
- public InventoryCloseListener(BuildSystem plugin) {
+ public InventoryCloseListener(BuildSystemPlugin plugin) {
this.inventoryUtils = plugin.getInventoryUtil();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onSetupInventoryClose(InventoryCloseEvent event) {
- if (!event.getView().getTitle().equals(Messages.getString("setup_title", (Player) event.getPlayer()))) {
+ if (!event.getView().getTitle().equals(MessagesOld.getString("setup_title", (Player) event.getPlayer()))) {
return;
}
setNewItems(event);
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCreativeListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCreativeListener.java
index c88002cd..fa4f197c 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCreativeListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/InventoryCreativeListener.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.event.player.PlayerInventoryClearEvent;
import de.eintosti.buildsystem.util.InventoryUtils;
import org.bukkit.Bukkit;
@@ -23,10 +33,10 @@
public class InventoryCreativeListener implements Listener {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final InventoryUtils inventoryUtils;
- public InventoryCreativeListener(BuildSystem plugin) {
+ public InventoryCreativeListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.inventoryUtils = plugin.getInventoryUtil();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/NavigatorListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/NavigatorListener.java
index 2ad90aed..cbc8b92a 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/NavigatorListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/NavigatorListener.java
@@ -1,28 +1,38 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.settings.NavigatorType;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
import de.eintosti.buildsystem.config.ConfigValues;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.navigator.ArmorStandManager;
import de.eintosti.buildsystem.navigator.settings.NavigatorInventoryType;
-import de.eintosti.buildsystem.navigator.settings.NavigatorType;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import de.eintosti.buildsystem.player.CachedValues;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.settings.Settings;
+import de.eintosti.buildsystem.settings.CraftSettings;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.util.InventoryUtils;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldStatus;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.ArmorStand;
@@ -48,16 +58,16 @@ public class NavigatorListener implements Listener {
private static final double MAX_HEIGHT = 2.074631929397583;
private static final double MIN_HEIGHT = 1.4409877061843872;
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final ConfigValues configValues;
private final ArmorStandManager armorStandManager;
private final InventoryUtils inventoryUtils;
- private final PlayerManager playerManager;
+ private final BuildPlayerManager playerManager;
private final SettingsManager settingsManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public NavigatorListener(BuildSystem plugin) {
+ public NavigatorListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.configValues = plugin.getConfigValues();
@@ -99,7 +109,7 @@ public void manageNavigatorItemInteraction(PlayerInteractEvent event) {
}
XMaterial xMaterial = XMaterial.matchXMaterial(itemStack);
- if (xMaterial != configValues.getNavigatorItem() || !itemMeta.getDisplayName().equals(Messages.getString("navigator_item", player))) {
+ if (xMaterial != configValues.getNavigatorItem() || !itemMeta.getDisplayName().equals(MessagesOld.getString("navigator_item", player))) {
return;
}
@@ -113,21 +123,21 @@ public void manageNavigatorItemInteraction(PlayerInteractEvent event) {
}
private void openNavigator(Player player) {
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (settings.getNavigatorType() == NavigatorType.OLD) {
plugin.getNavigatorInventory().openInventory(player);
XSound.BLOCK_CHEST_OPEN.play(player);
} else { // NEW
if (playerManager.getOpenNavigator().contains(player)) {
- Messages.sendMessage(player, "worlds_navigator_open");
+ MessagesOld.sendMessage(player, "worlds_navigator_open");
return;
}
summonNewNavigator(player);
- String findItemName = Messages.getString("navigator_item", player);
- ItemStack replaceItem = inventoryUtils.getItemStack(XMaterial.BARRIER, Messages.getString("barrier_item", player));
+ String findItemName = MessagesOld.getString("navigator_item", player);
+ ItemStack replaceItem = inventoryUtils.getItemStack(XMaterial.BARRIER, MessagesOld.getString("barrier_item", player));
inventoryUtils.replaceItem(player, findItemName, configValues.getNavigatorItem(), replaceItem);
}
}
@@ -255,7 +265,7 @@ private boolean isCloseNavigatorItem(Player player, ItemStack itemStack) {
return false;
}
- return itemMeta.getDisplayName().equals(Messages.getString("barrier_item", player));
+ return itemMeta.getDisplayName().equals(MessagesOld.getString("barrier_item", player));
}
/**
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerChangedWorldListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerChangedWorldListener.java
index be3f4f49..d0595755 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerChangedWorldListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerChangedWorldListener.java
@@ -1,24 +1,35 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XSound;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
+import de.eintosti.buildsystem.api.world.data.WorldType;
import de.eintosti.buildsystem.config.ConfigValues;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.navigator.ArmorStandManager;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import de.eintosti.buildsystem.player.CachedValues;
-import de.eintosti.buildsystem.player.PlayerManager;
import de.eintosti.buildsystem.settings.SettingsManager;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldStatus;
-import de.eintosti.buildsystem.world.data.WorldType;
+import de.eintosti.buildsystem.world.BuildWorldManager;
+import de.eintosti.buildsystem.world.CraftBuildWorld;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
@@ -42,15 +53,15 @@ public class PlayerChangedWorldListener implements Listener {
private final ConfigValues configValues;
private final ArmorStandManager armorStandManager;
- private final PlayerManager playerManager;
+ private final BuildPlayerManager playerManager;
private final SettingsManager settingsManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
private final Map playerGamemode;
private final Map playerInventory;
private final Map playerArmor;
- public PlayerChangedWorldListener(BuildSystem plugin) {
+ public PlayerChangedWorldListener(BuildSystemPlugin plugin) {
this.configValues = plugin.getConfigValues();
this.armorStandManager = plugin.getArmorStandManager();
@@ -72,14 +83,14 @@ public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
event.getPlayer().setAllowFlight(true);
- BuildWorld oldWorld = worldManager.getBuildWorld(event.getFrom().getName());
+ CraftBuildWorld oldWorld = worldManager.getBuildWorld(event.getFrom().getName());
if (oldWorld != null && configValues.isUnloadWorlds()) {
oldWorld.resetUnloadTask();
}
- BuildWorld newWorld = worldManager.getBuildWorld(worldName);
+ CraftBuildWorld newWorld = worldManager.getBuildWorld(worldName);
if (newWorld != null && !newWorld.getData().physics().get() && player.hasPermission("buildsystem.physics.message")) {
- Messages.sendMessage(player, "physics_deactivated_in_world", new AbstractMap.SimpleEntry<>("%world%", newWorld.getName()));
+ MessagesOld.sendMessage(player, "physics_deactivated_in_world", new AbstractMap.SimpleEntry<>("%world%", newWorld.getName()));
}
removeOldNavigator(player);
@@ -109,7 +120,7 @@ private void removeBuildMode(Player player) {
cachedValues.resetGameModeIfPresent(player);
cachedValues.resetInventoryIfPresent(player);
XSound.ENTITY_EXPERIENCE_ORB_PICKUP.play(player);
- Messages.sendMessage(player, "build_deactivated_self");
+ MessagesOld.sendMessage(player, "build_deactivated_self");
}
private void setGoldBlock(BuildWorld buildWorld) {
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerCommandPreprocessListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerCommandPreprocessListener.java
index 13d58172..3fcd9b1a 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerCommandPreprocessListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerCommandPreprocessListener.java
@@ -1,22 +1,32 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.google.common.collect.Sets;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
import de.eintosti.buildsystem.config.ConfigValues;
import de.eintosti.buildsystem.event.player.PlayerInventoryClearEvent;
+import de.eintosti.buildsystem.messages.MessagesOld;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.util.InventoryUtils;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldStatus;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -31,6 +41,7 @@
public class PlayerCommandPreprocessListener implements Listener {
private static final Set DISABLED_COMMANDS = Sets.newHashSet(
+ //
"/worldedit",
"/we",
@@ -205,15 +216,16 @@ public class PlayerCommandPreprocessListener implements Listener {
"/vir",
"/vl",
"/vr--"
+ //
);
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final ConfigValues configValues;
private final InventoryUtils inventoryUtils;
private final SettingsManager settingsManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public PlayerCommandPreprocessListener(BuildSystem plugin) {
+ public PlayerCommandPreprocessListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.configValues = plugin.getConfigValues();
@@ -234,7 +246,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (command.equalsIgnoreCase("/clear")) {
- ItemStack navigatorItem = inventoryUtils.getItemStack(configValues.getNavigatorItem(), Messages.getString("navigator_item", player));
+ ItemStack navigatorItem = inventoryUtils.getItemStack(configValues.getNavigatorItem(), MessagesOld.getString("navigator_item", player));
if (!player.getInventory().contains(navigatorItem)) {
return;
}
@@ -255,10 +267,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
}
BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld().getName());
- if (buildWorld == null) {
- return;
- }
- if (disableArchivedWorlds(buildWorld, player, event)) {
+ if (buildWorld == null || disableArchivedWorlds(buildWorld, player, event)) {
return;
}
@@ -269,7 +278,7 @@ public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
private boolean disableArchivedWorlds(BuildWorld buildWorld, Player player, PlayerCommandPreprocessEvent event) {
if (!worldManager.canBypassBuildRestriction(player) && buildWorld.getData().status().get() == WorldStatus.ARCHIVE) {
event.setCancelled(true);
- Messages.sendMessage(player, "command_archive_world");
+ MessagesOld.sendMessage(player, "command_archive_world");
return true;
}
return false;
@@ -286,7 +295,7 @@ private void checkBuilders(BuildWorld buildWorld, Player player, PlayerCommandPr
if (buildWorld.getData().buildersEnabled().get() && !buildWorld.isBuilder(player)) {
event.setCancelled(true);
- Messages.sendMessage(player, "command_not_builder");
+ MessagesOld.sendMessage(player, "command_not_builder");
}
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerInventoryClearListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerInventoryClearListener.java
index 0962e221..fe16d403 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerInventoryClearListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerInventoryClearListener.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.event.player.PlayerInventoryClearEvent;
-import de.eintosti.buildsystem.settings.Settings;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.settings.CraftSettings;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.util.InventoryUtils;
import org.bukkit.entity.Player;
@@ -21,11 +31,11 @@
public class PlayerInventoryClearListener implements Listener {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final InventoryUtils inventoryUtils;
private final SettingsManager settingsManager;
- public PlayerInventoryClearListener(BuildSystem plugin) {
+ public PlayerInventoryClearListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.inventoryUtils = plugin.getInventoryUtil();
this.settingsManager = plugin.getSettingsManager();
@@ -36,13 +46,13 @@ public PlayerInventoryClearListener(BuildSystem plugin) {
@EventHandler
public void onPlayerInventoryClear(PlayerInventoryClearEvent event) {
Player player = event.getPlayer();
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (!settings.isKeepNavigator() || !player.hasPermission("buildsystem.navigator.item")) {
return;
}
PlayerInventory playerInventory = player.getInventory();
- ItemStack navigatorItem = inventoryUtils.getItemStack(plugin.getConfigValues().getNavigatorItem(), Messages.getString("navigator_item", player));
+ ItemStack navigatorItem = inventoryUtils.getItemStack(plugin.getConfigValues().getNavigatorItem(), MessagesOld.getString("navigator_item", player));
event.getNavigatorSlots().forEach(slot -> playerInventory.setItem(slot, navigatorItem));
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerJoinListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerJoinListener.java
index e41ce2bd..a4ed33a4 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerJoinListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerJoinListener.java
@@ -1,28 +1,40 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.settings.Settings;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
import de.eintosti.buildsystem.config.ConfigValues;
-import de.eintosti.buildsystem.player.BuildPlayer;
+import de.eintosti.buildsystem.messages.Messages;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import de.eintosti.buildsystem.player.LogoutLocation;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.settings.Settings;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.util.UUIDFetcher;
import de.eintosti.buildsystem.util.UpdateChecker;
-import de.eintosti.buildsystem.world.BuildWorld;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import de.eintosti.buildsystem.world.SpawnManager;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
-import de.eintosti.buildsystem.world.data.WorldStatus;
import io.papermc.lib.PaperLib;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -36,15 +48,15 @@
public class PlayerJoinListener implements Listener {
- private final BuildSystem plugin;
+ private final BuildSystemPlugin plugin;
private final ConfigValues configValues;
- private final PlayerManager playerManager;
+ private final BuildPlayerManager playerManager;
private final SettingsManager settingsManager;
private final SpawnManager spawnManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
- public PlayerJoinListener(BuildSystem plugin) {
+ public PlayerJoinListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.configValues = plugin.getConfigValues();
@@ -60,7 +72,7 @@ public PlayerJoinListener(BuildSystem plugin) {
public void sendPlayerJoinMessage(PlayerJoinEvent event) {
Player player = event.getPlayer();
String message = plugin.getConfigValues().isJoinQuitMessages()
- ? Messages.getString("player_join", player, new AbstractMap.SimpleEntry<>("%player%", player.getName()))
+ ? Messages.getLegacyMessage("player.join", Placeholder.unparsed("player", player.getName()))
: null;
event.setJoinMessage(message);
}
@@ -71,7 +83,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
UUIDFetcher.cacheUser(player.getUniqueId(), player.getName());
- BuildPlayer buildPlayer = playerManager.createBuildPlayer(player);
+ CraftBuildPlayer buildPlayer = playerManager.createBuildPlayer(player);
manageHidePlayer(player, buildPlayer);
manageSettings(player, buildPlayer.getSettings());
teleportToCorrectLocation(player, buildPlayer);
@@ -82,7 +94,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
if (buildWorld != null) {
WorldData worldData = buildWorld.getData();
if (!worldData.physics().get() && player.hasPermission("buildsystem.physics.message")) {
- Messages.sendMessage(player, "physics_deactivated_in_world", new AbstractMap.SimpleEntry<>("%world%", worldName));
+ MessagesOld.sendMessage(player, "physics_deactivated_in_world", new AbstractMap.SimpleEntry<>("%world%", worldName));
}
if (configValues.isArchiveVanish() && worldData.status().get() == WorldStatus.ARCHIVE) {
@@ -107,7 +119,7 @@ public void onPlayerJoin(PlayerJoinEvent event) {
* @param player The player to teleport
* @param buildPlayer The build-player for the given player
*/
- private void teleportToCorrectLocation(Player player, BuildPlayer buildPlayer) {
+ private void teleportToCorrectLocation(Player player, CraftBuildPlayer buildPlayer) {
if (buildPlayer.getSettings().isSpawnTeleport() && spawnManager.spawnExists()) {
spawnManager.teleport(player);
return;
@@ -128,7 +140,7 @@ private void teleportToCorrectLocation(Player player, BuildPlayer buildPlayer) {
}
@SuppressWarnings("deprecation")
- private void manageHidePlayer(Player player, BuildPlayer buildPlayer) {
+ private void manageHidePlayer(Player player, CraftBuildPlayer buildPlayer) {
// Hide all players to player
if (buildPlayer.getSettings().isHidePlayers()) {
Bukkit.getOnlinePlayers().forEach(player::hidePlayer);
@@ -169,12 +181,12 @@ private void performUpdateCheck(Player player) {
return;
}
- UpdateChecker.init(plugin, BuildSystem.SPIGOT_ID)
+ UpdateChecker.init(plugin, BuildSystemPlugin.SPIGOT_ID)
.requestUpdateCheck()
.whenComplete((result, e) -> {
if (result.requiresUpdate()) {
StringBuilder stringBuilder = new StringBuilder();
- Messages.getStringList("update_available", player).forEach(line ->
+ MessagesOld.getStringList("update_available", player).forEach(line ->
stringBuilder.append(line
.replace("%new_version%", result.getNewestVersion())
.replace("%current_version%", plugin.getDescription().getVersion()))
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerMoveListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerMoveListener.java
index f54c69a0..345e9cbd 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerMoveListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerMoveListener.java
@@ -1,16 +1,26 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.navigator.settings.NavigatorType;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.settings.Settings;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.settings.NavigatorType;
+import de.eintosti.buildsystem.api.settings.Settings;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import de.eintosti.buildsystem.settings.SettingsManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@@ -21,11 +31,11 @@
public class PlayerMoveListener implements Listener {
- private final BuildSystem plugin;
- private final PlayerManager playerManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildPlayerManager playerManager;
private final SettingsManager settingsManager;
- public PlayerMoveListener(BuildSystem plugin) {
+ public PlayerMoveListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.playerManager = plugin.getPlayerManager();
this.settingsManager = plugin.getSettingsManager();
@@ -40,7 +50,7 @@ public void onPlayerMove(PlayerMoveEvent event) {
}
Settings settings = settingsManager.getSettings(player);
- if (!settings.getNavigatorType().equals(NavigatorType.NEW)) {
+ if (settings.getNavigatorType() != NavigatorType.NEW) {
return;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerQuitListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerQuitListener.java
index ad243080..62e075bc 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerQuitListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerQuitListener.java
@@ -1,20 +1,31 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.player.BuildPlayer;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.settings.Settings;
+import de.eintosti.buildsystem.messages.Messages;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
import de.eintosti.buildsystem.player.CachedValues;
+import de.eintosti.buildsystem.player.CraftBuildPlayer;
import de.eintosti.buildsystem.player.LogoutLocation;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.settings.Settings;
import de.eintosti.buildsystem.settings.SettingsManager;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -22,15 +33,13 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
-import java.util.AbstractMap;
-
public class PlayerQuitListener implements Listener {
- private final BuildSystem plugin;
- private final PlayerManager playerManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildPlayerManager playerManager;
private final SettingsManager settingsManager;
- public PlayerQuitListener(BuildSystem plugin) {
+ public PlayerQuitListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.playerManager = plugin.getPlayerManager();
this.settingsManager = plugin.getSettingsManager();
@@ -41,7 +50,7 @@ public PlayerQuitListener(BuildSystem plugin) {
public void sendPlayerQuitMessage(PlayerQuitEvent event) {
Player player = event.getPlayer();
String message = plugin.getConfigValues().isJoinQuitMessages()
- ? Messages.getString("player_quit", player, new AbstractMap.SimpleEntry<>("%player%", player.getName()))
+ ? Messages.getLegacyMessage("player.quit", Placeholder.unparsed("player", player.getName()))
: null;
event.setQuitMessage(message);
}
@@ -64,7 +73,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
player.getInventory().clear();
}
- BuildPlayer buildPlayer = playerManager.getBuildPlayer(player);
+ CraftBuildPlayer buildPlayer = playerManager.getBuildPlayer(player);
buildPlayer.setLogoutLocation(new LogoutLocation(
player.getWorld().getName(),
player.getLocation()
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerRespawnListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerRespawnListener.java
index c74ec10b..480ee2fe 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerRespawnListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerRespawnListener.java
@@ -1,14 +1,24 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.settings.Settings;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.settings.CraftSettings;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.world.SpawnManager;
import org.bukkit.entity.Player;
@@ -21,7 +31,7 @@ public class PlayerRespawnListener implements Listener {
private final SettingsManager settingsManager;
private final SpawnManager spawnManager;
- public PlayerRespawnListener(BuildSystem plugin) {
+ public PlayerRespawnListener(BuildSystemPlugin plugin) {
this.settingsManager = plugin.getSettingsManager();
this.spawnManager = plugin.getSpawnManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
@@ -30,7 +40,7 @@ public PlayerRespawnListener(BuildSystem plugin) {
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (settings.isSpawnTeleport() && spawnManager.spawnExists()) {
event.setRespawnLocation(spawnManager.getSpawn());
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerTeleportListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerTeleportListener.java
index c4d69ec2..c35c5a33 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerTeleportListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/PlayerTeleportListener.java
@@ -1,17 +1,27 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.Messages;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.WorldManager;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.messages.MessagesOld;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -22,10 +32,10 @@
public class PlayerTeleportListener implements Listener {
- private final PlayerManager playerManager;
- private final WorldManager worldManager;
+ private final BuildPlayerManager playerManager;
+ private final BuildWorldManager worldManager;
- public PlayerTeleportListener(BuildSystem plugin) {
+ public PlayerTeleportListener(BuildSystemPlugin plugin) {
this.playerManager = plugin.getPlayerManager();
this.worldManager = plugin.getWorldManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
@@ -57,7 +67,7 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
if (!Bukkit.getWorlds().get(0).equals(Bukkit.getWorld(worldName))) {
if (!worldManager.canEnter(player, buildWorld)) {
- Messages.sendMessage(player, "worlds_tp_entry_forbidden");
+ MessagesOld.sendMessage(player, "worlds_tp_entry_forbidden");
event.setCancelled(true);
}
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SettingsInteractListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SettingsInteractListener.java
index f0da781e..f65105d0 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SettingsInteractListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SettingsInteractListener.java
@@ -1,28 +1,38 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XBlock;
import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XTag;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.Builder;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
import de.eintosti.buildsystem.config.ConfigValues;
-import de.eintosti.buildsystem.player.PlayerManager;
-import de.eintosti.buildsystem.settings.Settings;
+import de.eintosti.buildsystem.player.BuildPlayerManager;
+import de.eintosti.buildsystem.settings.CraftSettings;
import de.eintosti.buildsystem.settings.SettingsManager;
import de.eintosti.buildsystem.util.MaterialUtils;
import de.eintosti.buildsystem.version.customblocks.CustomBlocks;
import de.eintosti.buildsystem.version.util.DirectionUtil;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.Builder;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
-import de.eintosti.buildsystem.world.data.WorldStatus;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
@@ -49,13 +59,13 @@ public class SettingsInteractListener implements Listener {
private final ConfigValues configValues;
private final CustomBlocks customBlocks;
- private final PlayerManager playerManager;
+ private final BuildPlayerManager playerManager;
private final SettingsManager settingsManager;
- private final WorldManager worldManager;
+ private final BuildWorldManager worldManager;
private final Set cachePlayers;
- public SettingsInteractListener(BuildSystem plugin) {
+ public SettingsInteractListener(BuildSystemPlugin plugin) {
this.configValues = plugin.getConfigValues();
this.customBlocks = plugin.getCustomBlocks();
@@ -85,8 +95,8 @@ public void manageIronDoorSetting(PlayerInteractEvent event) {
}
Player player = event.getPlayer();
- Settings settings = settingsManager.getSettings(player);
- if (!settings.isTrapDoor()) {
+ CraftSettings settings = settingsManager.getSettings(player);
+ if (!settings.isOpenTrapDoors()) {
return;
}
@@ -120,7 +130,7 @@ public void manageSlabSetting(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (settings.isSlabBreaking() && action == Action.LEFT_CLICK_BLOCK) {
customBlocks.modifySlab(event);
}
@@ -147,7 +157,7 @@ public void managePlacePlantsSetting(PlayerInteractEvent event) {
}
Player player = event.getPlayer();
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (!settings.isPlacePlants()) {
return;
}
@@ -163,7 +173,7 @@ public void manageInstantPlaceSignsSetting(PlayerInteractEvent event) {
}
Player player = event.getPlayer();
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (!settings.isInstantPlaceSigns()) {
return;
}
@@ -246,7 +256,7 @@ public void manageDisabledInteractSetting(PlayerInteractEvent event) {
return;
}
- Settings settings = settingsManager.getSettings(player);
+ CraftSettings settings = settingsManager.getSettings(player);
if (!settings.isDisableInteract()) {
return;
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SignChangeListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SignChangeListener.java
index b80960b3..c874af6d 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SignChangeListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/SignChangeListener.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.util.color.ColorAPI;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -17,7 +27,7 @@
public class SignChangeListener implements Listener {
- public SignChangeListener(BuildSystem plugin) {
+ public SignChangeListener(BuildSystemPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WeatherChangeListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WeatherChangeListener.java
index 913c2488..ecd623cc 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WeatherChangeListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WeatherChangeListener.java
@@ -1,13 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
-import de.eintosti.buildsystem.BuildSystem;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.config.ConfigValues;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -19,7 +29,7 @@ public class WeatherChangeListener implements Listener {
private final ConfigValues configValues;
- public WeatherChangeListener(BuildSystem plugin) {
+ public WeatherChangeListener(BuildSystemPlugin plugin) {
this.configValues = plugin.getConfigValues();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WorldManipulateListener.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WorldManipulateListener.java
index d16dd1aa..bd1a3a7f 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WorldManipulateListener.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/listener/WorldManipulateListener.java
@@ -1,19 +1,29 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
package de.eintosti.buildsystem.listener;
import com.cryptomorin.xseries.XMaterial;
-import de.eintosti.buildsystem.BuildSystem;
-import de.eintosti.buildsystem.world.BuildWorld;
-import de.eintosti.buildsystem.world.Builder;
-import de.eintosti.buildsystem.world.WorldManager;
-import de.eintosti.buildsystem.world.data.WorldData;
-import de.eintosti.buildsystem.world.data.WorldStatus;
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import de.eintosti.buildsystem.api.world.BuildWorld;
+import de.eintosti.buildsystem.api.world.Builder;
+import de.eintosti.buildsystem.api.world.data.WorldData;
+import de.eintosti.buildsystem.api.world.data.WorldStatus;
+import de.eintosti.buildsystem.world.BuildWorldManager;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@@ -31,10 +41,10 @@
public class WorldManipulateListener implements Listener {
- private final BuildSystem plugin;
- private final WorldManager worldManager;
+ private final BuildSystemPlugin plugin;
+ private final BuildWorldManager worldManager;
- public WorldManipulateListener(BuildSystem plugin) {
+ public WorldManipulateListener(BuildSystemPlugin plugin) {
this.plugin = plugin;
this.worldManager = plugin.getWorldManager();
plugin.getServer().getPluginManager().registerEvents(this, plugin);
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/Messages.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/Messages.java
new file mode 100644
index 00000000..589a09ac
--- /dev/null
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/Messages.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.messages;
+
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.minimessage.MiniMessage;
+import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
+import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import org.bukkit.command.CommandSender;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public final class Messages {
+
+ private static final BuildSystemPlugin PLUGIN = JavaPlugin.getPlugin(BuildSystemPlugin.class);
+ private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
+ private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacySection();
+
+ /**
+ * Gets the message with the given key as a component after it was parsed by {@link MiniMessage}
+ * using the given tag resolvers.
+ *
+ * @param key The key of the messages
+ * @param tagResolvers The tag resolvers to apply extra tags from
+ * @return The message as a component
+ */
+ public static Component getMessage(String key, TagResolver... tagResolvers) {
+ String message = MessagesProvider.MESSAGES.get(key);
+ if (message == null) {
+ PLUGIN.getLogger().warning("Could not find message with key '" + key + "'");
+ return Component.empty();
+ }
+
+ return MINI_MESSAGE.deserialize(message, mergeTagResolvers(tagResolvers));
+ }
+
+ /**
+ * Gets the messages with the given key as a list of components after they were parsed by {@link MiniMessage}
+ * using the given tag resolvers.
+ *
+ * @param key The key of the messages
+ * @param tagResolvers The tag resolvers to apply extra tags from
+ * @return The messages as a list of components
+ */
+ public static List getMessages(String key, TagResolver... tagResolvers) {
+ String message = MessagesProvider.MESSAGES.get(key);
+ if (message == null) {
+ PLUGIN.getLogger().warning("Could not find message with key '" + key + "'");
+ return new ArrayList<>();
+ }
+
+ String[] split = message.split("\n");
+ Component[] parsed = new Component[split.length];
+ for (int i = 0; i < split.length; i++) {
+ parsed[i] = MINI_MESSAGE.deserialize(split[i], mergeTagResolvers(tagResolvers));
+ }
+
+ return Arrays.asList(parsed);
+ }
+
+ /**
+ * Merges an array of {@link TagResolver} objects with the prefix tag resolver.
+ *
+ * @param tagResolvers The tag resolvers to merge
+ * @return An array of {@link TagResolver} objects containing the merged resolvers
+ */
+ private static TagResolver[] mergeTagResolvers(TagResolver... tagResolvers) {
+ return Stream.concat(
+ Stream.of(Placeholder.component("prefix", MINI_MESSAGE.deserialize(MessagesProvider.MESSAGES.get("prefix")))),
+ Arrays.stream(tagResolvers)
+ ).toArray(TagResolver[]::new);
+ }
+
+ /**
+ * Gets the message with the given key as a legacy string after it was parsed by {@link MiniMessage}
+ * using the given tag resolvers.
+ *
+ * @param key The key of the messages
+ * @param tagResolvers The tag resolvers to apply extra tags from
+ * @return The message a legacy string
+ * @see #getMessage(String, TagResolver...)
+ */
+ public static String getString(String key, TagResolver... tagResolvers) {
+ return LEGACY_SERIALIZER.serialize(getMessage(key, tagResolvers));
+ }
+
+ /**
+ * Gets the message with the given key as a list of legacy strings after it was parsed by {@link MiniMessage}
+ * using the given tag resolvers.
+ *
+ * @param key The key of the messages
+ * @param tagResolvers The tag resolvers to apply extra tags from
+ * @return The message a legacy string
+ * @see #getMessages(String, TagResolver...)
+ */
+ public static List getStringList(String key, TagResolver... tagResolvers) {
+ List messages = getMessages(key, tagResolvers);
+ return messages.stream()
+ .map(LEGACY_SERIALIZER::serialize)
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * Sends a message to the given sender.
+ *
+ * @param sender The sender
+ * @param key The key of the message to send
+ * @param tagResolvers The tag resolvers to apply extra tags from
+ */
+ public static void sendMessage(CommandSender sender, String key, TagResolver... tagResolvers) {
+ Component message = getMessage(key, tagResolvers);
+ PLUGIN.adventure().sender(sender).sendMessage(message);
+ }
+}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/Messages.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/MessagesOld.java
similarity index 97%
rename from buildsystem-core/src/main/java/de/eintosti/buildsystem/Messages.java
rename to buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/MessagesOld.java
index d117aa37..5d98fa52 100644
--- a/buildsystem-core/src/main/java/de/eintosti/buildsystem/Messages.java
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/MessagesOld.java
@@ -1,12 +1,23 @@
/*
- * Copyright (c) 2023, Thomas Meaney
- * All rights reserved.
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*/
-package de.eintosti.buildsystem;
+package de.eintosti.buildsystem.messages;
+import de.eintosti.buildsystem.BuildSystemPlugin;
import de.eintosti.buildsystem.util.color.ColorAPI;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.Bukkit;
@@ -31,7 +42,13 @@
import java.util.function.Function;
import java.util.stream.Collectors;
-public class Messages {
+/**
+ * TODO: Migrate all messages to MiniMessage and replace this class with {@link Messages}
+ *
+ * @deprecated Use {@link Messages} instead
+ */
+@Deprecated
+public class MessagesOld {
private static final Map MESSAGES = new HashMap<>();
private static final boolean PLACEHOLDER_API_ENABLED = Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null;
@@ -39,7 +56,7 @@ public class Messages {
private static YamlConfiguration config;
public static void createMessageFile() {
- JavaPlugin plugin = JavaPlugin.getPlugin(BuildSystem.class);
+ JavaPlugin plugin = JavaPlugin.getPlugin(BuildSystemPlugin.class);
File file = new File(plugin.getDataFolder(), "messages.yml");
try {
if (file.createNewFile()) {
@@ -894,7 +911,11 @@ private static String getPrefix() {
}
@SafeVarargs
- public static void sendMessage(CommandSender sender, String key, Map.Entry... placeholders) {
+ public static void sendMessage(@Nullable CommandSender sender, String key, Map.Entry... placeholders) {
+ if (sender == null) {
+ return;
+ }
+
Player player = sender instanceof Player ? (Player) sender : null;
String message = getString(key, player, placeholders);
if (!message.isEmpty()) {
@@ -966,9 +987,16 @@ private static String replacePlaceholders(String query, Map.Entry 0
- ? new SimpleDateFormat(JavaPlugin.getPlugin(BuildSystem.class).getConfigValues().getDateFormat()).format(millis)
+ ? new SimpleDateFormat(JavaPlugin.getPlugin(BuildSystemPlugin.class).getConfigValues().getDateFormat()).format(millis)
: "-";
}
}
\ No newline at end of file
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/MessagesProvider.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/MessagesProvider.java
new file mode 100644
index 00000000..bdcfbe3e
--- /dev/null
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/MessagesProvider.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.messages;
+
+import de.eintosti.buildsystem.BuildSystemPlugin;
+import org.apache.commons.io.IOUtils;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+
+public class MessagesProvider {
+
+ protected static final Map MESSAGES = new HashMap<>();
+
+ private final BuildSystemPlugin plugin;
+
+ public MessagesProvider(BuildSystemPlugin plugin) {
+ this.plugin = plugin;
+ }
+
+ /**
+ * Sets up the plugin messages.
+ */
+ public void setup() {
+ copyDefaultMessages();
+ updateMissingMessages();
+ loadMessages();
+ }
+
+ /**
+ * Gets the file in which the plugin messages are stored.
+ *
+ * @return The file in which the plugin messages are stored
+ */
+ private File getMessagesFile() {
+ return new File(plugin.getDataFolder(), "messages.properties");
+ }
+
+ /**
+ * Copies the default messages from the resources folder to the plugin's data folder.
+ */
+ private void copyDefaultMessages() {
+ File messages = getMessagesFile();
+ if (messages.exists()) {
+ return;
+ }
+
+ plugin.getLogger().info("Copying default messages file...");
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+
+ try {
+ inputStream = plugin.getResource("lang/messages.properties");
+ outputStream = Files.newOutputStream(messages.toPath());
+ IOUtils.copy(new InputStreamReader(inputStream, StandardCharsets.UTF_8), outputStream);
+ } catch (IOException e) {
+ plugin.getLogger().severe("Error while copying default messages:");
+ e.printStackTrace();
+ } finally {
+ close(inputStream);
+ close(outputStream);
+ }
+ }
+
+ /**
+ * Checks if any messages are missing in the user's {@code messages.properties} file.
+ * If so, they are added using the default messages as a reference.
+ */
+ private void updateMissingMessages() {
+ Path messagesPath = getMessagesFile().toPath();
+ InputStream messagesInputStream = null;
+ InputStream defaultMessagesInputStream = null;
+ Writer writer = null;
+
+ try {
+ OrderedProperties messagesProperties = new OrderedProperties();
+ messagesInputStream = Files.newInputStream(messagesPath);
+ messagesProperties.load(new InputStreamReader(messagesInputStream, StandardCharsets.UTF_8));
+
+ OrderedProperties defaultProperties = new OrderedProperties();
+ defaultMessagesInputStream = plugin.getResource("lang/messages.properties");
+ defaultProperties.load(new InputStreamReader(defaultMessagesInputStream, StandardCharsets.UTF_8));
+
+ if (messagesProperties.equals(defaultProperties)) {
+ return;
+ }
+
+ plugin.getLogger().info("Updating missing messages...");
+ messagesProperties.entrySet().forEach(property -> defaultProperties.setProperty(property.getKey(), property.getValue()));
+ writer = Files.newBufferedWriter(messagesPath, StandardCharsets.UTF_8);
+ defaultProperties.store(writer, null);
+ } catch (IOException e) {
+ plugin.getLogger().log(Level.SEVERE, "Error while updating missing messages:", e);
+ } finally {
+ close(messagesInputStream);
+ close(defaultMessagesInputStream);
+ close(writer);
+ }
+ }
+
+ /**
+ * Loads and caches the messages stored in the user's {@code messages.properties} file.
+ */
+ private void loadMessages() {
+ InputStream inputStream = null;
+ try {
+ Properties messages = new Properties();
+ inputStream = Files.newInputStream(getMessagesFile().toPath());
+ messages.load(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
+ messages.forEach((key, value) -> MESSAGES.put(key.toString(), value.toString()));
+ } catch (IOException e) {
+ plugin.getLogger().log(Level.SEVERE, "Error while loading messages:", e);
+ } finally {
+ close(inputStream);
+ }
+ }
+
+ private void close(@Nullable Closeable closeable) {
+ if (closeable == null) {
+ return;
+ }
+
+ try {
+ closeable.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/OrderedProperties.java b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/OrderedProperties.java
new file mode 100644
index 00000000..77b1541e
--- /dev/null
+++ b/buildsystem-core/src/main/java/de/eintosti/buildsystem/messages/OrderedProperties.java
@@ -0,0 +1,495 @@
+/*
+ * Copyright (c) 2018-2023, Thomas Meaney
+ * Copyright (c) contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package de.eintosti.buildsystem.messages;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Enumeration;
+import java.util.InvalidPropertiesFormatException;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Vector;
+
+/**
+ * This class provides an alternative to the JDK's {@link Properties} class. It fixes the design flaw of using
+ * inheritance over composition, while keeping up the same APIs as the original class. Keys and values are
+ * guaranteed to be of type {@link String}.
+ *
+ * This class is not synchronized, contrary to the original implementation.
+ *
+ * As additional functionality, this class keeps its properties in a well-defined order. By default, the order
+ * is the one in which the individual properties have been added, either through explicit API calls or through
+ * reading them top-to-bottom from a properties file.
+ *
+ * Also, an optional flag can be set to omit the comment that contains the current date when storing the
+ * properties to a properties file.
+ *
+ * Currently, this class does not support the concept of default properties, contrary to the original implementation.
+ *
+ * Note that this implementation is not synchronized. If multiple threads access ordered
+ * properties concurrently, and at least one of the threads modifies the ordered properties structurally, it
+ * must be synchronized externally. This is typically accomplished by synchronizing on some object
+ * that naturally encapsulates the properties.
+ *
+ * Note that the actual (and quite complex) logic of parsing and storing properties from and to a stream
+ * is delegated to the {@link Properties} class from the JDK.
+ *
+ * @author Etienne Studer
+ * @see Properties
+ */
+final class OrderedProperties implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private transient Map properties;
+ private transient boolean suppressDate;
+
+ /**
+ * Creates a new instance that will keep the properties in the order they have been added. Other than
+ * the ordering of the keys, this instance behaves like an instance of the {@link Properties} class.
+ */
+ OrderedProperties() {
+ this(new LinkedHashMap<>(), true);
+ }
+
+ OrderedProperties(Map properties, boolean suppressDate) {
+ this.properties = properties;
+ this.suppressDate = suppressDate;
+ }
+
+ /**
+ * See {@link Properties#getProperty(String)}.
+ */
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ /**
+ * See {@link Properties#getProperty(String, String)}.
+ */
+ public String getProperty(String key, String defaultValue) {
+ String value = properties.get(key);
+ return (value == null) ? defaultValue : value;
+ }
+
+ /**
+ * See {@link Properties#setProperty(String, String)}.
+ */
+ public String setProperty(String key, String value) {
+ return properties.put(key, value);
+ }
+
+ /**
+ * Removes the property with the specified key, if it is present. Returns
+ * the value of the property, or null if there was no property with
+ * the specified key.
+ *
+ * @param key the key of the property to remove
+ * @return the previous value of the property, or null if there was no property with the specified key
+ */
+ public String removeProperty(String key) {
+ return properties.remove(key);
+ }
+
+ /**
+ * Returns true if there is a property with the specified key.
+ *
+ * @param key the key whose presence is to be tested
+ */
+ public boolean containsProperty(String key) {
+ return properties.containsKey(key);
+ }
+
+ /**
+ * See {@link Properties#size()}.
+ */
+ public int size() {
+ return properties.size();
+ }
+
+ /**
+ * See {@link Properties#isEmpty()}.
+ */
+ public boolean isEmpty() {
+ return properties.isEmpty();
+ }
+
+ /**
+ * See {@link Properties#propertyNames()}.
+ */
+ public Enumeration propertyNames() {
+ return new Vector<>(properties.keySet()).elements();
+ }
+
+ /**
+ * See {@link Properties#stringPropertyNames()}.
+ */
+ public Set stringPropertyNames() {
+ return new LinkedHashSet<>(properties.keySet());
+ }
+
+ /**
+ * See {@link Properties#entrySet()}.
+ */
+ public Set> entrySet() {
+ return new LinkedHashSet<>(properties.entrySet());
+ }
+
+ /**
+ * See {@link Properties#load(InputStream)}.
+ */
+ public void load(InputStream stream) throws IOException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.load(stream);
+ }
+
+ /**
+ * See {@link Properties#load(Reader)}.
+ */
+ public void load(Reader reader) throws IOException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.load(reader);
+ }
+
+ /**
+ * See {@link Properties#loadFromXML(InputStream)}.
+ */
+ @SuppressWarnings("DuplicateThrows")
+ public void loadFromXML(InputStream stream) throws IOException, InvalidPropertiesFormatException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.loadFromXML(stream);
+ }
+
+ /**
+ * See {@link Properties#store(OutputStream, String)}.
+ */
+ public void store(OutputStream stream, String comments) throws IOException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ if (suppressDate) {
+ store(stream, comments, customProperties);
+ } else {
+ customProperties.store(stream, comments);
+ }
+ }
+
+ private void store(OutputStream stream, String comments, CustomProperties properties) throws IOException {
+ if (commentRequiresEscaping(comments) || propertiesRequireEscaping(properties)) {
+ storeViaReflection(stream, comments, properties);
+ } else {
+ properties.store(new DateSuppressingPropertiesBufferedWriter(new OutputStreamWriter(stream, "8859_1")), comments);
+ }
+ }
+
+ private static boolean commentRequiresEscaping(String comments) {
+ return comments != null && comments.chars().anyMatch(c -> c > '\u00ff');
+ }
+
+ @SuppressWarnings("Convert2MethodRef")
+ private static boolean propertiesRequireEscaping(CustomProperties properties) {
+ Map p = properties.targetProperties;
+ return !p.isEmpty() && (p.keySet().stream().anyMatch(k -> keyValueRequiresEscaping(k)) || p.values().stream().anyMatch(v -> keyValueRequiresEscaping(v)));
+ }
+
+ private static boolean keyValueRequiresEscaping(String s) {
+ return s != null && s.chars().anyMatch(c -> (c < 0x0020) || (c > 0x007e));
+ }
+
+ private static void storeViaReflection(OutputStream stream, String comments, CustomProperties customProperties) throws IOException {
+ try {
+ Method method = Properties.class.getDeclaredMethod("store0", BufferedWriter.class, String.class, boolean.class);
+ method.setAccessible(true);
+ method.invoke(customProperties, new DateSuppressingPropertiesBufferedWriter(new OutputStreamWriter(stream, "8859_1")), comments, true);
+ } catch (NoSuchMethodException | IllegalAccessException | SecurityException | InvocationTargetException e) {
+ throw new RuntimeException(e.getCause());
+ }
+ }
+
+ /**
+ * See {@link Properties#store(Writer, String)}.
+ */
+ public void store(Writer writer, String comments) throws IOException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ if (suppressDate) {
+ customProperties.store(new DateSuppressingPropertiesBufferedWriter(writer), comments);
+ } else {
+ customProperties.store(writer, comments);
+ }
+ }
+
+ /**
+ * See {@link Properties#storeToXML(OutputStream, String)}.
+ */
+ public void storeToXML(OutputStream stream, String comment) throws IOException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.storeToXML(stream, comment);
+ }
+
+ /**
+ * See {@link Properties#storeToXML(OutputStream, String, String)}.
+ */
+ public void storeToXML(OutputStream stream, String comment, String encoding) throws IOException {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.storeToXML(stream, comment, encoding);
+ }
+
+ /**
+ * See {@link Properties#list(PrintStream)}.
+ */
+ public void list(PrintStream stream) {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.list(stream);
+ }
+
+ /**
+ * See {@link Properties#list(PrintWriter)}.
+ */
+ public void list(PrintWriter writer) {
+ CustomProperties customProperties = new CustomProperties(this.properties);
+ customProperties.list(writer);
+ }
+
+ /**
+ * Convert this instance to a {@link Properties} instance.
+ *
+ * @return the {@link Properties} instance
+ */
+ public Properties toJdkProperties() {
+ Properties jdkProperties = new Properties();
+ for (Map.Entry entry : this.entrySet()) {
+ jdkProperties.put(entry.getKey(), entry.getValue());
+ }
+ return jdkProperties;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
+
+ OrderedProperties that = (OrderedProperties) other;
+ return Arrays.equals(properties.entrySet().toArray(), that.properties.entrySet().toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(properties.entrySet().toArray());
+ }
+
+ private void writeObject(ObjectOutputStream stream) throws IOException {
+ stream.defaultWriteObject();
+ stream.writeObject(properties);
+ stream.writeBoolean(suppressDate);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
+ stream.defaultReadObject();
+ properties = (Map) stream.readObject();
+ suppressDate = stream.readBoolean();
+ }
+
+ private void readObjectNoData() throws InvalidObjectException {
+ throw new InvalidObjectException("Stream data required");
+ }
+
+ /**
+ * See {@link Properties#toString()}.
+ */
+ @Override
+ public String toString() {
+ return properties.toString();
+ }
+
+ /**
+ * Creates a new instance that will have both the same property entries and
+ * the same behavior as the given source.
+ *
+ * Note that the source instance and the copy instance will share the same
+ * comparator instance if a custom ordering had been configured on the source.
+ *
+ * @param source the source to copy from
+ * @return the copy
+ */
+ public static OrderedProperties copyOf(OrderedProperties source) {
+ // create a copy that has the same behaviour
+ OrderedPropertiesBuilder builder = new OrderedPropertiesBuilder();
+ builder.withSuppressDateInComment(source.suppressDate);
+ if (source.properties instanceof TreeMap) {
+ builder.withOrdering(((TreeMap) source.properties).comparator());
+ }
+ OrderedProperties result = builder.build();
+
+ // copy the properties from the source to the target
+ for (Map.Entry entry : source.entrySet()) {
+ result.setProperty(entry.getKey(), entry.getValue());
+ }
+ return result;
+ }
+
+ /**
+ * Builder for {@link OrderedProperties} instances.
+ */
+ public static final class OrderedPropertiesBuilder {
+
+ private Comparator super String> comparator;
+ private boolean suppressDate;
+
+ /**
+ * Use a custom ordering of the keys.
+ *
+ * @param comparator the ordering to apply on the keys
+ * @return the builder
+ */
+ public OrderedPropertiesBuilder withOrdering(Comparator super String> comparator) {
+ this.comparator = comparator;
+ return this;
+ }
+
+ /**
+ * Suppress the comment that contains the current date when storing the properties.
+ *
+ * @param suppressDate whether to suppress the comment that contains the current date
+ * @return the builder
+ */
+ public OrderedPropertiesBuilder withSuppressDateInComment(boolean suppressDate) {
+ this.suppressDate = suppressDate;
+ return this;
+ }
+
+ /**
+ * Builds a new {@link OrderedProperties} instance.
+ *
+ * @return the new instance
+ */
+ public OrderedProperties build() {
+ Map properties = (this.comparator != null) ?
+ new TreeMap<>(comparator) :
+ new LinkedHashMap<>();
+ return new OrderedProperties(properties, suppressDate);
+ }
+
+ }
+
+ /**
+ * Custom {@link Properties} that delegates reading, writing, and enumerating properties to the
+ * backing {@link OrderedProperties} instance's properties.
+ */
+ private static final class CustomProperties extends Properties {
+
+ private final Map targetProperties;
+
+ private CustomProperties(Map targetProperties) {
+ this.targetProperties = targetProperties;
+ }
+
+ @Override
+ public Object get(Object key) {
+ return targetProperties.get(key);
+ }
+
+ @Override
+ public Object put(Object key, Object value) {
+ return targetProperties.put((String) key, (String) value);
+ }
+
+ @Override
+ public String getProperty(String key) {
+ return targetProperties.get(key);
+ }
+
+ @Override
+ public Enumeration