diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..e1b583d9c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+/.idea/
+/.gradle/
+/testbed/
+/build/
+gradle.properties
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_bukkit_bukkit_1_12_2_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_bukkit_bukkit_1_12_2_R0_1_SNAPSHOT.xml
deleted file mode 100644
index 49760b2e5..000000000
--- a/.idea/libraries/Maven__org_bukkit_bukkit_1_12_2_R0_1_SNAPSHOT.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml
deleted file mode 100644
index 42f0d6f90..000000000
--- a/.idea/libraries/Maven__org_spigotmc_spigot_api_1_12_2_R0_1_SNAPSHOT.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml
deleted file mode 100644
index 33ccf19e2..000000000
--- a/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..f288702d2
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ 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.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ 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 .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/README.md b/README.md
index 83b5dcc7f..6e6f553bb 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,317 @@
-# EliteMobs
+[](https://crowdin.com/project/elitemobs)
-This is the GitHub project for the Minecraft plugin EliteMobs (Spigot page can be seen here: https://www.spigotmc.org/resources/elitemobs.40090/)
+[](https://bstats.org/plugin/bukkit/EliteMobs/1081)
-Feel free to check the source code and do any edits you might deem necessary for your own servers.
+EliteMobs is a Spigot plugin focused around the creation of bosses. It also adds several other features, such as quests,
+arenas, items, an extension to in-game progression and dungeons, to name a few.
-At this time, I am not interested in accepting contributions to the code. This is my first project of this dimension, and I'd like to have all components of it be written by me.
+Feature and configuration documentation: https://github.com/MagmaGuy/EliteMobs/wiki
-That being said, I am deeply interested in any suggestions, be they for improving existing features or creating new ones.
+Discord support channel: https://discord.gg/QSA2wgh
-# There's a wiki, it has a few entries, if you want more info maybe try reading it.
+Webapp where you can create content: https://magmaguy.com/webapp/webapp.html
-# //TODO: add description of features and how they work, some day, maybe
\ No newline at end of file
+# Dev notes:
+
+## Repository
+
+---
+
+Maven repository:
+
+Maven:
+```
+
+ elitemobs-repo
+ https://s01.oss.sonatype.org/content/repositories/snapshots
+
+
+
+ com.magmaguy
+ EliteMobs
+ 9.0.2-SNAPSHOT
+ provided
+
+```
+
+Gradle:
+```kotlin
+repositories {
+ //EliteMobs
+ maven { url = 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
+}
+
+dependencies{
+ //EliteMobs
+ compileOnly group: 'com.magmaguy', name: 'EliteMobs', version: '9.0.2-SNAPSHOT'
+}
+
+```
+
+---
+
+## Important classes
+
+The following is a list of key classes for the plugin:
+
+### EliteItemManager:
+
+`com.magmaguy.elitemobs.api.utils.EliteItemManager`
+
+This class is specifically made to be the easiest way to interface with Elite Items.
+
+### EliteEntity, CustomBossEntity, RegionalBossEntity
+
+These are the key classes for the boss system. RegionalBossEntity extends CustomBossEntity which extends EliteEntity.
+
+### EntityTracker
+
+This is used to check if an entity is from EliteMobs and to get the specific instance of that entity.
+
+---
+
+`Note: This documentation is updated as requested. If you feel like it is incomplete and should further expand on some aspects, request it and it will be updated.`
+
+---
+
+## API Events
+
+EliteMobs has a few basic APIs to interface with in the `com.magmaguy.elitemobs.api` package. Here's the breakdown:
+
+### ArenaCompleteEvent
+
+Fires when an arena is successfully beaten by players.
+
+### CustomEventStartEvent
+
+Fires when a Custom Event starts. Note that in this instance Custom Events refers to the mechanic in which bosses
+randomly spawn in the Overworld.
+
+- Can be cancelled
+
+### DungeonInstallEvent
+
+Fires when a dungeon is installed by an admin.
+
+- Can be cancelled
+
+### DungeonUninstallEvent
+
+Fires when a dungeon is uninstalled by an admin.
+
+- Can be cancelled
+
+### EliteExplosionEvent
+
+Fires when an Elite Explosion happens. Note that elite explosions have a custom visual effect and regenerate the damage
+done to terrain after 2 minutes.
+
+- Can be cancelled
+
+### EliteMobDamagedByEliteMobEvent
+
+Used for listening to moments when one Elite damages another Elite. Uses:
+
+- Same as Bukkit's EntityDamagedByEntity event but for elites specifically
+- Cancelling it might not work. Report if it doesn't.
+
+### EliteMobDamagedByPlayerAntiExploitEvent
+
+Used for listening to events which trigger an antiexploit **check** - doesn't necessarily mean that it detected an
+exploit. Uses:
+
+- Same as Bukkit's EntityDamagedByEntity event but for elites specifically
+- Can be cancelled
+
+### EliteMobDamagedByPlayerEvent:
+
+Used for listening to moments when a player damages an Elite. Uses:
+
+- Same as Bukkit's EntityDamagedByEntity event but for players damaging elites specifically
+- ***Important:*** can't be cancelled as it only fires after applying the damage
+
+### EliteMobDamagedEvent:
+
+Used for listening to moments when an elite is damaged in general. Uses:
+
+- Same as Bukkit's EntityDamageEvent
+- ***Important*** Cancelling this event might not 100% work, report if it doesn't
+
+### EliteMobDeathEvent:
+
+Used to listening to moments when an elite is killed. Uses:
+
+- Same as Bukkit's EntityDeathEvent.
+
+### EliteMobEnterCombatEvent:
+
+Used for listening to moments when an elite enters combat against a player. Note that bosses only enter combat after
+either striking a player or being struck, and not at the moment of targetting. Uses:
+
+- Get the target (player only) of the Elite
+- Get the elite which entered in combat
+
+### EliteMobExitCombatEvent:
+
+Used for listening to moments when an elite leaves combat against a player. Uses:
+
+- Get the elite which just let combat.
+
+### EliteMobHealEvent:
+
+Used when an elite gets healed.
+
+- Can be cancelled.
+
+### EliteMobRemoveEvent:
+
+Used when an elite mob gets removed. Please note that not all removals are permanent as bosses can be removed because
+the chunks unload while still being persistent.
+
+### EliteMobsItemDetector: //todo: remove
+
+Used for detecting whether an ItemStack is an EliteMobs ItemStack (like a custom item or a procedurally generated item).
+Uses:
+
+- Detect if an ItemStack is an EliteMobs custom or dynamic item.
+
+### EliteMobSpawnEvent:
+
+Used for detecting when an Elite spawns. Uses:
+
+- Detect when an Elite spawns.
+- Detect which Elite spawned.
+
+### EliteMobTargetPlayerEvent:
+
+Used for detecting when an Elite has targetted a player. Uses:
+
+- Detect when an Elite targets a player.
+- Cancel an Elite's detection of a player.
+
+### GenericAntiExploitEvent:
+
+Used for listening to moments when the antiexploit runs a check but no players damaged it. Uses:
+
+- Detect when the antiexploit is doing a non-player based exploit check.
+- Cancel an antiexploit check.
+
+### NPCEntityRemoveEvent:
+
+Used when an npc gets removed. This removal may not be permanent, as it might just be a chunk unload.
+
+### NPCEntitySpawnEvent:
+
+Used when an npc gets spawned.
+
+### PlayerDamagedByEliteMobEvent:
+
+Used for listening to moments when players are damaged by an Elite. Uses:
+
+- Same as Bukkit's EntityDamageEvent.
+
+### PlayerPreTeleportEvent:
+
+Used when a player starts teleporting through EliteMobs features. There is a 3 second timer before the teleportation
+actually happens.
+
+- Can be cancelled.
+
+### PlayerTeleportEvent:
+
+Used when a player actually teleports through EliteMobs features.
+
+- Can be cancelled.
+
+### QuestAcceptEvent:
+
+Used when a player accepts a quest.
+
+- Can be cancelled.
+
+### QuestCompleteEvent:
+
+Used when a player completes a quest.
+
+- Can be cancelled.
+
+### QuestLeaveEvent:
+
+Used when a player leaves a quest.
+
+### QuestObjectivesCompletedEvent:
+
+Used when all quest objectives for a quest are completed.
+
+### QuestProgressionEvent:
+
+Used when a player progresses in a quest, such as by killing a quest mob or collecting a quest item.
+
+### QuestRewardEvent:
+
+Used when a player gets the reward from a quest.
+
+### SuperMobDamageEvent:
+
+Used when a Super Mob gets damaged.
+
+- Can be cancelled.
+
+### SuperMobDeathEvent:
+
+Used when a Super Mob dies.
+
+### SuperMobRemoveEvent:
+
+Used when a Super Mob gets removed. Note that removals might be temporary due to chunk unloads.
+
+### SuperMobSpawnEvent:
+
+Used when a Super Mob spawns.
+
+- Can be cancelled.
+
+---
+
+## To add new item enchantments:
+
+1) Add new enchantment class to the `com.magmaguy.elitemobs.config.enchantments.premade` **
+ extending** `EnchantmentsConfigFields` to initialize create its config file (naming convention: [EnchantmentName]
+ Config)
+2) Initialize enchantment in `CustomEnchantment` to initialize the config file
+3) Add enchantment class to `com.magmaguy.elitemobs.items.customenchantments` **extending** `CustomEnchantment` to write
+ the logic for the enchantment (naming convention [EnchantmentName]Enchantment)
+4) Add a public static String called "key" to register using the ItemTagger class for persistent enchantment tracking
+5) Add an entry to the parseEnchantments() method in `CustomItem` so custom items detect it correctly
+6) (Alternative) Add an entry to `generateCustomEnchantments()` method in `EnchantmentGenerator` if the enchantment
+ should appear in procedurally generated items
+
+Note:
+
+- Don't forget to register events in `EventsRegistrer` if the part with logic in it requires events.
+- Don't forget to use the damage bypass if the power is supposed to deal custom damage. Damage dealt by the player to an
+ elite can be overwritten in `CombatSystem` through the static "bypass" boolean field - it makes the next damage dealt
+ to the elite use the raw damage value. For correctly assigning damage, use
+ Bukkit's `Damageable#damage(double amount, Entity source)` and assign the source to your player.
+
+## To add new powers to elites:
+
+to be documented
+
+## To add new events:
+
+to be documented
+
+## To add new default NPCs:
+
+to be documented
+
+## To add new mob types:
+
+to be documented
+
+## Special thanks:
+
+Special Thanks to Illusion for spending a few hours proselytizing enums that are also have anonymous method
+implementations on their constructor.
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 000000000..da02e0566
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,171 @@
+plugins {
+ id 'java-library'
+ id 'idea'
+ id 'maven-publish'
+ id("io.github.goooler.shadow") version "8.1.8"
+ id 'signing'
+}
+
+//Fixes issues related to special characters being used
+compileJava.options.encoding = "UTF-8"
+compileTestJava.options.encoding = "UTF-8"
+
+java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ }
+}
+
+//Fixes issues with utf-8 in the translations files.
+processResources {
+ def props = [version: version]
+ inputs.properties props
+ filteringCharset 'UTF-8'
+ filesMatching('plugin.yml') {
+ expand props
+ }
+}
+
+group 'com.magmaguy'
+version '9.1.8'
+
+repositories {
+ maven {
+ url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
+
+ // As of Gradle 5.1, you can limit this to only those
+ // dependencies you expect from it
+ content {
+ includeGroup 'org.bukkit'
+ includeGroup 'org.spigotmc'
+ }
+ }
+
+ mavenCentral()
+ jcenter()
+ mavenLocal()
+
+ //Spigot API & CloudCommands
+ maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots" }
+
+ //MagmaCore
+ maven {
+ url = 'https://repo.magmaguy.com/releases'
+ }
+ //MagmaCore
+ maven {
+ url = 'https://repo.magmaguy.com/snapshots'
+ }
+
+ //Bstats API
+ maven { url = 'https://repo.codemc.org/repository/maven-public' }
+ //Vault
+ maven { url = 'https://jitpack.io' }
+ //DiscordSRV
+ maven { url = 'https://m2.dv8tion.net/releases/' }
+ maven { url = 'https://nexus.scarsz.me/content/groups/public/' }
+ //LibsDisguises
+ maven { url = 'https://repo.md-5.net/content/groups/public/' }
+ //PlaceholderAPI
+ maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
+ //WorldGuard API
+ maven { url = 'https://maven.enginehub.org/repo/' }
+ //Model Engine
+ maven {
+ url = 'https://mvn.lumine.io/repository/maven-public/'
+ metadataSources {
+ artifact()
+ }
+ }
+}
+
+dependencies {
+ //Spigot API
+ compileOnly "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT"
+ //WorldGuard API
+ compileOnly group: 'com.sk89q.worldguard', name: 'worldguard-bukkit', version: '7.0.7'
+ //Vault
+ compileOnly("com.github.MilkBowl:VaultAPI:1.7") {
+ exclude group: 'org.bukkit', module: 'bukkit'
+ }
+ //DiscordSRV
+ compileOnly 'com.discordsrv:discordsrv:1.24.0'
+ //SQLite
+ compileOnly group: 'org.xerial', name: 'sqlite-jdbc', version: '3.32.3'
+ //MySQL
+ compileOnly 'mysql:mysql-connector-java:8.0.33'
+ //LibsDisguises
+ compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '4.7.0'
+ compileOnly group: 'LibsDisguises', name: 'LibsDisguises', version: '10.0.26'
+ //PlaceholderAPI
+ compileOnly group: 'me.clip', name: 'placeholderapi', version: '2.10.9'
+ //lombok
+ compileOnly 'org.projectlombok:lombok:1.18.34'
+ annotationProcessor 'org.projectlombok:lombok:1.18.34'
+ //Model Engine - legacy
+ compileOnly "com.ticxo.modelengine:api:R3.1.7"
+ //Free Minecraft Models
+ compileOnly group: 'com.magmaguy', name: 'FreeMinecraftModels', version: '1.4.2'
+ // Mythic Mobs integration - currently only for arenas
+ compileOnly group: 'io.lumine', name: 'Mythic-Dist', version: '5.3.5'
+
+ ///Shaded in
+ implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1'
+ implementation group: 'commons-io', name: 'commons-io', version: '2.7'
+ implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
+ implementation group: 'com.magmaguy', name: 'EasyMinecraftGoals-dist', version: '1.13.0'
+ implementation group: 'com.magmaguy', name: 'MagmaCore', version: '1.0-SNAPSHOT'
+
+}
+
+artifacts { // task 'build' runs generates uberjar
+ archives shadowJar
+}
+
+jar {
+ archiveClassifier.set('min') // we want the Uberjar to be distributed, this is the minified version
+}
+
+String packagePath = 'com.magmaguy.shaded'
+
+// Relocating a Package
+shadowJar {
+ dependencies {
+ relocate('org.bstats', packagePath + '.bstats')
+ }
+ archiveClassifier.set(null)
+ archiveFileName.set(project.name + ".jar")
+ destinationDirectory.set(new File("testbed/plugins"))
+}
+
+publishing {
+ repositories {
+ maven {
+ name = "EliteMobs"
+ url = "http://magmaguy.com:50001/releases"
+ credentials {
+ username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user"
+ password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password"
+ }
+ allowInsecureProtocol = true
+ }
+ }
+
+ publications {
+ mavenJava(MavenPublication) {
+ pom {
+ groupId = 'com.magmaguy'
+ name = 'elitemobs'
+ description = 'EliteMobs repo'
+ url = 'https://magmaguy.com/'
+ from components.java
+ licenses {
+ license {
+ name = 'GPLV3'
+ url = 'https://www.gnu.org/licenses/gpl-3.0.en.html'
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 000000000..7454180f2
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..a59520664
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index e9421a232..000000000
--- a/pom.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
- 4.0.0
-
- com.magmaguy
- EliteMobs
- 6.6.5
- jar
-
-
- UTF-8
-
-
-
- ${project.artifactId}
- clean resources:resources package
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.6.2
-
- 1.8
- 1.8
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 2.3
-
- false
-
-
- org.bstats:*
-
-
-
-
- org.bstats
-
- com.magmaguy.elitemobs
-
-
-
-
-
- package
-
- shade
-
-
-
-
-
-
-
-
-
- spigotmc-repo
- https://hub.spigotmc.org/nexus/content/groups/public/
-
-
- bstats-repo
- http://repo.bstats.org/content/repositories/releases/
-
-
-
-
-
-
- org.spigotmc
- spigot-api
- 1.12.2-R0.1-SNAPSHOT
- provided
-
-
-
- org.bukkit
- bukkit
- 1.12.2-R0.1-SNAPSHOT
- provided
-
-
-
- org.bstats
- bstats-bukkit
- 1.1
-
-
-
-
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 000000000..7366956e3
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,6 @@
+pluginManagement {
+ plugins {
+ id 'org.jetbrains.kotlin.jvm' version '1.9.23'
+ }
+}
+rootProject.name = "EliteMobs"
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java b/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java
deleted file mode 100644
index 59721b1b2..000000000
--- a/src/main/java/com/magmaguy/elitemobs/ChatColorConverter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs;
-
-import org.bukkit.ChatColor;
-
-/**
- * Created by MagmaGuy on 13/05/2017.
- */
-public class ChatColorConverter {
-
- public static String convert(String string) {
-
- return ChatColor.translateAlternateColorCodes('&', string);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/CrashFix.java b/src/main/java/com/magmaguy/elitemobs/CrashFix.java
new file mode 100644
index 000000000..978d7bb92
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/CrashFix.java
@@ -0,0 +1,88 @@
+package com.magmaguy.elitemobs;
+
+import com.magmaguy.elitemobs.utils.ChunkVectorizer;
+import com.magmaguy.elitemobs.utils.PersistentVanillaData;
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.World;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.world.ChunkLoadEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.HashSet;
+
+public class CrashFix implements Listener {
+
+ private static final HashSet temporarilyCachedChunks = new HashSet<>();
+ public static String key = "EliteMobsCullable";
+ public static String fallingBlocksKey = "VisualFallingBlocks";
+ public static HashSet knownSessionChunks = new HashSet<>();
+
+ public static void persistentTracker(Entity entity) {
+ PersistentVanillaData.write(entity, key, "delete_me");
+ }
+
+ public static void registerVisualFallingBlock(Entity entity) {
+ PersistentVanillaData.write(entity, fallingBlocksKey, "delete_me");
+ }
+
+ public static boolean isPersistentEntity(Entity entity) {
+ return PersistentVanillaData.hasString(entity, key);
+ }
+
+ public static boolean isVisualFallingBlock(Entity entity) {
+ return PersistentVanillaData.hasString(entity, fallingBlocksKey);
+ }
+
+ public static void startupCheck() {
+ for (World world : Bukkit.getWorlds())
+ for (Chunk chunk : world.getLoadedChunks()) {
+ chunkCheck(chunk);
+ knownSessionChunks.add(ChunkVectorizer.hash(chunk));
+ }
+ }
+
+ private static void chunkCheck(Chunk chunk) {
+ for (Entity entity : chunk.getEntities())
+ if (isPersistentEntity(entity))
+ entity.remove();
+ }
+
+ /**
+ * This runs during startup. There is currently an issue with entities not getting scanned correctly when the chunk
+ * loads, as well as an issue with double chunk loading. Additionally, since all elites are initialized during startup,
+ * delaying the chunk by 1 tick causes the valid entities to be deleted as soon as they load in. To fix this, entities
+ * that exist in a chunk when it is loaded are instead cached, and the chunk getting loaded is cached as well. The
+ * chunk cache prevents a double check from happening, and entity cache prevents the plugin from scanning entities
+ * other than the ones that persisted through a restart.
+ *
+ * @param chunk
+ */
+ private static void delayedChunkCheck(Chunk chunk, int hashedChunk) {
+ Entity[] entities = chunk.getEntities().clone();
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ for (Entity entity : entities)
+ if (isPersistentEntity(entity))
+ entity.remove();
+ temporarilyCachedChunks.remove(hashedChunk);
+ }
+ }.runTaskLater(MetadataHandler.PLUGIN, 1);
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void onChunkLoad(ChunkLoadEvent event) {
+ int hashedChunk = ChunkVectorizer.hash(event.getChunk());
+ //For some reason there is double chunk loading going on, and entities aren't getting detected correctly
+ if (temporarilyCachedChunks.contains(hashedChunk)) return;
+ temporarilyCachedChunks.add(hashedChunk);
+ if (knownSessionChunks.contains(hashedChunk)) return;
+ knownSessionChunks.add(hashedChunk);
+ delayedChunkCheck(event.getChunk(), hashedChunk);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java
index 92a9358e3..e57279907 100644
--- a/src/main/java/com/magmaguy/elitemobs/EliteMobs.java
+++ b/src/main/java/com/magmaguy/elitemobs/EliteMobs.java
@@ -4,61 +4,190 @@
* Created by MagmaGuy on 07/10/2016.
*/
+import com.magmaguy.easyminecraftgoals.NMSManager;
import com.magmaguy.elitemobs.commands.CommandHandler;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.DefaultConfig;
-import com.magmaguy.elitemobs.config.ValidMobsConfig;
-import com.magmaguy.elitemobs.events.EventLauncher;
-import com.magmaguy.elitemobs.items.CustomItemConstructor;
-import com.magmaguy.elitemobs.items.customenchantments.CustomEnchantmentCache;
-import com.magmaguy.elitemobs.items.uniqueitems.UniqueItemInitializer;
-import com.magmaguy.elitemobs.mobconstructor.CombatSystem;
+import com.magmaguy.elitemobs.config.*;
+import com.magmaguy.elitemobs.config.commands.CommandsConfig;
+import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfig;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
+import com.magmaguy.elitemobs.config.customevents.CustomEventsConfig;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig;
+import com.magmaguy.elitemobs.config.customspawns.CustomSpawnConfig;
+import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig;
+import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfig;
+import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig;
+import com.magmaguy.elitemobs.config.menus.MenusConfig;
+import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig;
+import com.magmaguy.elitemobs.config.npcs.NPCsConfig;
+import com.magmaguy.elitemobs.config.potioneffects.PotionEffectsConfig;
+import com.magmaguy.elitemobs.config.powers.PowersConfig;
+import com.magmaguy.elitemobs.config.wormholes.WormholeConfig;
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import com.magmaguy.elitemobs.economy.VaultCompatibility;
+import com.magmaguy.elitemobs.entitytracker.CustomProjectileData;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.events.ActionEvent;
+import com.magmaguy.elitemobs.events.TimedEvent;
+import com.magmaguy.elitemobs.explosionregen.Explosion;
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import com.magmaguy.elitemobs.items.LootTables;
+import com.magmaguy.elitemobs.items.customenchantments.CustomEnchantment;
+import com.magmaguy.elitemobs.items.customitems.CustomItem;
+import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
+import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomMusic;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
import com.magmaguy.elitemobs.mobconstructor.mobdata.PluginMobProperties;
-import com.magmaguy.elitemobs.mobpowers.majorpowers.SkeletonTrackingArrow;
-import com.magmaguy.elitemobs.playerdata.PlayerData;
+import com.magmaguy.elitemobs.npcs.NPCEntity;
+import com.magmaguy.elitemobs.pathfinding.Navigation;
+import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.powers.scripts.ScriptAction;
import com.magmaguy.elitemobs.powerstances.MajorPowerStanceMath;
import com.magmaguy.elitemobs.powerstances.MinorPowerStanceMath;
-import com.magmaguy.elitemobs.runnables.*;
+import com.magmaguy.elitemobs.quests.DynamicQuest;
+import com.magmaguy.elitemobs.quests.QuestTracking;
+import com.magmaguy.elitemobs.thirdparty.bstats.CustomCharts;
+import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel;
+import com.magmaguy.elitemobs.thirdparty.custommodels.modelengine.ModelEngineReservedAddresses;
+import com.magmaguy.elitemobs.thirdparty.libsdisguises.DisguiseEntity;
+import com.magmaguy.elitemobs.thirdparty.placeholderapi.Placeholders;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility;
+import com.magmaguy.elitemobs.treasurechest.TreasureChest;
+import com.magmaguy.elitemobs.utils.BossBarUtil;
+import com.magmaguy.elitemobs.utils.ServerTime;
import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
-import com.magmaguy.elitemobs.versionnotifier.VersionWarner;
-import org.bstats.Metrics;
+import com.magmaguy.elitemobs.wormhole.Wormhole;
+import com.magmaguy.magmacore.MagmaCore;
+import com.magmaguy.magmacore.util.Logger;
+import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.World;
-import org.bukkit.entity.Arrow;
+import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class EliteMobs extends JavaPlugin {
public static List validWorldList = new ArrayList();
+ public static boolean worldGuardIsEnabled = false;
+ public static Metrics metrics;
+ public Object placeholders = null;
+
+ public static void initializeConfigs() {
+ //Initialized translations
+ new DefaultConfig();
+ new ItemSettingsConfig();
+ new ProceduralItemGenerationSettingsConfig();
+ PotionEffectsConfig.initializeConfigs();
+ new EconomySettingsConfig();
+ new EventsConfig();
+ new EnchantmentsConfig();
+ new AntiExploitConfig();
+ new CombatTagConfig();
+ new AntiExploitConfig();
+ new AdventurersGuildConfig();
+ new ValidWorldsConfig();
+
+ new MenusConfig();
+ new PowersConfig();
+ MobPropertiesConfig.initializeConfigs();
+ CustomEnchantment.initializeCustomEnchantments();
+
+ new MobCombatSettingsConfig();
+ CommandsConfig.initializeConfigs();
+ new DiscordSRVConfig();
+ new CustomEventsConfig();
+ new QuestsConfig();
+ new WormholesConfig();
+ new ArenasConfig();
+ //ModelsConfig.initializeConfig();
+ new DungeonsConfig();
+ new SoundsConfig();
+ }
+
+ public static void worldScanner() {
+ for (World world : Bukkit.getWorlds())
+ if (ValidWorldsConfig.getInstance().getFileConfiguration().getBoolean("Valid worlds." + world.getName())) {
+ validWorldList.add(world);
+ }
+
+ }
@Override
public void onEnable() {
+ Bukkit.getLogger().info(" _____ _ _____ _____ ________ ______________ _____");
+ Bukkit.getLogger().info("| ___| | |_ _|_ _| ___| \\/ | _ | ___ \\/ ___|");
+ Bukkit.getLogger().info("| |__ | | | | | | | |__ | . . | | | | |_/ /\\ `--.");
+ Bukkit.getLogger().info("| __|| | | | | | | __|| |\\/| | | | | ___ \\ `--. \\");
+ Bukkit.getLogger().info("| |___| |_____| |_ | | | |___| | | \\ \\_/ / |_/ //\\__/ /");
+ Bukkit.getLogger().info("\\____/\\_____/\\___/ \\_/ \\____/\\_| |_/\\___/\\____/ \\____/");
+ Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion());
+
+ if (VersionChecker.serverVersionOlderThan(21, 0)) {
+ Logger.warn("You are running a Minecraft version older than 1.21.0! EliteMobs 9.0 and later are only compatible with Minecraft 1.21.0 or later, if you are running an older Minecraft version you will need to use a pre-9.0 version of EliteMobs.");
+ Bukkit.getPluginManager().disablePlugin(this);
+ return;
+ }
+
+ ServerTime.startTickCounter();
+
+ NMSManager.initializeAdapter(this);
+
+ if (Bukkit.getServer().spigot().getConfig().getDouble("settings.attribute.maxHealth.max") < 100000000) {
+ Bukkit.getServer().spigot().getConfig().set("settings.attribute.maxHealth.max", 100000000);
+ try {
+ File spigotConfigContainer = new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getParentFile().getCanonicalFile().getParentFile().toString() + "/spigot.yml").toString());
+ Bukkit.getServer().spigot().getConfig().save(spigotConfigContainer);
+ Logger.info("New default max health set correctly!");
+ } catch (IOException e) {
+ Logger.warn("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000);
+ }
+ }
+
+ //Remove entities that should not exist
+ CrashFix.startupCheck();
- //Enable stats
- Metrics metrics = new Metrics(this);
+ /*
+ New config loading
+ */
+ initializeConfigs();
- //Initialize custom enchantments
- CustomEnchantmentCache.initialize();
+ if (Bukkit.getPluginManager().isPluginEnabled("LibsDisguises")) DisguiseEntity.initialize();
- //Load loot from config
- ConfigValues.intializeConfigurations();
- ConfigValues.initializeCachedConfigurations();
+ //Initializes custom models
+ CustomModel.initialize();
+ //Reserves ModelEngine addresses if present
+ ModelEngineReservedAddresses.reserve();
- //Parse loot
- CustomItemConstructor superDrops = new CustomItemConstructor();
- superDrops.superDropParser();
+ if (worldGuardIsEnabled) Logger.info("WorldGuard compatibility is enabled!");
+ else Logger.info("WorldGuard compatibility is not enabled!");
- UniqueItemInitializer.initialize();
+ //Enable Vault
+ try {
+ VaultCompatibility.vaultSetup();
+ } catch (Exception e) {
+ Logger.warn("Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error.");
+ VaultCompatibility.VAULT_ENABLED = false;
+ }
//Hook up all listeners, some depend on config
EventsRegistrer.registerEvents();
//Launch the local data cache
- PlayerData.initializePlayerData();
- PlayerData.synchronizeDatabases();
+ new DatabaseConfig();
+ PlayerData.initializeDatabaseConnection();
+ ElitePlayerInventory.initialize();
//Get world list
worldScanner();
@@ -66,15 +195,9 @@ public void onEnable() {
//Start the repeating tasks such as scanners
launchRunnables();
- //Commands
- this.getCommand("elitemobs").setExecutor(new CommandHandler());
-
//launch events
- EventLauncher eventLauncher = new EventLauncher();
- eventLauncher.eventRepeatingTask();
-
- //launch internal clock for attack cooldown
- CombatSystem.launchInternalClock();
+ ActionEvent.initializeBlueprintEvents();
+ TimedEvent.initializeBlueprintEvents();
/*
Initialize mob values
@@ -87,69 +210,150 @@ public void onEnable() {
MinorPowerStanceMath.initializeVectorCache();
MajorPowerStanceMath.initializeVectorCache();
- /*
- Check for new plugin version
- */
- VersionChecker.updateComparer();
- if (!VersionChecker.pluginIsUpToDate)
- this.getServer().getPluginManager().registerEvents(new VersionWarner(), this);
+ // Small check to make sure that PlaceholderAPI is installed
+ if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
+ Placeholders placeholders = new Placeholders();
+ placeholders.register();
+ this.placeholders = placeholders;
+ }
- }
+ //Enable stats
+ metrics = new Metrics(this, 1081);
+ //Initialize custom charts
+ new CustomCharts();
+
+ //Imports custom configurations and mindungeons from the import folder
+// ConfigurationImporter.initializeConfigs();
+ MagmaCore.initializeImporter();
+ ConfigurationExporter.initializeConfigs();
+
+ //Import custom items after potentially importing new items
+ new CustomItemsConfig();
+ CustomItem.initializeCustomItems();
+ LootTables.initialize();
+
+ //Initialize em package content, such as world loading
+ new DungeonPackagerConfig();
+
+ //Initialize custom & regional bosses
+ new CustomBossesConfig();
+ //Initialize treasure chests
+ new CustomTreasureChestsConfig();
+ //Initialize npcs
+ new NPCsConfig();
+ //Initialize wormholes
+ new WormholeConfig();
+ //Arenas
+ new CustomArenasConfig();
+
+ //Initialize em package content
+ for (EMPackage emPackage : EMPackage.getEmPackages().values())
+ try {
+ if (emPackage.isInstalled()) emPackage.initializeContent();
+ } catch (Exception exception) {
+ Logger.warn("Failed to load EliteMobs Package " + emPackage.getDungeonPackagerConfigFields().getFilename() + " !");
+ exception.printStackTrace();
+ }
+
+
+ //Initialize custom spawn methods, this runs late because it compares loaded worlds against worlds listed in the config
+ try {
+ new CustomSpawnConfig();
+ } catch (Exception ex) {
+ Logger.warn("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version" +
+ " you are running.");
+ Logger.warn(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus).");
+ }
+
+ new CustomQuestsConfig();
- @Override
- public void onDisable() {
+ //Commands
+// new CommandHandler();
+ CommandHandler.registerCommands();
- EntityTracker.shutdownPurger();
+ new SpecialItemSystemsConfig();
/*
- Flush lingering arrows from the arrow tracking power
+ Check for new plugin version or for dungeon updates
*/
- for (Arrow arrow : SkeletonTrackingArrow.trackingArrowList)
- arrow.remove();
- SkeletonTrackingArrow.trackingArrowList.clear();
-
- CustomItemConstructor.customItemList.clear();
- CustomItemConstructor.staticCustomItemHashMap.clear();
- CustomItemConstructor.dynamicRankedItemStacks.clear();
- UniqueItemInitializer.uniqueItemsList.clear();
- validWorldList.clear();
-
- //save cached data
- Bukkit.getScheduler().cancelTask(PlayerData.databaseSyncTaskID);
- Bukkit.getLogger().info("[EliteMobs] Saving EliteMobs databases...");
- PlayerData.saveDatabases();
- Bukkit.getLogger().info("[EliteMobs] All saved! Good night.");
- PlayerData.clearPlayerData();
+ VersionChecker.check();
+ DynamicQuest.startRandomizingQuests();
+ CustomBossEntity.startUpdatingDynamicLevels();
}
- public void worldScanner() {
+ @Override
+ public void onLoad() {
+ //Initializes some core utilities that are shared across MagmaGuy's plugins
+ MetadataHandler.PLUGIN = this;
+ MagmaCore.createInstance(this);
+
+ //WorldGuard hook
+ try {
+ worldGuardIsEnabled = WorldGuardCompatibility.initialize();
+ } catch (NoClassDefFoundError | IllegalStateException ex) {
+ Logger.warn("Error loading WorldGuard. EliteMob-specific flags will not work." + " Except if you just reloaded the plugin, in which case they will totally work.");
+ worldGuardIsEnabled = false;
+ }
+ if (!worldGuardIsEnabled)
+ if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null) worldGuardIsEnabled = true;
- for (World world : Bukkit.getWorlds())
- if (ConfigValues.validWorldsConfig.getBoolean("Valid worlds." + world.getName()))
- validWorldList.add(world);
+ }
+ @Override
+ public void onDisable() {
+ Logger.info("Starting EliteMobs shutdown sequence...");
+ Explosion.regenerateAllPendingBlocks();
+ Bukkit.getServer().getScheduler().cancelTasks(MetadataHandler.PLUGIN);
+ Wormhole.shutdown();
+ RegionalBossEntity.save();
+ RegionalBossEntity.getTrackableCustomBosses().clear();
+ RegionalBossEntity.getRegionalBossEntitySet().clear();
+ InstancedBossEntity.shutdown();
+ NPCEntity.shutdown();
+ PersistentObjectHandler.shutdown();
+ EntityTracker.wipeShutdown();
+ TimedEvent.shutdown();
+ ActionEvent.shutdown();
+ validWorldList.clear();
+ CustomBossesConfigFields.getRegionalElites().clear();
+ CustomEnchantment.getCustomEnchantmentMap().clear();
+ CustomItem.getCustomItems().clear();
+ CustomItem.getCustomItemStackList().clear();
+ CustomItem.getCustomItemStackShopList().clear();
+ CustomItem.getLimitedItems().clear();
+ CustomItem.getScalableItems().clear();
+ CustomItem.getFixedItems().clear();
+ CustomItem.getTieredLoot().clear();
+ CustomItem.getWeighedFixedItems().clear();
+ EMPackage.shutdown();
+ RegionalBossEntity.regionalBossesShutdown();
+ if (this.placeholders != null) ((Placeholders) placeholders).unregister();
+ HandlerList.unregisterAll(MetadataHandler.PLUGIN);
+ TreasureChest.clearTreasureChests();
+ QuestTracking.clear();
+ MatchInstance.shutdown();
+ CustomProjectileData.shutdown();
+ DynamicQuest.shutdown();
+ ProceduralShopMenu.shutdown();
+ EliteMobsWorld.shutdown();
+ Navigation.shutdown();
+ BossBarUtil.shutdown();
+ ScriptAction.shutdown();
+ CustomMusic.shutdown();
+ CustomBossEntity.shutdown();
+ Logger.info("Saving EliteMobs databases...");
+ PlayerData.closeConnection();
+ MagmaCore.shutdown();
+ Logger.info("All done! Good night.");
}
/*
Repeating tasks that run as long as the server is on
*/
- public void launchRunnables() {
-
- int eggTimerInterval = 20 * 60 * 10 / ConfigValues.defaultConfig.getInt(DefaultConfig.SUPERMOB_STACK_AMOUNT);
-
- new EntityScanner().runTaskTimer(this, 20, 20 * 10);
- new PotionEffectApplier().runTaskTimer(this, 20, 20);
- if (ConfigValues.defaultConfig.getBoolean(DefaultConfig.ENABLE_POWER_SCOREBOARDS))
- new ScoreboardUpdater().runTaskTimer(this, 20, 20);
- if (ConfigValues.validMobsConfig.getBoolean(ValidMobsConfig.ALLOW_PASSIVE_SUPERMOBS) &&
- ConfigValues.validMobsConfig.getBoolean(ValidMobsConfig.CHICKEN) &&
- ConfigValues.defaultConfig.getInt(DefaultConfig.SUPERMOB_STACK_AMOUNT) > 0)
- new EggRunnable().runTaskTimer(this, eggTimerInterval, eggTimerInterval);
- new DynamicLoreUpdater().runTaskTimer(this, 20, 20 * 2);
-// new ReapplyDisplayEffects().runTaskTimer(this, 20, 20);
-// EntityListUpdater.startUpdating();
-
+ private void launchRunnables() {
+ //save regional bosses when the files update
+ RegionalBossEntity.regionalDataSaver();
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/EntityTracker.java b/src/main/java/com/magmaguy/elitemobs/EntityTracker.java
deleted file mode 100644
index 2f9f51790..000000000
--- a/src/main/java/com/magmaguy/elitemobs/EntityTracker.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package com.magmaguy.elitemobs;
-
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.DefaultConfig;
-import com.magmaguy.elitemobs.mobconstructor.EliteMobEntity;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
-import com.magmaguy.elitemobs.mobpowers.ElitePower;
-import org.bukkit.entity.*;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.CreatureSpawnEvent;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.world.ChunkUnloadEvent;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import java.util.HashSet;
-import java.util.Iterator;
-
-public class EntityTracker implements Listener {
-
- /*
- These HashSets track basically everything for live plugin entities
- */
- private static HashSet superMobs = new HashSet<>();
- private static HashSet eliteMobs = new HashSet<>();
- private static HashSet eliteMobsLivingEntities = new HashSet<>();
-
- private static HashSet naturalEntities = new HashSet<>();
- private static HashSet armorStands = new HashSet<>();
- private static HashSet itemVisualEffects = new HashSet<>();
-
- /*
- This HashSet shouldn't really be scanned during runtime for aside from the occasional updates, it mostly exists to
- cull entities once the server shuts down
- */
- private static HashSet cullablePluginEntities = new HashSet<>();
-
- /*
- Starts tracking elite mobs
- */
- public static void registerEliteMob(EliteMobEntity eliteMobEntity) {
- eliteMobs.add(eliteMobEntity);
- eliteMobsLivingEntities.add(eliteMobEntity.getLivingEntity());
- registerCullableEntity(eliteMobEntity.getLivingEntity());
- }
-
- /*
- Starts tracking super mob
- */
- public static void registerSuperMob(LivingEntity livingEntity) {
- if (!SuperMobProperties.isValidSuperMobType(livingEntity)) return;
- superMobs.add(livingEntity);
- }
-
- /*
- Registers mobs that spawn naturally, necessary for elite mob rewards
- */
- public static void registerNaturalEntity(LivingEntity entity) {
- if (!EliteMobProperties.isValidEliteMobType(entity)) return;
- naturalEntities.add(entity);
- }
-
-
- public static void registerArmorStands(ArmorStand armorStand) {
- armorStands.add(armorStand);
- registerCullableEntity(armorStand);
- }
-
- public static void registerItemVisualEffects(Item item) {
- itemVisualEffects.add(item);
- registerCullableEntity(item);
- }
-
- /*
- Starts tracking any entity generated or managed by EliteMobs, useful for when they need to be culled
- Does not include super mobs to avoid culling them by mistake
- */
- public static void registerCullableEntity(Entity entity) {
- cullablePluginEntities.add(entity);
- }
-
- public static void checkEntityState() {
-
- new BukkitRunnable() {
- @Override
- public void run() {
- new BukkitRunnable() {
- @Override
- public void run() {
- updateSuperMobs();
- updateEliteMobEntities();
- updateLivingEntities();
- updateCullables();
- updateAmorStands();
- updateItems();
- }
- }.runTaskAsynchronously(MetadataHandler.PLUGIN);
- }
- }.runTaskTimer(MetadataHandler.PLUGIN, 20 * 60 * 5, 20 * 60 * 5);
-
- }
-
- private static void updateSuperMobs() {
- Iterator iterator = superMobs.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- if (!entity.isValid())
- iterator.remove();
- }
- }
-
- private static void updateLivingEntities() {
- Iterator iterator = naturalEntities.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- if (!entity.isValid())
- iterator.remove();
- }
- }
-
- private static void updateEliteMobEntities() {
- Iterator iterator = eliteMobs.iterator();
- while (iterator.hasNext()) {
- Entity entity = ((EliteMobEntity) iterator.next()).getLivingEntity();
- if (entity.isDead() ||
- !entity.isValid() && ((LivingEntity) entity).getRemoveWhenFarAway())
- iterator.remove();
- }
- }
-
- private static void updateAmorStands() {
- Iterator iterator = armorStands.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- if (!entity.isValid())
- iterator.remove();
- }
- }
-
- private static void updateCullables() {
- Iterator iterator = cullablePluginEntities.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- if (!entity.isValid())
- iterator.remove();
- }
- }
-
- private static void updateItems() {
- Iterator iterator = itemVisualEffects.iterator();
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
- if (!entity.isValid())
- iterator.remove();
- }
- }
-
- public static boolean isSuperMob(Entity entity) {
- if (!SuperMobProperties.isValidSuperMobType(entity)) return false;
- return superMobs.contains(entity);
- }
-
- public static boolean isEliteMob(Entity entity) {
- if (!EliteMobProperties.isValidEliteMobType(entity)) return false;
- return eliteMobsLivingEntities.contains(entity);
- }
-
- public static EliteMobEntity getEliteMobEntity(Entity entity) {
- if (!EliteMobProperties.isValidEliteMobType(entity)) return null;
- for (EliteMobEntity eliteMobEntity : eliteMobs)
- if (eliteMobEntity.getLivingEntity().equals(entity))
- return eliteMobEntity;
- return null;
- }
-
- public static EliteMobEntity getAsyncEliteMobEntity(Entity entity) {
- if (!EliteMobProperties.isValidEliteMobType(entity)) return null;
- HashSet localEntities = (HashSet) eliteMobs.clone();
- for (EliteMobEntity eliteMobEntity : localEntities)
- if (eliteMobEntity.getLivingEntity().equals(entity))
- return eliteMobEntity;
- return null;
- }
-
- public static boolean isNaturalEntity(Entity entity) {
- if (!EliteMobProperties.isValidEliteMobType(entity)) return false;
- return naturalEntities.contains(entity);
- }
-
- public static boolean isItemVisualEffect(Entity entity) {
- return (itemVisualEffects.contains(entity));
- }
-
- public static boolean hasPower(ElitePower mobPower, Entity entity) {
- EliteMobEntity eliteMobEntity = getEliteMobEntity(entity);
- if (eliteMobEntity == null) return false;
- return eliteMobEntity.hasPower(mobPower);
- }
-
- public static boolean hasPower(ElitePower mobPower, EliteMobEntity eliteMobEntity) {
- if (eliteMobEntity == null) return false;
- return eliteMobEntity.hasPower(mobPower);
- }
-
- public static void unregisterCullableEntity(Entity entity) {
- cullablePluginEntities.remove(entity);
- }
-
- public static void unregisterItemEntity(Item item) {
- itemVisualEffects.remove(item);
- }
-
- /*
- Used outside this class to remove individual elite mobs
- */
- public static void unregisterEliteMob(EliteMobEntity eliteMobEntity) {
- eliteMobs.remove(eliteMobEntity);
- naturalEntities.remove(eliteMobEntity.getLivingEntity());
- cullablePluginEntities.remove(eliteMobEntity.getLivingEntity());
- }
-
- /*
- Used in this class to do mass wipes of data
- */
- private static void unregisterEliteMob(Entity entity) {
- if (!isEliteMob(entity)) return;
- EliteMobEntity eliteMobEntity = getAsyncEliteMobEntity(entity);
- if (eliteMobEntity == null) return;
- eliteMobEntity.getLivingEntity().remove();
- eliteMobs.remove(eliteMobEntity);
- eliteMobsLivingEntities.remove(eliteMobEntity.getLivingEntity());
- }
-
- public static void unregisterArmorStand(Entity armorStand) {
- if (!armorStand.getType().equals(EntityType.ARMOR_STAND)) return;
- armorStands.remove(armorStand);
- }
-
- public static HashSet getEliteMobs() {
- return eliteMobs;
- }
-
- public static boolean getIsArmorStand(Entity entity) {
- if (!entity.getType().equals(EntityType.ARMOR_STAND)) return false;
- return (armorStands.contains(entity));
- }
-
- public static void unregisterSuperMob(Entity entity) {
- if (!SuperMobProperties.isValidSuperMobType(entity)) return;
- superMobs.remove(entity);
- }
-
- public static void unregisterNaturalEntity(Entity entity) {
- if (EliteMobProperties.isValidEliteMobType(entity)) return;
- naturalEntities.remove(entity);
- }
-
- /*
- Custom spawn reasons can be considered as natural spawns under specific config options
- */
- @EventHandler(priority = EventPriority.LOW)
- public void registerNaturalEntity(CreatureSpawnEvent event) {
- if (event.isCancelled()) return;
- if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.NATURAL) ||
- event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.CUSTOM) &&
- !ConfigValues.defaultConfig.getBoolean(DefaultConfig.STRICT_SPAWNING_RULES))
- registerNaturalEntity(event.getEntity());
- }
-
- /*
- Natural entities get unregistered from being natural when exploit abuse is detected from the players
- */
- public static void unregisterNaturalEntity(LivingEntity livingEntity) {
- naturalEntities.remove(livingEntity);
- }
-
- public static void shutdownPurger() {
-
- for (Entity entity : cullablePluginEntities)
- entity.remove();
-
- eliteMobs.clear();
- eliteMobsLivingEntities.clear();
- superMobs.clear();
- itemVisualEffects.clear();
- armorStands.clear();
- naturalEntities.clear();
- cullablePluginEntities.clear();
-
- }
-
- /*
- This is run in sync for performance reasons
- */
- public static void wipeEntity(Entity entity) {
- new BukkitRunnable() {
- @Override
- public void run() {
- unregisterEliteMob(entity);
- unregisterSuperMob(entity);
- unregisterNaturalEntity(entity);
- unregisterArmorStand(entity);
- unregisterCullableEntity(entity);
- }
- }.runTaskAsynchronously(MetadataHandler.PLUGIN);
- }
-
- public static void chunkWiper(ChunkUnloadEvent event) {
- for (Entity entity : event.getChunk().getEntities())
- wipeEntity(entity);
- }
-
- public static void deathWipe(EntityDeathEvent event) {
- wipeEntity(event.getEntity());
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java
index 1441924a5..246e9a667 100644
--- a/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java
+++ b/src/main/java/com/magmaguy/elitemobs/EventsRegistrer.java
@@ -1,206 +1,391 @@
package com.magmaguy.elitemobs;
-import com.magmaguy.elitemobs.adventurersguild.AdventurersGuildGUI;
+import com.magmaguy.elitemobs.adventurersguild.GuildRank;
+import com.magmaguy.elitemobs.adventurersguild.GuildRankMenuHandler;
+import com.magmaguy.elitemobs.adventurersguild.WorldSwitchBehavior;
+import com.magmaguy.elitemobs.api.*;
import com.magmaguy.elitemobs.collateralminecraftchanges.*;
-import com.magmaguy.elitemobs.combattag.CombatTag;
-import com.magmaguy.elitemobs.commands.LootGUI;
-import com.magmaguy.elitemobs.commands.shops.CustomShopHandler;
-import com.magmaguy.elitemobs.commands.shops.ItemSaleEvent;
-import com.magmaguy.elitemobs.commands.shops.ShopHandler;
+import com.magmaguy.elitemobs.combatsystem.EliteMobDamagedByEliteMobHandler;
+import com.magmaguy.elitemobs.combatsystem.EliteMobGenericDamagedHandler;
+import com.magmaguy.elitemobs.combatsystem.antiexploit.*;
+import com.magmaguy.elitemobs.combatsystem.combattag.CombatTag;
+import com.magmaguy.elitemobs.combatsystem.displays.HealthDisplay;
+import com.magmaguy.elitemobs.combatsystem.displays.PopupDisplay;
+import com.magmaguy.elitemobs.commands.admin.RemoveCommand;
+import com.magmaguy.elitemobs.commands.setup.SetupMenu;
import com.magmaguy.elitemobs.config.*;
-import com.magmaguy.elitemobs.events.DeadMoon;
-import com.magmaguy.elitemobs.events.SmallTreasureGoblin;
-import com.magmaguy.elitemobs.events.actionevents.BalrogEvent;
-import com.magmaguy.elitemobs.events.actionevents.FaeEvent;
-import com.magmaguy.elitemobs.events.actionevents.KrakenEvent;
-import com.magmaguy.elitemobs.events.mobs.*;
-import com.magmaguy.elitemobs.events.mobs.sharedeventpowers.SpiritWalk;
+import com.magmaguy.elitemobs.config.enchantments.EnchantmentsConfig;
+import com.magmaguy.elitemobs.config.powers.PowersConfig;
+import com.magmaguy.elitemobs.dungeons.DungeonProtector;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.events.ActionEvent;
+import com.magmaguy.elitemobs.explosionregen.Explosion;
+import com.magmaguy.elitemobs.initialsetup.FirstTimeSetup;
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
+import com.magmaguy.elitemobs.instanced.dungeons.DungeonKillTargetObjective;
import com.magmaguy.elitemobs.items.*;
-import com.magmaguy.elitemobs.items.customenchantments.FlamethrowerEnchantment;
-import com.magmaguy.elitemobs.mobconstructor.CombatSystem;
-import com.magmaguy.elitemobs.mobconstructor.MergeHandler;
-import com.magmaguy.elitemobs.mobconstructor.displays.DamageDisplay;
-import com.magmaguy.elitemobs.mobconstructor.displays.DisplayMob;
-import com.magmaguy.elitemobs.mobconstructor.displays.HealthDisplay;
-import com.magmaguy.elitemobs.mobpowers.AggroPrevention;
-import com.magmaguy.elitemobs.mobpowers.defensivepowers.InvulnerabilityArrow;
-import com.magmaguy.elitemobs.mobpowers.defensivepowers.InvulnerabilityFallDamage;
-import com.magmaguy.elitemobs.mobpowers.defensivepowers.InvulnerabilityFire;
-import com.magmaguy.elitemobs.mobpowers.defensivepowers.InvulnerabilityKnockback;
-import com.magmaguy.elitemobs.mobpowers.majorpowers.*;
-import com.magmaguy.elitemobs.mobpowers.miscellaneouspowers.BonusLoot;
-import com.magmaguy.elitemobs.mobpowers.miscellaneouspowers.Taunt;
-import com.magmaguy.elitemobs.mobpowers.offensivepowers.*;
-import com.magmaguy.elitemobs.mobs.passive.*;
-import com.magmaguy.elitemobs.mobspawning.NaturalEliteMobSpawnEventHandler;
+import com.magmaguy.elitemobs.items.customenchantments.*;
+import com.magmaguy.elitemobs.items.potioneffects.PlayerPotionEffects;
+import com.magmaguy.elitemobs.menus.*;
+import com.magmaguy.elitemobs.mobconstructor.PersistentObjectHandler;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.*;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBossBlock;
import com.magmaguy.elitemobs.mobspawning.NaturalMobSpawnEventHandler;
+import com.magmaguy.elitemobs.npcs.NPCDamageEvent;
+import com.magmaguy.elitemobs.npcs.NPCEntity;
+import com.magmaguy.elitemobs.npcs.NPCInteractions;
+import com.magmaguy.elitemobs.npcs.chatter.NPCProximitySensor;
+import com.magmaguy.elitemobs.ondeathcommands.OnDeathCommands;
+import com.magmaguy.elitemobs.pathfinding.Navigation;
+import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
+import com.magmaguy.elitemobs.playerdata.PlayerStatsTracker;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.playerdata.statusscreen.*;
+import com.magmaguy.elitemobs.powers.*;
+import com.magmaguy.elitemobs.powers.meta.Bombardment;
+import com.magmaguy.elitemobs.powers.meta.CombatEnterScanPower;
+import com.magmaguy.elitemobs.powers.meta.CustomSummonPower;
+import com.magmaguy.elitemobs.powers.scripts.ScriptListener;
+import com.magmaguy.elitemobs.powers.specialpowers.EnderCrystalLightningRod;
import com.magmaguy.elitemobs.powerstances.EffectEventHandlers;
import com.magmaguy.elitemobs.powerstances.VisualEffectObfuscator;
-import com.magmaguy.elitemobs.utils.VersionChecker;
+import com.magmaguy.elitemobs.quests.CustomQuest;
+import com.magmaguy.elitemobs.quests.QuestTracking;
+import com.magmaguy.elitemobs.quests.menus.QuestInventoryMenu;
+import com.magmaguy.elitemobs.quests.objectives.ArenaObjective;
+import com.magmaguy.elitemobs.quests.objectives.CustomFetchObjective;
+import com.magmaguy.elitemobs.quests.objectives.DialogObjective;
+import com.magmaguy.elitemobs.quests.objectives.KillObjective;
+import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldownsLogout;
+import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardDungeonFlag;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardEliteMobOnlySpawnFlag;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardExplosionBlockDamageFlag;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardSpawnEventBypasser;
+import com.magmaguy.elitemobs.treasurechest.TreasureChest;
+import com.magmaguy.elitemobs.versionnotifier.VersionChecker;
import org.bukkit.Bukkit;
+import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
public class EventsRegistrer {
+ private static PluginManager pluginManager;
+ private static Plugin plugin;
+
+ private EventsRegistrer() {
+ }
+
public static void registerEvents() {
- PluginManager pluginManager = Bukkit.getPluginManager();
- Plugin plugin = MetadataHandler.PLUGIN;
+ pluginManager = Bukkit.getPluginManager();
+ plugin = MetadataHandler.PLUGIN;
+
+ register(new FirstTimeSetup());
+
+ register(new Navigation());
+
+ register(new DungeonKillTargetObjective.DungeonKillTargetObjectiveListener());
+
+ register(new VersionChecker.VersionCheckerEvents());
+
+ register(new PlayerData.PlayerDataEvents());
+ register(new ElitePlayerInventory.ElitePlayerInventoryEvents());
+ register(new PlayerStatsTracker());
+ register(new PlayerQuestCooldownsLogout());
- //Load passive mobs TODO: find generic alternative to this
- pluginManager.registerEvents(new ChickenHandler(), plugin);
- pluginManager.registerEvents(new CowHandler(), plugin);
- pluginManager.registerEvents(new MushroomCowHandler(), plugin);
- pluginManager.registerEvents(new PassiveEliteMobDeathHandler(), plugin);
- pluginManager.registerEvents(new PigHandler(), plugin);
- pluginManager.registerEvents(new SheepHandler(), plugin);
- pluginManager.registerEvents(new FindSuperMobs(), plugin);
+ if (ItemSettingsConfig.isPreventEliteItemEnchantment())
+ register(new ItemEnchantmentPrevention());
+ if (ItemSettingsConfig.isPreventEliteItemDisenchantment())
+ register(new ItemDisenchantPrevention());
+
+ if (ItemSettingsConfig.isPreventEliteItemDiamondToNetheriteUpgrade())
+ register(new PreventUpgradeDiamondToNetherite());
+
+ register(new FixPlayerOnLoginOrRespawn());
+ register(new EnvironmentalDungeonDamage());
+ register(new PlayerQuitCleanup());
//Mob damage
- pluginManager.registerEvents(new CombatSystem(), plugin);
- if (ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.ENABLE_DEATH_MESSAGES))
- pluginManager.registerEvents(new PlayerDeathMessageByEliteMob(), plugin);
+ register(new EliteMobGenericDamagedHandler());
+ register(new EliteMobDamagedByEliteMobHandler());
+ if (MobCombatSettingsConfig.isEnableDeathMessages())
+ register(new PlayerDeathMessageByEliteMob());
+
+ //explosion regenerator
+ if (DefaultConfig.isDoExplosionRegen())
+ register(new Explosion.ExplosionEvent());
//Mob loot
- pluginManager.registerEvents(new DefaultDropsHandler(), plugin);
+ register(new DefaultDropsHandler());
+ register(new ItemLootShower.ItemLootShowerEvents());
+
+ //potion effects - also initializes the task
+ register(new PlayerPotionEffects());
- //potion effects
- pluginManager.registerEvents(new PotionEffectApplier(), plugin);
+ //getloot AdventurersGuildMenu
+ register(new GetLootMenu.GetLootMenuListener());
- //getloot AdventurersGuildGUI
- pluginManager.registerEvents(new LootGUI(), plugin);
+ /*
+ Register API events
+ */
+ register(new EliteMobDeathEvent.EliteMobDeathEventFilter());
+ register(new EliteMobTargetPlayerEvent.EliteMobTargetPlayerEventFilter());
+ register(new EliteMobDamagedEvent.EliteMobDamageEventFilter());
+ register(new PlayerDamagedByEliteMobEvent.PlayerDamagedByEliteMobEventFilter());
+ register(new EliteMobDamagedByEliteMobEvent.EliteMobDamagedByEliteMobFilter());
+ register(new EliteMobEnterCombatEvent.EliteMobEnterCombatEventFilter());
+ register(new PlayerPreTeleportEvent.PlayerPreTeleportEventEvents());
+ register(new PlayerTeleportEvent.PlayerTeleportEventExecutor());
+ register(new EliteMobDamagedByPlayerEvent.EliteMobDamagedByPlayerEventFilter());
+ register(new EliteExplosionEvent.EliteExplosionEvents());
/*
While these powers could be registered in a more automated way, I realized that it's also a bad way of getting
silent errors without ever noticing, and ultimately the amount of manual input required is pretty minimal
*/
//Minor mob powers
- pluginManager.registerEvents(new InvulnerabilityArrow(), plugin);
- pluginManager.registerEvents(new InvulnerabilityFallDamage(), plugin);
- pluginManager.registerEvents(new InvulnerabilityFire(), plugin);
- pluginManager.registerEvents(new InvulnerabilityKnockback(), plugin);
- pluginManager.registerEvents(new BonusLoot(), plugin);
- pluginManager.registerEvents(new Taunt(), plugin);
- pluginManager.registerEvents(new AttackArrow(), plugin);
- pluginManager.registerEvents(new AttackBlinding(), plugin);
- pluginManager.registerEvents(new AttackFire(), plugin);
- pluginManager.registerEvents(new AttackFireball(), plugin);
- pluginManager.registerEvents(new AttackFreeze(), plugin);
- pluginManager.registerEvents(new AttackGravity(), plugin);
- pluginManager.registerEvents(new AttackPoison(), plugin);
- pluginManager.registerEvents(new AttackPush(), plugin);
- pluginManager.registerEvents(new AttackWeakness(), plugin);
- pluginManager.registerEvents(new AttackWeb(), plugin);
- pluginManager.registerEvents(new AttackWither(), plugin);
+ register(new ScriptListener());
+ registerPower(new InvulnerabilityArrow(), "invulnerability_arrow.yml");
+ registerPower(new InvulnerabilityFallDamage(), "invulnerability_fall_damage.yml");
+ registerPower(new InvulnerabilityKnockback(), "invulnerability_knockback.yml");
+ registerPower(new InvulnerabilityFireworks(), "invulnerability_fireworks.yml");
+ registerPower(new BonusLoot(), "bonus_loot.yml");
+ registerPower(new Taunt(), "taunt.yml");
+ registerPower(new Implosion(), "implosion.yml");
+ registerPower(new AttackArrow(), "attack_arrow.yml");
+ registerPower(new ArrowFireworks(), "arrow_fireworks.yml");
+ registerPower(new AttackFireball(), "attack_fireball.yml");
+ registerPower(new TrackingFireball.TrackingFireballEvents(), "tracking_fireball.yml");
+ registerPower(new AttackLightning(), "attack_lightning.yml");
+ registerPower(new AttackPush(), "attack_push.yml");
+ registerPower(new AttackVacuum(), "attack_vacuum.yml");
+ registerPower(new ArrowRain(), "arrow_rain.yml");
+ registerPower(new GroundPound(), "ground_pound.yml");
+ registerPower(new LightningBolts(), "lightning_bolts.yml");
+ registerPower(new FrostCone(), "frost_cone.yml");
+ registerPower(new Thunderstorm(), "thunderstorm.yml");
+ registerPower(new Firestorm(), "firestorm.yml");
+ register(new Bombardment.BombardmentEvents());
+ registerPower(new ShieldWall.ShieldWallEvents(), "shield_wall.yml");
+ registerPower(new Taze(), "taze.yml");
//Major mob powers
- pluginManager.registerEvents(new SkeletonPillar(), plugin);
- pluginManager.registerEvents(new SkeletonTrackingArrow(), plugin);
- pluginManager.registerEvents(new ZombieBloat(), plugin);
- pluginManager.registerEvents(new ZombieFriends(), plugin);
- pluginManager.registerEvents(new ZombieNecronomicon(), plugin);
- pluginManager.registerEvents(new ZombieParents(), plugin);
- pluginManager.registerEvents(new ZombieTeamRocket(), plugin);
+ registerPower(new SkeletonPillar(), "skeleton_pillar.yml");
+ registerPower(new SkeletonTrackingArrow(), "skeleton_tracking_arrow.yml");
+ registerPower(new ZombieBloat(), "zombie_bloat.yml");
+ registerPower(new ZombieFriends(), "zombie_friends.yml");
+ registerPower(new ZombieNecronomicon(), "zombie_necronomicon.yml");
+ registerPower(new ZombieParents(), "zombie_parents.yml");
+
+ //boss powers
+ registerPower(new SpiritWalk(), "spirit_walk.yml");
+ registerPower(new GoldShotgun(), "gold_shotgun.yml");
+ registerPower(new GoldExplosion(), "gold_explosion.yml");
+ registerPower(new Flamethrower(), "flamethrower.yml");
+ register(new PlasmaBootsEnchantment.PlasmaBootsEnchantmentEvents());
+ if (EnchantmentsConfig.getEnchantment(SoulbindEnchantment.key + ".yml").isEnabled())
+ register(new SoulbindEnchantment.SoulbindEnchantmentEvents());
+ registerPower(new FlamePyre(), "flame_pyre.yml");
+ registerPower(new SummonTheReturned(), "summon_the_returned.yml");
+ registerPower(new HyperLoot(), "hyper_loot.yml");
+ registerPower(new SummonTheReturned(), "summon_the_returned.yml");
+ registerPower(new SummonEmbers(), "summon_embers.yml");
+ registerPower(new MeteorShower(), "meteor_shower.yml");
+ registerPower(new BulletHell(), "bullet_hell.yml");
+ registerPower(new DeathSlice(), "death_slice.yml");
+ registerPower(new FireworksBarrage.FireworksBarrageEvents(), "fireworks_barrage.yml");
+ register(new CustomSummonPower.CustomSummonPowerEvent());
+ registerPower(new EnderDragonEmpoweredLightning.EnderDragonEmpoweredLightningEvents(), "ender_dragon_empowered_lightning.yml");
+ register(new CombatEnterScanPower.MajorCombatEnterScanningPowerEvents());
+ register(new LightningEnchantment.LightningEnchantmentEvents());
+ registerPower(new BonusCoins.BonusCoinsEvents(), "bonus_coins.yml");
+
+ //special powers
+ register(new EnderCrystalLightningRod.EnderCrystalLightningRodEvents());
+
+ //Custom bosses
+ register(new CustomBossEntity.CustomBossEntityEvents());
+ register(new CustomBossDeath());
+ register(new PersistentObjectHandler.PersistentObjectHandlerEvents());
+ register(new CustomBossTaunts());
+ register(new PhaseBossEntity.PhaseBossEntityListener());
+ register(new AdvancedAggroManager());
+ register(new TransitiveBossBlock());
+ register(new TransitiveBlockCommand.TemporaryBossBlockCommandEvents());
+ register(new CustomModel.ModelEntityEvents());
//Metadata (player purger)
- pluginManager.registerEvents(new MetadataHandler(), plugin);
-
- //Mob merger TODO: maybe add a config scan here?
- pluginManager.registerEvents(new MergeHandler(), plugin);
+ register(new MetadataHandler());
//Natural EliteMobs Spawning
- if (ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.NATURAL_MOB_SPAWNING)) {
- pluginManager.registerEvents(new NaturalEliteMobSpawnEventHandler(), plugin);
- pluginManager.registerEvents(new EntityTracker(), plugin);
- }
+ register(new EntityTracker());
+ //Fix lingering entity after crashes
+ register(new CrashFix());
//Natural Mob Metadata Assigner
- pluginManager.registerEvents(new NaturalMobSpawnEventHandler(), plugin);
+ register(new NaturalMobSpawnEventHandler());
//Visual effects
- pluginManager.registerEvents(new EffectEventHandlers(), plugin);
- if (ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.OBFUSCATE_MOB_POWERS))
- pluginManager.registerEvents(new VisualEffectObfuscator(), plugin);
+ register(new EffectEventHandlers());
+ if (MobCombatSettingsConfig.isObfuscateMobPowers())
+ register(new VisualEffectObfuscator());
//Loot
- if (ConfigValues.itemsDropSettingsConfig.getBoolean(ItemsDropSettingsConfig.ENABLE_PLUGIN_LOOT)) {
- pluginManager.registerEvents(new LootTables(), plugin);
- pluginManager.registerEvents(new PlaceEventPrevent(), plugin);
+ if (ItemSettingsConfig.isDoEliteMobsLoot()) {
+ register(new LootTables());
+ register(new PlaceEventPrevent());
}
+ //player status menu
+ register(new CoverPage.CoverPageEvents());
+ register(new StatsPage.StatsPageEvents());
+ register(new GearPage.GearPageEvents());
+ register(new TeleportsPage.TeleportsPageEvents());
+ register(new CommandsPage.CommandsPageEvents());
+ register(new BossTrackingPage.BossTrackingPageEvents());
+ register(new InstancedDungeonBrowser.InstancedDungeonBrowserEvents());
+
//Shops
- pluginManager.registerEvents(new ShopHandler(), plugin);
- pluginManager.registerEvents(new CustomShopHandler(), plugin);
- pluginManager.registerEvents(new ItemSaleEvent(), plugin);
+ register(new ProceduralShopMenu.ProceduralShopMenuEvents());
+ register(new CustomShopMenu.CustomShopMenuEvents());
+ register(new BuyOrSellMenu.BuyOrSellMenuEvents());
+ register(new SellMenu());
+ register(new SetupMenu.SetupMenuListeners());
+ register(new ScrapperMenu.ScrapperMenuEvents());
+ register(new RepairMenu.RepairMenuEvents());
+ register(new UnbindMenu.UnbinderMenuEvents());
+ register(new ItemEnchantmentMenu.ItemEnchantMenuEvents());
+
+ //loot menu
+ register(new LootMenu.LootMenuEvents());
//Minecraft behavior canceller
- pluginManager.registerEvents(new ChunkUnloadMetadataPurge(), plugin);
- pluginManager.registerEvents(new EntityDeathDataFlusher(), plugin);
- if (ConfigValues.defaultConfig.getBoolean(DefaultConfig.CREEPER_PASSIVE_DAMAGE_PREVENTER))
- pluginManager.registerEvents(new PreventCreeperPassiveEntityDamage(), plugin);
- //Prevent exploits
- //Prevent mount exploit
- if (ConfigValues.defaultConfig.getBoolean(DefaultConfig.PREVENT_MOUNT_EXPLOIT))
- pluginManager.registerEvents(new PreventMountExploit(), plugin);
- //Prevent darkroom exploit
- if (ConfigValues.defaultConfig.getBoolean(DefaultConfig.PREVENT_DARKROOM_EXPLOIT))
- pluginManager.registerEvents(new PreventDarkroomExploit(), plugin);
- //Prevent tower exploit
- if (ConfigValues.defaultConfig.getBoolean(DefaultConfig.PREVENT_TOWER_EXPLOIT))
- pluginManager.registerEvents(new PreventTowerExploit(), plugin);
-
-
- if (!VersionChecker.currentVersionIsUnder(11, 0)) {
- //Initialize custom events
- pluginManager.registerEvents(new SmallTreasureGoblin(), plugin);
- pluginManager.registerEvents(new TreasureGoblin(), plugin);
- pluginManager.registerEvents(new DeadMoon(), plugin);
- pluginManager.registerEvents(new TheReturned(), plugin);
- pluginManager.registerEvents(new ZombieKing(), plugin);
- pluginManager.registerEvents(new SpiritWalk(), plugin);
-
- if (ConfigValues.eventsConfig.getBoolean(EventsConfig.KRAKEN_ENABLED)) {
- pluginManager.registerEvents(new Kraken(), plugin);
- pluginManager.registerEvents(new KrakenEvent(), plugin);
- }
- if (ConfigValues.eventsConfig.getBoolean(EventsConfig.BALROG_ENABLED)) {
- pluginManager.registerEvents(new Balrog(), plugin);
- pluginManager.registerEvents(new BalrogEvent(), plugin);
- }
- if (ConfigValues.eventsConfig.getBoolean(EventsConfig.FAE_ENABLED)) {
- pluginManager.registerEvents(new FaeEvent(), plugin);
- pluginManager.registerEvents(new Fae(), plugin);
- }
- }
-
+ register(new PreventEliteBeeHiveEnter());
+ register(new EnderDragonUnstuck());
+ if (DefaultConfig.isPreventVanillaReinforcementsForEliteEntities())
+ register(new VanillaReinforcementsCanceller());
+ register(new LightningSpawnBypass());
+ if (ItemSettingsConfig.isEliteDurability())
+ register(new AlternativeDurabilityLoss());
+ register(new EnderCrystalDamageProtectionBypass());
+ register(new NPCsBecomeWitches());
+ register(new PreventEliteSilverfishBlockEnter());
+
+
+ //Antiexploits
+ register(new PreventMountExploit());
+ register(new PreventDarkroomExploit());
+ register(new PreventLargeDarkroomExploit());
+ register(new PreventEndermanHeightExploit());
+ if (AntiExploitConfig.isNoItemPickup())
+ register(new PreventItemPickupByMobs());
+ if (AntiExploitConfig.isAmbientDamageExploit())
+ register(new AmbientDamageExploit());
+ register(new HoneyBlockJumpExploit());
+ register(new EliteMobDamagedByPlayerAntiExploitListener());
+ if (AntiExploitConfig.isNoPathExploit())
+ register(new PreventPathfindingExploit());
+
+ register(new ActionEvent.ActionEventEvents());
//Set up health and damage displays
- if (ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.DISPLAY_HEALTH_ON_HIT))
- pluginManager.registerEvents(new HealthDisplay(), plugin);
- if (ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.DISPLAY_DAMAGE_ON_HIT))
- pluginManager.registerEvents(new DamageDisplay(), plugin);
+ if (MobCombatSettingsConfig.isDisplayHealthOnHit())
+ register(new HealthDisplay());
+ if (MobCombatSettingsConfig.isDisplayDamageOnHit())
+ register(new PopupDisplay());
//Initialize items from custom events
- pluginManager.registerEvents(new FlamethrowerEnchantment(), plugin);
+ register(new FlamethrowerEnchantment.FlamethrowerEnchantmentEvents());
+ register(new SummonMerchantEnchantment.SummonMerchantEvents());
+ register(new SummonWolfEnchantment.SummonWolfEnchantmentEvent());
+ register(new MeteorShowerEnchantment.MeteorShowerEvents());
+ register(new DrillingEnchantment.DrillingEnchantmentEvents());
+ register(new IceBreakerEnchantment.IceBreakerEnchantmentEvent());
+ register(new GrapplingHookEnchantment.GrapplingHookEnchantmentEvents());
+ register(new EarthquakeEnchantment.EarthquakeEnchantmentEvents());
+ //register(new UnbindEnchantment.UnbindEvents());
//Initialize adventurer's guild
- pluginManager.registerEvents(new AdventurersGuildGUI(), plugin);
+ register(new GuildRankMenuHandler());
+ register(new WorldSwitchBehavior());
+ //register quests
+ register(new KillObjective.KillObjectiveEvents());
+ register(new CustomFetchObjective.CustomFetchObjectiveEvents());
+ register(new DialogObjective.DialogObjectiveEvents());
+ register(new ArenaObjective.ArenaObjectiveEvents());
+ register(new QuestAcceptEvent.QuestAcceptEventHandler());
+ register(new QuestCompleteEvent.QuestCompleteEventHandler());
+ register(new QuestLeaveEvent.QuestLeaveEventHandler());
+ register(new QuestProgressionEvent.QuestProgressionEventHandler());
+ register(new QuestTracking.QuestTrackingEvents());
+ register(new CustomQuest.CustomQuestEvents());
+ register(new QuestInventoryMenu.QuestInventoryMenuEvents());
+ register(new ArenaCompleteEvent.ArenaCompleteEventHandler());
+
+ //Songs
+ register(new CustomMusic.CustomMusicEvents());
+
+ //Arenas
+ register(new ArenaMenu.ArenaMenuEvents());
+ register(new ArenaInstance.ArenaInstanceEvents());
+ register(new MatchInstance.MatchInstanceEvents());
//Combat tag
- if (ConfigValues.combatTagConfig.getBoolean(CombatTagConfig.ENABLE_COMBAT_TAG))
- pluginManager.registerEvents(new CombatTag(), plugin);
+ if (CombatTagConfig.isEnableCombatTag())
+ register(new CombatTag());
- //Prevent elitemob on elitemob aggro
- pluginManager.registerEvents(new AggroPrevention(), plugin);
- //Refresh display case Elite Mobs
- pluginManager.registerEvents(new DisplayMob(), plugin);
+ //Prevent elitemob on elitemob aggro
+ register(new EnderDragonUnstuck.AggroPrevention());
//Player effect when a rare item is on the ground
- if (ConfigValues.itemsDropSettingsConfig.getBoolean(ItemsDropSettingsConfig.ENABLE_RARE_DROP_EFFECT))
- pluginManager.registerEvents(new RareDropEffect(), plugin);
+ register(new RareDropEffect());
+
+ //NPCs
+ register(new NPCDamageEvent());
+ register(new NPCInteractions());
+ register(new NPCProximitySensor());
+ register(new NPCEntity.NPCEntityEvents());
+ register(new FindNewWorlds());
+ if (EliteMobs.worldGuardIsEnabled) {
+ register(new WorldGuardSpawnEventBypasser());
+ register(new WorldGuardEliteMobOnlySpawnFlag());
+ register(new WorldGuardDungeonFlag());
+ register(new WorldGuardExplosionBlockDamageFlag());
+ }
+ register(new DungeonProtector());
+
+ register(new EntityTransformHandler());
+ register(new EliteBlazeWaterDamagePrevention());
+ register(new PreventEliteEquipmentDrop());
+ register(new CombustionPrevention());
+ register(new EliteSlimeDeathSplit());
+ register(new LightningImmunity());
+
+ register(new TreasureChest.TreasureChestEvents());
+
+ //On death commands
+ register(new OnDeathCommands());
+
+ //Player stuff
+ register(new GuildRank.GuildRankEvents());
+
+ //Commands
+ register(new RemoveCommand.RemoveCommandEvents());
+
+ }
+
+ private static void registerPower(Listener listener, String config) {
+ if (PowersConfig.getPower(config).isEnabled())
+ register(listener);
+ }
+ private static void register(Listener listener) {
+ pluginManager.registerEvents(listener, plugin);
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java b/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java
index c6ca774fa..69083d1e8 100644
--- a/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/MetadataHandler.java
@@ -1,23 +1,7 @@
-/*
- * 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 com.magmaguy.elitemobs;
-import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
-import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
/**
* Created by MagmaGuy on 26/04/2017.
@@ -32,13 +16,11 @@ public class MetadataHandler implements Listener {
//plugin name
public final static String ELITE_MOBS = "EliteMobs";
-
- //plugin getter
- public final static Plugin PLUGIN = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS);
-
//third party compatibility
public final static String BETTERDROPS_COMPATIBILITY_MD = "betterdrops_ignore";
- public final static String VANISH_NO_PACKET = "vanished";
+ //plugin getter
+ public static JavaPlugin PLUGIN;
+ public static int signatureID = 31173;
}
diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/AdventurersGuildGUI.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/AdventurersGuildGUI.java
deleted file mode 100644
index d0c65720c..000000000
--- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/AdventurersGuildGUI.java
+++ /dev/null
@@ -1,382 +0,0 @@
-package com.magmaguy.elitemobs.adventurersguild;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.EconomySettingsConfig;
-import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.playerdata.PlayerData;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemFlag;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.SkullMeta;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class AdventurersGuildGUI implements Listener {
-
- private static ItemStack difficulty = new ItemStack(Material.DIAMOND_SWORD);
- private static ItemStack quest = skullItemInitializer("MHF_Question", "Quests", Arrays.asList("Coming soon!"));
-
- public static void mainMenu(Player player) {
-
- Inventory mainMenu = Bukkit.createInventory(player, 27, "Adventurer's guild");
-
- difficulty = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta difficultyMeta = difficulty.getItemMeta();
- difficultyMeta.setDisplayName("Difficulty");
- difficultyMeta.setLore(Arrays.asList("Press me to select a difficulty!"));
- difficultyMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
- difficulty.setItemMeta(difficultyMeta);
-
- quest = skullItemInitializer("MHF_Question", "Quests", Arrays.asList("Coming soon!"));
-
- mainMenu.setItem(11, difficulty);
- mainMenu.setItem(15, quest);
-
- player.openInventory(mainMenu);
-
- }
-
- public static void difficultyMenu(Player player) {
-
- Inventory difficultyMenu = Bukkit.createInventory(player, 27, "Guild rank selector");
-
- if (!PlayerData.playerMaxGuildRank.containsKey(player.getUniqueId())) {
- PlayerData.playerMaxGuildRank.put(player.getUniqueId(), 10);
- PlayerData.playerMaxGuildRankChanged = true;
- }
-
- if (!PlayerData.playerSelectedGuildRank.containsKey(player.getUniqueId())) {
- PlayerData.playerSelectedGuildRank.put(player.getUniqueId(), 10);
- PlayerData.playerSelectedGuildRankChanged = true;
- }
-
- for (int i = 1; i < 21; i++) {
-
- ItemStack itemStack = null;
-
- if (i <= PlayerData.playerMaxGuildRank.get(player.getUniqueId()))
- itemStack = difficultyItemStackConstructor(guildRankStatus.UNLOCKED, i, player);
- if (i > PlayerData.playerMaxGuildRank.get(player.getUniqueId()))
- itemStack = difficultyItemStackConstructor(guildRankStatus.LOCKED, i, player);
- if (i == PlayerData.playerSelectedGuildRank.get(player.getUniqueId()))
- itemStack = difficultyItemStackConstructor(guildRankStatus.SELECTED, i, player);
- if (i == PlayerData.playerMaxGuildRank.get(player.getUniqueId()) + 1) {
- itemStack = difficultyItemStackConstructor(guildRankStatus.NEXT_UNLOCK, i, player);
-
- }
-
- difficultyMenu.addItem(itemStack);
-
- }
-
- player.openInventory(difficultyMenu);
-
- }
-
- private static ItemStack difficultyItemStackConstructor(guildRankStatus guildRankStatus, int rank, Player player) {
-
- ItemStack itemStack = null;
-
- switch (guildRankStatus) {
-
- case UNLOCKED:
- itemStack = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 7);
- ItemMeta unlockedMeta = itemStack.getItemMeta();
- String lowTierWarning = "";
- if (rank < 10) lowTierWarning = ChatColorConverter.convert("&cElites can't drop better loot!");
- else lowTierWarning = ChatColorConverter.convert("&aElites can drop better loot!");
- unlockedMeta.setLore(Arrays.asList(
- ChatColorConverter.convert("&f&m-------------------------------"),
- ChatColorConverter.convert( "&aThis rank is unlocked!"),
- ChatColorConverter.convert("&fYou can select it."),
- lowTierWarning,
- ChatColorConverter.convert("&f&m-------------------------------"),
- lootBonus(rank),
- mobSpawning(rank),
- difficultyBonus(rank)));
- itemStack.setItemMeta(unlockedMeta);
- break;
- case LOCKED:
- itemStack = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 14);
- ItemMeta lockedMeta = itemStack.getItemMeta();
- lockedMeta.setLore(Arrays.asList(
- ChatColorConverter.convert("&f&m-------------------------------"),
- ChatColorConverter.convert("&cThis rank is locked!"),
- ChatColorConverter.convert("&cYou need rank " + (PlayerData.playerMaxGuildRank.get(player.getUniqueId()) + 1) + " first!"),
- ChatColorConverter.convert("&f&m-------------------------------"),
- lootBonus(rank),
- mobSpawning(rank),
- difficultyBonus(rank)));
- itemStack.setItemMeta(lockedMeta);
- break;
- case SELECTED:
- itemStack = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 5);
- ItemMeta selectedMeta = itemStack.getItemMeta();
- String tierWarning = "";
- if (rank < 10) tierWarning = ChatColorConverter.convert("&cElites can't drop better loot!");
- else tierWarning = ChatColorConverter.convert("&aElites can drop better loot!");
- selectedMeta.setLore(Arrays.asList(
- ChatColorConverter.convert("&f&m-------------------------------"),
- ChatColorConverter.convert("&aThis is your current rank!"),
- tierWarning,
- ChatColorConverter.convert("&f&m-------------------------------"),
- lootBonus(rank),
- mobSpawning(rank),
- difficultyBonus(rank)));
- itemStack.setItemMeta(selectedMeta);
- PlayerData.playerSelectedGuildRankChanged = true;
- break;
- case NEXT_UNLOCK:
- itemStack = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 1);
- ItemMeta nextMeta = itemStack.getItemMeta();
- String priceString = "";
- if (!PlayerData.playerCurrency.containsKey(player.getUniqueId())) PlayerData.playerCurrency.put(player.getUniqueId(), 0.0);
- if (tierPriceCalculator(rank) > PlayerData.playerCurrency.get(player.getUniqueId()))
- priceString = "&c" + tierPriceCalculator(rank);
- else
- priceString = "&a" + tierPriceCalculator(rank);
- nextMeta.setLore(Arrays.asList(
- ChatColorConverter.convert("&f&m-------------------------------"),
- ChatColorConverter.convert("&6This is the next rank you can unlock"),
- ChatColorConverter.convert("&aSelect it when you're ready!"),
- ChatColorConverter.convert("&6Costs " + priceString + " &6" + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME)),
- ChatColorConverter.convert("&fYou have &a" + PlayerData.playerCurrency.get(player.getUniqueId()) + " &f" + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME)),
- ChatColorConverter.convert("&f&m-------------------------------"),
- lootBonus(rank),
- mobSpawning(rank),
- difficultyBonus(rank)));
- itemStack.setItemMeta(nextMeta);
- PlayerData.playerMaxGuildRankChanged = true;
- break;
- }
-
- ItemMeta itemMeta = itemStack.getItemMeta();
- itemMeta.setDisplayName(rankNamer(rank) + " rank");
- itemStack.setItemMeta(itemMeta);
-
- return itemStack;
-
- }
-
- private static String rankNamer(int rank) {
-
- String name = "";
-
- if (rank == 1) name = "&8Peaceful Villager";
- if (rank == 2) name = "&8Commoner";
- if (rank == 3) name = "&8Farmer";
- if (rank == 4) name = "&8Bard";
- if (rank == 5) name = "&8Barkeep";
- if (rank == 6) name = "&8Blacksmith";
- if (rank == 7) name = "&8Merchant";
- if (rank == 8) name = "&8Wanderer";
- if (rank == 9) name = "&8Ranger";
- if (rank == 10) name = "&fCasual Adventurer";
- if (rank == 11) name = "&fAdventurer";
- if (rank == 12) name = "&fProfessional Adventurer";
- if (rank == 13) name = "&2Elite Adventurer";
- if (rank == 14) name = "&2Master Adventurer";
- if (rank == 15) name = "&2Raider";
- if (rank == 16) name = "&1Slayer";
- if (rank == 17) name = "&1Exterminator";
- if (rank == 18) name = "&5&lElite HunterEnchantment";
- if (rank == 19) name = "&5Hero";
- if (rank == 20) name = "&6&l&oLegend";
-
- return ChatColorConverter.convert(name);
-
- }
-
- private static String mobSpawning(int rank) {
-
- int mobSpawning = 0;
-
- if (rank == 1) mobSpawning = 10;
- if (rank == 2) mobSpawning = 20;
- if (rank == 3) mobSpawning = 30;
- if (rank == 4) mobSpawning = 40;
- if (rank == 5) mobSpawning = 50;
- if (rank == 6) mobSpawning = 60;
- if (rank == 7) mobSpawning = 70;
- if (rank == 8) mobSpawning = 80;
- if (rank == 9) mobSpawning = 90;
- if (rank == 10) mobSpawning = 100;
- if (rank == 11) mobSpawning = 120;
- if (rank == 12) mobSpawning = 140;
- if (rank == 13) mobSpawning = 160;
- if (rank == 14) mobSpawning = 180;
- if (rank == 15) mobSpawning = 200;
- if (rank == 16) mobSpawning = 220;
- if (rank == 17) mobSpawning = 240;
- if (rank == 18) mobSpawning = 260;
- if (rank == 19) mobSpawning = 280;
- if (rank == 20) mobSpawning = 300;
-
- return ChatColorConverter.convert("&fElite Mob spawn rate modifier: &c" + mobSpawning + "%");
-
- }
-
- private static String lootBonus(int rank) {
-
- int lootBonus = 0;
-
- if (rank == 1) lootBonus = 10;
- if (rank == 2) lootBonus = 20;
- if (rank == 3) lootBonus = 30;
- if (rank == 4) lootBonus = 40;
- if (rank == 5) lootBonus = 50;
- if (rank == 6) lootBonus = 60;
- if (rank == 7) lootBonus = 70;
- if (rank == 8) lootBonus = 80;
- if (rank == 9) lootBonus = 90;
- if (rank == 10) lootBonus = 100;
- if (rank == 11) lootBonus = 120;
- if (rank == 12) lootBonus = 140;
- if (rank == 13) lootBonus = 160;
- if (rank == 14) lootBonus = 180;
- if (rank == 15) lootBonus = 200;
- if (rank == 16) lootBonus = 220;
- if (rank == 17) lootBonus = 240;
- if (rank == 18) lootBonus = 260;
- if (rank == 19) lootBonus = 280;
- if (rank == 20) lootBonus = 300;
-
- return ChatColorConverter.convert("&fElite Mob loot modifier: &a" + lootBonus + "%");
-
- }
-
- private static String difficultyBonus(int rank) {
-
- int difficultyBonus = 0;
-
- if (rank == 1) difficultyBonus = 10;
- if (rank == 2) difficultyBonus = 20;
- if (rank == 3) difficultyBonus = 30;
- if (rank == 4) difficultyBonus = 40;
- if (rank == 5) difficultyBonus = 50;
- if (rank == 6) difficultyBonus = 60;
- if (rank == 7) difficultyBonus = 70;
- if (rank == 8) difficultyBonus = 80;
- if (rank == 9) difficultyBonus = 90;
- if (rank == 10) difficultyBonus = 100;
- if (rank == 11) difficultyBonus = 110;
- if (rank == 12) difficultyBonus = 120;
- if (rank == 13) difficultyBonus = 130;
- if (rank == 14) difficultyBonus = 140;
- if (rank == 15) difficultyBonus = 150;
- if (rank == 16) difficultyBonus = 160;
- if (rank == 17) difficultyBonus = 170;
- if (rank == 18) difficultyBonus = 180;
- if (rank == 19) difficultyBonus = 190;
- if (rank == 20) difficultyBonus = 200;
-
- return ChatColorConverter.convert("&fElite Mob difficulty modifier: &4" + difficultyBonus + "%");
-
- }
-
- private enum guildRankStatus {
- UNLOCKED,
- SELECTED,
- NEXT_UNLOCK,
- LOCKED
- }
-
- private static void questMenu(Player player) {
-
- player.closeInventory();
- player.sendMessage("Coming soon!");
-
- }
-
- private static ItemStack skullItemInitializer(String mhfValue, String title, List lore) {
-
- ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- ItemMeta itemMeta = item.getItemMeta();
- SkullMeta skullMeta = (SkullMeta) itemMeta;
- skullMeta.setOwner(mhfValue);
- item.setItemMeta(skullMeta);
- itemMeta.setDisplayName(title);
- itemMeta.setLore(lore);
- item.setItemMeta(itemMeta);
-
- return item;
-
- }
-
- private static int tierPriceCalculator(int tier) {
-
- return (tier - 10) * (tier - 10) * 1000;
-
- }
-
- @EventHandler
- public void onMainMenuClick(InventoryClickEvent event) {
-
- if (!(event.getWhoClicked() instanceof Player)) return;
- if (!event.getInventory().getName().equalsIgnoreCase("Adventurer's guild")) return;
- if (event.getCurrentItem() == null || event.getCurrentItem().getType().equals(Material.AIR)) return;
- if (event.getCurrentItem().equals(difficulty))
- difficultyMenu((Player) event.getWhoClicked());
- if (event.getCurrentItem().equals(quest)) {
- event.getWhoClicked().closeInventory();
- event.getWhoClicked().sendMessage("Coming soon!");
- }
-
- event.setCancelled(true);
-
- }
-
- @EventHandler
- public void onRankSelectorClick(InventoryClickEvent event) {
-
- if (!(event.getWhoClicked() instanceof Player)) return;
- if (!event.getInventory().getName().equalsIgnoreCase("Guild rank selector")) return;
- if (event.getCurrentItem() == null || event.getCurrentItem().getType().equals(Material.AIR)) return;
-
- event.setCancelled(true);
-
- if (!event.getClickedInventory().getName().equals("Guild rank selector")){
- event.setCancelled(true);
- return;
- }
-
- int maxTier = PlayerData.playerMaxGuildRank.get(event.getWhoClicked().getUniqueId());
- int selectedTier = event.getSlot() + 1;
-
- if (selectedTier < maxTier + 1) {
- PlayerData.playerSelectedGuildRank.put(event.getWhoClicked().getUniqueId(), selectedTier);
- difficultyMenu((Player) event.getWhoClicked());
- }
-
- if (selectedTier == maxTier + 1) {
- if (EconomyHandler.checkCurrency(event.getWhoClicked().getUniqueId()) < tierPriceCalculator(selectedTier))
- event.getWhoClicked().sendMessage("[EliteMobs] You don't have enough Elite Coins! Sell some Elite Mob loot to [/em shop]!");
- else {
- EconomyHandler.subtractCurrency(event.getWhoClicked().getUniqueId(), tierPriceCalculator(selectedTier));
- PlayerData.playerMaxGuildRank.put(event.getWhoClicked().getUniqueId(), selectedTier);
- event.getWhoClicked().sendMessage(ChatColorConverter.convert("&aYou have unlocked the " + rankNamer(selectedTier) + " &arank for " +
- tierPriceCalculator(selectedTier) + " " + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME) + ". \n&6Happy hunting!"));
- difficultyMenu((Player) event.getWhoClicked());
- Bukkit.broadcastMessage(ChatColorConverter.convert(
- ((Player) event.getWhoClicked()).getDisplayName() + " has reached the " + rankNamer(selectedTier) + " &fguild rank!"));
- }
- }
-
- if (selectedTier > maxTier + 1) {
- event.getWhoClicked().sendMessage("[EliteMobs] You need to unlock other ranks first!");
- }
-
-
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java
index c477230b3..ead9234e5 100644
--- a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java
+++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRank.java
@@ -1,20 +1,249 @@
package com.magmaguy.elitemobs.adventurersguild;
-import com.magmaguy.elitemobs.playerdata.PlayerData;
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
+import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.magmacore.util.Round;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.scheduler.BukkitRunnable;
import java.util.UUID;
public class GuildRank {
- public static int getGuildRank (UUID uuid) {
+ private GuildRank() {
+ }
+
+ public static void setGuildPrestigeRank(Player player, int prestigeRank) {
+ PlayerData.setGuildPrestigeLevel(player.getUniqueId(), prestigeRank);
+ ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true);
+ }
+
+ public static int getGuildPrestigeRank(Player player) {
+ return getGuildPrestigeRank(player.getUniqueId());
+ }
+
+ public static int getGuildPrestigeRank(UUID player) {
+ return PlayerData.getGuildPrestigeLevel(player);
+ }
+
+ public static int getGuildPrestigeRank(Player player, boolean databaseAccess) {
+ return PlayerData.getGuildPrestigeLevel(player.getUniqueId(), databaseAccess);
+ }
- if (PlayerData.playerSelectedGuildRank.containsKey(uuid))
- return PlayerData.playerSelectedGuildRank.get(uuid);
+ public static void setMaxGuildRank(Player player, int maxGuildRank) {
+ PlayerData.setMaxGuildLevel(player.getUniqueId(), maxGuildRank);
+ }
+
+ public static int getMaxGuildRank(Player player) {
+ return PlayerData.getMaxGuildLevel(player.getUniqueId());
+ }
- PlayerData.playerSelectedGuildRank.put(uuid, 10);
+ public static int getMaxGuildRank(Player player, boolean databaseAccess) {
+ return PlayerData.getMaxGuildLevel(player.getUniqueId(), databaseAccess);
+ }
+
+ public static void setActiveGuildRank(Player player, int activeGuildRank) {
+ PlayerData.setActiveGuildLevel(player.getUniqueId(), activeGuildRank);
+ setMaxHealth(player, activeGuildRank, getGuildPrestigeRank(player));
+ }
+
+ public static int getActiveGuildRank(Player player) {
+ return PlayerData.getActiveGuildLevel(player.getUniqueId());
+ }
+
+ public static int getActiveGuildRank(Player player, boolean databaseAccess) {
+ return PlayerData.getActiveGuildLevel(player.getUniqueId(), databaseAccess);
+ }
+
+ /**
+ * Returns whether the player's maximum guild rank is below or equal to the rank to be compared.
+ *
+ * @param player Player whose maximum rank will be checked
+ * @param maxGuildLevel Target guild rank
+ * @return Whether the player's guild rank is below or equal to the target
+ */
+ public static boolean isWithinMaxGuildRank(Player player, int prestigeLevel, int maxGuildLevel) {
+ return getGuildPrestigeRank(player) >= prestigeLevel &&
+ getMaxGuildRank(player) >= maxGuildLevel;
+ }
+
+ public static boolean isWithinMaxGuildRankIgnorePrestige(Player player, int maxGuildLevel) {
+ return getMaxGuildRank(player) >= maxGuildLevel;
+ }
- return PlayerData.playerSelectedGuildRank.get(uuid);
+ /**
+ * Checks if the player's active guild rank is below or equal to the target rank.
+ *
+ * @param player Player whose active guild rank will be checked
+ * @param activeGuildLevel Target rank to check
+ * @return Whether the target rank is equal to or higher than the player's active guild rank
+ */
+ public static boolean isAtOrAboveGuildRank(Player player, int prestigeLevel, int activeGuildLevel) {
+ return getGuildPrestigeRank(player) <= prestigeLevel &&
+ getActiveGuildRank(player) <= activeGuildLevel;
+ }
+
+ public static boolean isAtOrAboveGuildRank(Player player, int activeGuildLevel) {
+ return getActiveGuildRank(player) >= activeGuildLevel;
+ }
+
+ /**
+ * Returns the name of the rank as set by the configuration
+ *
+ * @return Name of the rank
+ */
+ public static String getRankName(int prestige, int rank) {
+ return AdventurersGuildConfig.getRankName(prestige, rank);
+ }
+
+ public static void setMaxHealth(Player player, int activeGuildRank, int prestigeRank) {
+ if (!AdventurersGuildConfig.isAddMaxHealth()) return;
+ if (AdventurersGuildConfig.getWorldsWithoutAGBonuses().contains(player.getWorld().getName())) return;
+ double guildRankBonus = healthBonusValue(prestigeRank, activeGuildRank);
+ double newMaxHealth = 20 + guildRankBonus;
+ player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(newMaxHealth);
+ }
+
+ public static void setMaxHealth(Player player) {
+ setMaxHealth(player, PlayerData.getActiveGuildLevel(player.getUniqueId()), PlayerData.getGuildPrestigeLevel(player.getUniqueId()));
+ }
+
+ public static double lootTierValue(int activeGuildRank) {
+ return activeGuildRank * 10;
+ }
+
+ public static double currencyBonusMultiplier(int prestigeLevel) {
+ return 1D + prestigeLevel * 5;
+ }
+
+ public static double currencyBonusMultiplier(UUID player) {
+ return currencyBonusMultiplier(getGuildPrestigeRank(player));
+ }
+
+ /**
+ * Returns the per-tier max health, taking prestige ranks into account
+ *
+ * @param prestigeLevel
+ * @param guildRank
+ * @return
+ */
+ public static double healthBonusValue(int prestigeLevel, int guildRank) {
+ if (!AdventurersGuildConfig.isAddMaxHealth()) return 0;
+ double prestigeBonus = 0;
+ switch (prestigeLevel) {
+ case 0:
+ prestigeBonus = 0;
+ break;
+ case 1:
+ case 2:
+ case 3:
+ prestigeBonus = AdventurersGuildConfig.getHealth1();
+ break;
+ case 4:
+ case 5:
+ case 6:
+ prestigeBonus = AdventurersGuildConfig.getHealth2();
+ break;
+ case 7:
+ case 8:
+ case 9:
+ prestigeBonus = AdventurersGuildConfig.getHealth3();
+ break;
+ case 10:
+ prestigeBonus = AdventurersGuildConfig.getHealth4();
+ break;
+ }
+ return prestigeBonus * guildRank;
+ }
+
+ /**
+ * Returns the per-tier dodge multiplier, taking prestige ranks into account
+ *
+ * @param prestigeLevel
+ * @param guildRank
+ * @return
+ */
+ public static double dodgeBonusValue(int prestigeLevel, int guildRank) {
+ if (!AdventurersGuildConfig.isAddDodge()) return 0;
+ double prestigeBonus = 0;
+ switch (prestigeLevel) {
+ case 0:
+ case 1:
+ case 2:
+ prestigeBonus = 0;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ prestigeBonus = AdventurersGuildConfig.getDodge1();
+ break;
+ case 6:
+ case 7:
+ case 8:
+ prestigeBonus = AdventurersGuildConfig.getDodge2();
+ break;
+ case 9:
+ case 10:
+ prestigeBonus = AdventurersGuildConfig.getDodge3();
+ break;
+ }
+ return Round.twoDecimalPlaces(guildRank / (10D + prestigeLevel) * prestigeBonus);
+ }
+
+ /**
+ * Returns the per-tier crit multiplier, taking prestige ranks into account
+ *
+ * @param prestigeLevel
+ * @param guildRank
+ * @return
+ */
+ public static double critBonusValue(int prestigeLevel, int guildRank) {
+ if (!AdventurersGuildConfig.isAddCrit()) return 0;
+ double prestigeBonus = 0;
+ switch (prestigeLevel) {
+ case 0:
+ case 1:
+ prestigeBonus = 0;
+ break;
+ case 2:
+ case 3:
+ case 4:
+ prestigeBonus = AdventurersGuildConfig.getCrit1();
+ break;
+ case 5:
+ case 6:
+ case 7:
+ prestigeBonus = AdventurersGuildConfig.getCrit2();
+ break;
+ case 8:
+ case 9:
+ case 10:
+ prestigeBonus = AdventurersGuildConfig.getCrit3();
+ break;
+ }
+ return Round.twoDecimalPlaces(guildRank / (10D + prestigeLevel) * prestigeBonus);
+ }
+
+ public static class GuildRankEvents implements Listener {
+ @EventHandler
+ public void onPlayerJoin(PlayerJoinEvent event) {
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ if (event.getPlayer().isOnline())
+ setMaxHealth(event.getPlayer(),
+ GuildRank.getActiveGuildRank(event.getPlayer(), true),
+ GuildRank.getGuildPrestigeRank(event.getPlayer(), true));
+ }
+ }.runTaskLater(MetadataHandler.PLUGIN, 20 * 3);
+ }
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java
new file mode 100644
index 000000000..3d2525113
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/GuildRankMenuHandler.java
@@ -0,0 +1,360 @@
+package com.magmaguy.elitemobs.adventurersguild;
+
+import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.config.EconomySettingsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
+import com.magmaguy.elitemobs.config.menus.premade.GuildRankMenuConfig;
+import com.magmaguy.elitemobs.economy.EconomyHandler;
+import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.inventory.InventoryCloseEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+public class GuildRankMenuHandler implements Listener {
+
+ private static final HashSet inventories = new HashSet<>();
+ private static final ArrayList rankSlots = new ArrayList<>(new ArrayList<>(List.of(
+ 4, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 38, 39, 40, 41, 42)));
+ private static final int prestigeRankSlot = 49;
+
+ private static void selectUnlockedRank(Player player, int guildRank) {
+ GuildRank.setActiveGuildRank(player, guildRank);
+ }
+
+ private static void selectRankToUnlock(Player player, int guildRank) {
+ double price = tierPriceCalculator(guildRank, GuildRank.getGuildPrestigeRank(player));
+ if (EconomyHandler.checkCurrency(player.getUniqueId()) < price) {
+ player.sendMessage(GuildRankMenuConfig.getNotEnoughCurrencyMessage()
+ .replace("$neededAmount", tierPriceCalculator(guildRank, GuildRank.getGuildPrestigeRank(player)) + "")
+ .replace("$currentAmount", EconomyHandler.checkCurrency(player.getUniqueId()) + "")
+ .replace("$currencyName", EconomySettingsConfig.getCurrencyName()));
+ return;
+ }
+ EconomyHandler.subtractCurrency(player.getUniqueId(), price);
+ GuildRank.setActiveGuildRank(player, guildRank);
+ GuildRank.setMaxGuildRank(player, guildRank);
+ player.sendMessage(GuildRankMenuConfig.getUnlockMessage()
+ .replace("$rankName", GuildRank.getRankName(GuildRank.getGuildPrestigeRank(player), guildRank))
+ .replace("$price", tierPriceCalculator(guildRank, GuildRank.getGuildPrestigeRank(player)) + "")
+ .replace("$currencyName", EconomySettingsConfig.getCurrencyName()));
+
+ Bukkit.broadcastMessage(GuildRankMenuConfig.getBroadcastMessage()
+ .replace("$player", player.getDisplayName())
+ .replace("$rankName", GuildRank.getRankName(GuildRank.getGuildPrestigeRank(player), guildRank)));
+ if (!AdventurersGuildConfig.getOnRankUpCommand().isEmpty())
+ for (String command : AdventurersGuildConfig.getOnRankUpCommand())
+ Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ command.replace("$player", player.getName())
+ .replace("$prestigeRank", GuildRank.getActiveGuildRank(player) + "")
+ .replace("$activeRank", GuildRank.getGuildPrestigeRank(player) + ""));
+ player.playSound(player.getLocation(), SoundsConfig.guildRankUpSound, 1, 1);
+ }
+
+ private static void selectPrestigeUnlock(Player player) {
+ if (GuildRank.getGuildPrestigeRank(player) >= 10) return;
+ if (GuildRank.getActiveGuildRank(player) != 10 + GuildRank.getGuildPrestigeRank(player))
+ return;
+ if (EconomyHandler.checkCurrency(player.getUniqueId()) < tierPriceCalculator(GuildRank.getGuildPrestigeRank(player) + 12, GuildRank.getGuildPrestigeRank(player))) {
+ player.sendMessage(GuildRankMenuConfig.getNotEnoughCurrencyMessage()
+ .replace("$neededAmount", tierPriceCalculator(GuildRank.getGuildPrestigeRank(player) + 12, GuildRank.getGuildPrestigeRank(player)) + "")
+ .replace("$currentAmount", EconomyHandler.checkCurrency(player.getUniqueId()) + "")
+ .replace("$currencyName", EconomySettingsConfig.getCurrencyName()));
+ return;
+ }
+ EconomyHandler.setCurrency(player.getUniqueId(), 0);
+ GuildRank.setMaxGuildRank(player, 1);
+ GuildRank.setActiveGuildRank(player, 1);
+ GuildRank.setGuildPrestigeRank(player, GuildRank.getGuildPrestigeRank(player) + 1);
+ PlayerQuestCooldowns.resetPlayerQuests(player);
+
+ for (Player iteratedPlayer : Bukkit.getOnlinePlayers()) {
+ iteratedPlayer.sendTitle(
+ ChatColorConverter.convert(AdventurersGuildConfig.getPrestigeUnlockMessageTitle().replace("$player", player.getDisplayName())
+ .replace("$tier", GuildRank.getGuildPrestigeRank(player) + "")),
+ ChatColorConverter.convert(AdventurersGuildConfig.getPrestigeUnlockMessageSubtitle().replace("$player", player.getDisplayName())
+ .replace("$tier", GuildRank.getGuildPrestigeRank(player) + "")));
+ }
+ player.closeInventory();
+ if (!AdventurersGuildConfig.getOnPrestigeUpCommand().isEmpty())
+ for (String command : AdventurersGuildConfig.getOnPrestigeUpCommand())
+ Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
+ command.replace("$player", player.getName())
+ .replace("$prestigeRank", GuildRank.getActiveGuildRank(player) + "")
+ .replace("$activeRank", GuildRank.getGuildPrestigeRank(player) + ""));
+ player.playSound(player.getLocation(), SoundsConfig.guildPrestigeSound, 1, 1);
+ }
+
+ /**
+ * Using the following slots for the menu:
+ * 4 - Commoner rank
+ * Normal ranks:
+ * 11, 12, 13, 14, 15
+ * 20, 21, 22, 23, 24
+ * 39, 30, 31, 32, 34
+ * 38, 39, 40, 41, 42
+ * 49 - Prestige button
+ *
+ * @param player Player for whom the menu will be generated
+ * @return Returns the inventory generated
+ */
+ public static Inventory initializeGuildRankMenu(Player player) {
+ String menuName = GuildRankMenuConfig.getMenuName();
+ if (DefaultConfig.isForceMenuUnicode() || Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager"))
+ menuName = ChatColor.WHITE + "\uF801\uDA90\uDEFA\uF805 " + menuName;
+ Inventory difficultyMenu = Bukkit.createInventory(player, 54, menuName);
+ difficultyMenu = populateInventory(difficultyMenu, player);
+ inventories.add(difficultyMenu);
+ player.openInventory(difficultyMenu);
+ return difficultyMenu;
+ }
+
+ public static Inventory populateInventory(Inventory difficultyMenu, Player player) {
+ for (int i = 0; i < 11 + GuildRank.getGuildPrestigeRank(player); i++) {
+ if (AdventurersGuildConfig.isDisableCommonerRank() && i == 0) continue;
+ ItemStack itemStack = null;
+ if (GuildRank.isAtOrAboveGuildRank(player, i)) {
+ itemStack = difficultyItemStackConstructor(guildRankStatus.UNLOCKED, i, player, false);
+ }
+ if (GuildRank.getActiveGuildRank(player) < i && GuildRank.getMaxGuildRank(player) >= i) {
+ itemStack = difficultyItemStackConstructor(guildRankStatus.UNLOCKED, i, player, false);
+ }
+ if (GuildRank.getActiveGuildRank(player) == i) {
+ itemStack = difficultyItemStackConstructor(guildRankStatus.SELECTED, i, player, false);
+ }
+ if (GuildRank.getMaxGuildRank(player) < i) {
+ itemStack = difficultyItemStackConstructor(guildRankStatus.LOCKED, i, player, false);
+ }
+ if (GuildRank.getMaxGuildRank(player) + 1 == i) {
+ itemStack = difficultyItemStackConstructor(guildRankStatus.NEXT_UNLOCK, i, player, false);
+ }
+ difficultyMenu.setItem(rankSlots.get(i), itemStack);
+ }
+
+ if (GuildRank.getGuildPrestigeRank(player) < 10) {
+ if (GuildRank.getActiveGuildRank(player) < 10 + GuildRank.getGuildPrestigeRank(player))
+ difficultyMenu.setItem(prestigeRankSlot, difficultyItemStackConstructor
+ (guildRankStatus.PRESTIGE_LOCKED, GuildRank.getGuildPrestigeRank(player) + 1, player, true));
+ else
+ difficultyMenu.setItem(prestigeRankSlot, difficultyItemStackConstructor
+ (guildRankStatus.PRESTIGE_NEXT_UNLOCK, GuildRank.getGuildPrestigeRank(player) + 1, player, true));
+ }
+
+ return difficultyMenu;
+ }
+
+ private static ItemStack difficultyItemStackConstructor(guildRankStatus guildRankStatus, int activeGuildRank, Player player, boolean isPrestigeSlot) {
+
+ ItemStack itemStack = null;
+
+ String priceString = "";
+ if (!isPrestigeSlot)
+ if (tierPriceCalculator(activeGuildRank, GuildRank.getGuildPrestigeRank(player)) > EconomyHandler.checkCurrency(player.getUniqueId()))
+ priceString = "&c" + tierPriceCalculator(activeGuildRank, GuildRank.getGuildPrestigeRank(player));
+ else
+ priceString = "&a" + tierPriceCalculator(activeGuildRank, GuildRank.getGuildPrestigeRank(player));
+ else {
+ if (tierPriceCalculator(GuildRank.getGuildPrestigeRank(player) + 12, GuildRank.getGuildPrestigeRank(player)) > EconomyHandler.checkCurrency(player.getUniqueId()))
+ priceString = "&c" + tierPriceCalculator(GuildRank.getGuildPrestigeRank(player) + 12, GuildRank.getGuildPrestigeRank(player));
+ else
+ priceString = "&a" + tierPriceCalculator(GuildRank.getGuildPrestigeRank(player) + 12, GuildRank.getGuildPrestigeRank(player));
+ }
+ switch (guildRankStatus) {
+ case UNLOCKED:
+ itemStack = constructButtonItemStack(activeGuildRank, GuildRankMenuConfig.getUnlockedButton().clone(), player, priceString);
+ break;
+ case LOCKED:
+ itemStack = constructButtonItemStack(activeGuildRank, GuildRankMenuConfig.getLockedButton().clone(), player, priceString);
+ break;
+ case SELECTED:
+ itemStack = constructButtonItemStack(activeGuildRank, GuildRankMenuConfig.getCurrentButton().clone(), player, priceString);
+ break;
+ case NEXT_UNLOCK:
+ itemStack = constructButtonItemStack(activeGuildRank, GuildRankMenuConfig.getNextButton().clone(), player, priceString);
+ break;
+ case PRESTIGE_LOCKED:
+ itemStack = constructButtonItemStack(activeGuildRank, GuildRankMenuConfig.getPrestigeLockedButton().clone(), player, priceString);
+ break;
+ case PRESTIGE_NEXT_UNLOCK:
+ itemStack = constructButtonItemStack(activeGuildRank, GuildRankMenuConfig.getPrestigeNextUnlockButton().clone(), player, priceString);
+ break;
+ }
+
+ ItemMeta itemMeta = itemStack.getItemMeta();
+ if (guildRankStatus.equals(GuildRankMenuHandler.guildRankStatus.UNLOCKED) ||
+ guildRankStatus.equals(GuildRankMenuHandler.guildRankStatus.LOCKED) ||
+ guildRankStatus.equals(GuildRankMenuHandler.guildRankStatus.SELECTED) ||
+ guildRankStatus.equals(GuildRankMenuHandler.guildRankStatus.NEXT_UNLOCK))
+ itemMeta.setDisplayName(GuildRank.getRankName(GuildRank.getGuildPrestigeRank(player), activeGuildRank));
+ else
+ itemMeta.setDisplayName(itemMeta.getDisplayName().replace("$rank", GuildRank.getGuildPrestigeRank(player) + 1 + ""));
+ itemStack.setItemMeta(itemMeta);
+
+ return itemStack;
+
+ }
+
+ private static ItemStack constructButtonItemStack(int activeGuildRank, ItemStack itemStack, Player player, String priceString) {
+ ItemMeta itemMeta = itemStack.getItemMeta();
+ List newLore = new ArrayList<>();
+ for (String string : itemMeta.getLore()) {
+ switch (string) {
+ case "$lootTier":
+ if (lootTierString(activeGuildRank) != null)
+ newLore.add(lootTierString(activeGuildRank));
+ break;
+ case "$maxHealthIncrease":
+ if (healthBonusString(GuildRank.getGuildPrestigeRank(player), activeGuildRank) != null)
+ newLore.add(healthBonusString(GuildRank.getGuildPrestigeRank(player), activeGuildRank));
+ break;
+ case "$chanceToCrit":
+ if (critBonusString(GuildRank.getGuildPrestigeRank(player), activeGuildRank) != null)
+ newLore.add(critBonusString(GuildRank.getGuildPrestigeRank(player), activeGuildRank));
+ break;
+ case "$chanceToDodge":
+ if (dodgeBonusString(GuildRank.getGuildPrestigeRank(player), activeGuildRank) != null)
+ newLore.add(dodgeBonusString(GuildRank.getGuildPrestigeRank(player), activeGuildRank));
+ break;
+ case "$currencyBonusMessage":
+ if (GuildRank.getGuildPrestigeRank(player) > 0)
+ newLore.add(currencyBonusString(GuildRank.getGuildPrestigeRank(player)));
+ break;
+ default:
+ if (string.contains("$previousRank")) {
+ newLore.add(string.replace("$previousRank",
+ (GuildRank.getRankName(GuildRank.getGuildPrestigeRank(player), GuildRank.getMaxGuildRank(player) + 1))));
+ continue;
+ }
+ if (string.contains("$price")) {
+ newLore.add(
+ ChatColorConverter.convert(
+ string.replace("$price", priceString)
+ .replace("$currencyName", EconomySettingsConfig.getCurrencyName())));
+ continue;
+ }
+ if (string.contains("$currentCurrency")) {
+ newLore.add(string
+ .replace("$currentCurrency", EconomyHandler.checkCurrency(player.getUniqueId()) + "")
+ .replace("$currencyName", EconomySettingsConfig.getCurrencyName()));
+ continue;
+ }
+ newLore.add(string);
+ break;
+ }
+ }
+ itemMeta.setLore(newLore);
+ itemStack.setItemMeta(itemMeta);
+ return itemStack;
+ }
+
+ private static String lootTierString(int activeGuildRank) {
+ if (!AdventurersGuildConfig.isGuildLootLimiter()) return null;
+ return GuildRankMenuConfig.getLootTierMessage().replace("$tier", GuildRank.lootTierValue(activeGuildRank) + "");
+ }
+
+ private static String currencyBonusString(int activeGuildRank) {
+ return GuildRankMenuConfig.getCurrencyBonusMessage().replace("$amount", GuildRank.currencyBonusMultiplier(activeGuildRank) + "");
+ }
+
+ private static String healthBonusString(int prestigeLevel, int guildRank) {
+ if (!AdventurersGuildConfig.isAddMaxHealth()) return null;
+ if (prestigeLevel < 1)
+ return null;
+ return GuildRankMenuConfig.getHealthBonusMessage().replace("$amount", GuildRank.healthBonusValue(prestigeLevel, guildRank) + "");
+ }
+
+ private static String critBonusString(int prestigeLevel, int guildRank) {
+ if (!AdventurersGuildConfig.isAddMaxHealth()) return null;
+ if (prestigeLevel < 2)
+ return null;
+ return GuildRankMenuConfig.getCritBonusMessage().replace("$amount", GuildRank.critBonusValue(prestigeLevel, guildRank) + "");
+ }
+
+ private static String dodgeBonusString(int prestigeLevel, int guildRank) {
+ if (!AdventurersGuildConfig.isAddMaxHealth()) return null;
+ if (prestigeLevel < 3)
+ return null;
+ return GuildRankMenuConfig.getDodgeBonusMessage().replace("$amount", GuildRank.dodgeBonusValue(prestigeLevel, guildRank) + "");
+ }
+
+ private static int tierPriceCalculator(int tier, int prestigeLevel) {
+ /*Logic:
+ tier * 10 = max mob tier
+ max mob tier / 2 = loot shower payout for killing 1 em at max level for that player
+ payout * 1000 = amount of elite mobs to kill before going up a rank
+ */
+ double eliteMobsToKillBeforeGuildRankUp = AdventurersGuildConfig.getBaseKillsForRankUp() + AdventurersGuildConfig.getAdditionalKillsForRankUpPerTier() * (tier - 1);
+ return (int) ((tier - 1) * 10D / 2D * eliteMobsToKillBeforeGuildRankUp * (GuildRank.currencyBonusMultiplier(prestigeLevel)));
+ }
+
+ @EventHandler
+ public void onRankSelectorClick(InventoryClickEvent event) {
+ if (!(event.getWhoClicked() instanceof Player player)) return;
+ if (!inventories.contains(event.getInventory())) return;
+ if (event.getCurrentItem() == null || event.getCurrentItem().getType() == Material.AIR) return;
+ event.setCancelled(true);
+
+ if (event.getSlot() == prestigeRankSlot) {
+ selectPrestigeUnlock(player);
+ return;
+ }
+ Integer selectedRank = null;
+
+ for (int i = 0; i < rankSlots.size(); i++) {
+ if (rankSlots.get(i) == event.getSlot()) {
+ if (AdventurersGuildConfig.isDisableCommonerRank() && i == 4) continue;
+ selectedRank = i;
+ break;
+ }
+ }
+
+ //Clicked nothing
+ if (selectedRank == null) return;
+
+ if (GuildRank.getMaxGuildRank(player) >= selectedRank) {
+ selectUnlockedRank(player, selectedRank);
+ GuildRankMenuHandler.populateInventory(event.getInventory(), player);
+ return;
+ }
+
+ if (GuildRank.getMaxGuildRank(player) + 1 == selectedRank) {
+ selectRankToUnlock(player, selectedRank);
+ GuildRankMenuHandler.populateInventory(event.getInventory(), player);
+ return;
+ }
+
+ if (GuildRank.getMaxGuildRank(player) < selectedRank) {
+ selectPrestigeUnlock(player);
+ GuildRankMenuHandler.populateInventory(event.getInventory(), player);
+ }
+
+ }
+
+ @EventHandler
+ public void onInventoryClose(InventoryCloseEvent event) {
+ inventories.remove(event.getInventory());
+ }
+
+ private enum guildRankStatus {
+ UNLOCKED,
+ SELECTED,
+ NEXT_UNLOCK,
+ LOCKED,
+ PRESTIGE_LOCKED,
+ PRESTIGE_NEXT_UNLOCK,
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/adventurersguild/WorldSwitchBehavior.java b/src/main/java/com/magmaguy/elitemobs/adventurersguild/WorldSwitchBehavior.java
new file mode 100644
index 000000000..142b98a5e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/adventurersguild/WorldSwitchBehavior.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.adventurersguild;
+
+import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
+
+public class WorldSwitchBehavior implements Listener {
+ @EventHandler(ignoreCancelled = true)
+ public void onPlayerTeleport(PlayerChangedWorldEvent event) {
+ if (AdventurersGuildConfig.getWorldsWithoutAGBonuses().isEmpty()) return;
+ //to a world without bonuses
+ if (AdventurersGuildConfig.getWorldsWithoutAGBonuses().contains(event.getPlayer().getWorld().getName()) &&
+ !AdventurersGuildConfig.getWorldsWithoutAGBonuses().contains(event.getFrom().getName()))
+ event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue());
+ //to a world with bonuses
+ else if (!AdventurersGuildConfig.getWorldsWithoutAGBonuses().contains(event.getPlayer().getWorld().getName()) &&
+ AdventurersGuildConfig.getWorldsWithoutAGBonuses().contains(event.getFrom().getName()))
+ GuildRank.setMaxHealth(event.getPlayer());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java b/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java
new file mode 100644
index 000000000..a3b7e0a85
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/announcements/AnnouncementPriority.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.announcements;
+
+import com.magmaguy.elitemobs.config.EventsConfig;
+import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+
+public class AnnouncementPriority {
+ private AnnouncementPriority() {
+ }
+
+ public static void announce(String message, World world, int announcementPriority) {
+ if (announcementPriority == 1 && !EventsConfig.isAnnouncementBroadcastWorldOnly())
+ Bukkit.broadcastMessage(ChatColorConverter.convert(message));
+ else
+ for (Player player : world.getPlayers())
+ player.sendMessage(ChatColorConverter.convert(message));
+ if (announcementPriority < 3) return;
+ new DiscordSRVAnnouncement(ChatColorConverter.convert(message));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ArenaCompleteEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ArenaCompleteEvent.java
new file mode 100644
index 000000000..21c87e646
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ArenaCompleteEvent.java
@@ -0,0 +1,40 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+
+public class ArenaCompleteEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final ArenaInstance arenaInstance;
+
+ /**
+ * Called when an arena gets successfully completed by players.
+ *
+ * @param arenaInstance Instance of the arena that got completed
+ */
+ public ArenaCompleteEvent(ArenaInstance arenaInstance) {
+ this.arenaInstance = arenaInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class ArenaCompleteEventHandler implements Listener {
+ public static void call(ArenaInstance arenaInstance) {
+ ArenaCompleteEvent arenaCompleteEvent = new ArenaCompleteEvent(arenaInstance);
+ new EventCaller(arenaCompleteEvent);
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ArenaStartEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ArenaStartEvent.java
new file mode 100644
index 000000000..1b43b1b42
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ArenaStartEvent.java
@@ -0,0 +1,33 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ArenaStartEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final ArenaInstance arenaInstance;
+
+ /**
+ * Called when an arena starts
+ *
+ * @param arenaInstance
+ */
+ public ArenaStartEvent(ArenaInstance arenaInstance) {
+ this.arenaInstance = arenaInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/CustomEventStartEvent.java b/src/main/java/com/magmaguy/elitemobs/api/CustomEventStartEvent.java
new file mode 100644
index 000000000..43b1bfb30
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/CustomEventStartEvent.java
@@ -0,0 +1,49 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.events.CustomEvent;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+/**
+ * To clear up the weird naming system here, this event is called when custom event (the type created by users for the
+ * customizable in-game event system) is called, i.e. for treasure goblins, meteors and the dead moon event.
+ */
+public class CustomEventStartEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private CustomEvent customEvent;
+ private boolean cancelled = false;
+
+ public CustomEventStartEvent(CustomEvent customEvent) {
+ this.customEvent = customEvent;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public CustomEvent getCustomEvent() {
+ return customEvent;
+ }
+
+ public void setCustomEvent(CustomEvent customEvent) {
+ this.customEvent = customEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/DungeonCompleteEvent.java b/src/main/java/com/magmaguy/elitemobs/api/DungeonCompleteEvent.java
new file mode 100644
index 000000000..ec68d46c0
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/DungeonCompleteEvent.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class DungeonCompleteEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final DungeonInstance dungeonInstance;
+
+ /**
+ * Gets called when players complete a dungeon
+ *
+ * @param dungeonInstance Instance of the dungeon that completed
+ */
+ public DungeonCompleteEvent(DungeonInstance dungeonInstance) {
+ this.dungeonInstance = dungeonInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/DungeonInstallEvent.java b/src/main/java/com/magmaguy/elitemobs/api/DungeonInstallEvent.java
new file mode 100644
index 000000000..45bf46eb0
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/DungeonInstallEvent.java
@@ -0,0 +1,40 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields;
+import lombok.Getter;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class DungeonInstallEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final DungeonPackagerConfigFields dungeonPackagerConfigFields;
+ @Getter
+ private final String dungeonName;
+ @Getter
+ private final String dungeonFilename;
+ private boolean isCancelled = false;
+
+ public DungeonInstallEvent(DungeonPackagerConfigFields dungeonPackagerConfigFields) {
+ this.dungeonPackagerConfigFields = dungeonPackagerConfigFields;
+ this.dungeonName = dungeonPackagerConfigFields.getName();
+ this.dungeonFilename = dungeonPackagerConfigFields.getFilename();
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/DungeonStartEvent.java b/src/main/java/com/magmaguy/elitemobs/api/DungeonStartEvent.java
new file mode 100644
index 000000000..edeeff9f7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/DungeonStartEvent.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class DungeonStartEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final DungeonInstance dungeonInstance;
+
+ public DungeonStartEvent(DungeonInstance dungeonInstance) {
+ this.dungeonInstance = dungeonInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/DungeonUninstallEvent.java b/src/main/java/com/magmaguy/elitemobs/api/DungeonUninstallEvent.java
new file mode 100644
index 000000000..2c112613f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/DungeonUninstallEvent.java
@@ -0,0 +1,39 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields;
+import lombok.Getter;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class DungeonUninstallEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final DungeonPackagerConfigFields dungeonPackagerConfigFields;
+ @Getter
+ private final String dungeonName;
+ @Getter
+ private final String dungeonFilename;
+ private boolean isCancelled = false;
+
+ public DungeonUninstallEvent(DungeonPackagerConfigFields dungeonPackagerConfigFields) {
+ this.dungeonPackagerConfigFields = dungeonPackagerConfigFields;
+ this.dungeonName = dungeonPackagerConfigFields.getName();
+ this.dungeonFilename = dungeonPackagerConfigFields.getFilename();
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java
new file mode 100644
index 000000000..83d11f928
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteDamageEvent.java
@@ -0,0 +1,53 @@
+package com.magmaguy.elitemobs.api;
+
+
+import lombok.Getter;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class EliteDamageEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final Event event;
+ private boolean isCancelled = false;
+ @Getter
+ private double damage;
+
+ /**
+ * Classes that deal with damage in EliteMobs extend this class in order to inherit modifiable and cancellable behavior.
+ * This is purely just used for API purposes, such as with the Elite Scripting system. Does not do anything on its own.
+ *
+ * @param damage Original damage which can be modified.
+ * @param event Original event which can be cancelled.
+ */
+
+ public EliteDamageEvent(double damage, Event event) {
+ this.damage = damage;
+ this.event = event;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public void setDamage(double damage) {
+ this.damage = damage;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ ((Cancellable) event).setCancelled(b);
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteExplosionEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteExplosionEvent.java
new file mode 100644
index 000000000..5097dc65a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteExplosionEvent.java
@@ -0,0 +1,126 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.CrashFix;
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.config.powers.PowersConfigFields;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import lombok.Getter;
+import org.bukkit.Location;
+import org.bukkit.block.BlockState;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.event.*;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class EliteExplosionEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private final List blockStates;
+ @Getter
+ private final PowersConfigFields powersConfigFields;
+ @Getter
+ private Location explosionSourceLocation;
+ private boolean isCancelled = false;
+
+ public EliteExplosionEvent(EliteEntity eliteEntity,
+ PowersConfigFields powersConfigFields,
+ Location explosionSourceLocation,
+ List blockStates) {
+ this.eliteEntity = eliteEntity;
+ this.explosionSourceLocation = explosionSourceLocation;
+ this.powersConfigFields = powersConfigFields;
+ this.blockStates = blockStates;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public void setExplosionSourceLocation(Location explosionSourceLocation) {
+ this.explosionSourceLocation = explosionSourceLocation;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public void visualExplosionEffect(PowersConfigFields powersConfigFields) {
+ VisualExplosionEffectType visualExplosionEffectType;
+
+ if (powersConfigFields == null)
+ visualExplosionEffectType = VisualExplosionEffectType.NORMAL;
+ else if (powersConfigFields.getFilename().equals("ender_dragon_empowered_lightning.yml"))
+ visualExplosionEffectType = VisualExplosionEffectType.ASCEND;
+ else if (powersConfigFields.getFilename().equalsIgnoreCase("ender_dragon_tornado.yml")) {
+ visualExplosionEffectType = VisualExplosionEffectType.HIGH_POWER;
+ } else
+ visualExplosionEffectType = VisualExplosionEffectType.NORMAL;
+
+ for (BlockState blockState : blockStates) {
+ FallingBlock fallingBlock = blockState.getBlock().getWorld().spawnFallingBlock(blockState.getLocation().add(new Vector(0, 0.2, 0)), blockState.getBlockData());
+ fallingBlock.setDropItem(false);
+ fallingBlock.setHurtEntities(true);
+
+ switch (visualExplosionEffectType) {
+ case ASCEND:
+ fallingBlock.setVelocity(fallingBlock.getLocation().clone().subtract(explosionSourceLocation)
+ .toVector().normalize().setY(1).normalize().multiply(ThreadLocalRandom.current().nextDouble()));
+ fallingBlock.setGravity(false);
+ fallingBlock.setGlowing(true);
+ break;
+ case HIGH_POWER:
+ fallingBlock.setVelocity(fallingBlock.getLocation().clone().subtract(explosionSourceLocation).toVector().normalize().setY(2).multiply(0.9));
+ break;
+ case NORMAL:
+ default:
+ fallingBlock.setVelocity(fallingBlock.getLocation().clone().subtract(explosionSourceLocation).toVector().normalize().setY(1).multiply(0.5));
+ }
+
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ if (fallingBlock.isValid())
+ fallingBlock.remove();
+ }
+ }.runTaskLater(MetadataHandler.PLUGIN, 20 * 4);
+
+ CrashFix.registerVisualFallingBlock(fallingBlock);
+ }
+ }
+
+ public enum VisualExplosionEffectType {
+ NORMAL,
+ HIGH_POWER,
+ ASCEND
+ }
+
+ public static class EliteExplosionEvents implements Listener {
+ @EventHandler(ignoreCancelled = true)
+ public void onBlockDrop(EntityChangeBlockEvent event) {
+ if (!event.getEntity().getType().equals(EntityType.FALLING_BLOCK)) return;
+ if (!CrashFix.isVisualFallingBlock(event.getEntity())) return;
+ event.setCancelled(true);
+ event.getEntity().remove();
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByEliteMobEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByEliteMobEvent.java
new file mode 100644
index 000000000..0aa31fcc7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByEliteMobEvent.java
@@ -0,0 +1,81 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
+import com.magmaguy.elitemobs.utils.EntityFinder;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+
+public class EliteMobDamagedByEliteMobEvent extends EliteDamageEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final EliteEntity damager;
+ private final EliteEntity damagee;
+ private final EntityDamageByEntityEvent entityDamageByEntityEvent;
+
+ /**
+ * Event fired when an elite gets damaged by another elite.
+ *
+ * @param damager Damager in the event.
+ * @param damagee Damaged entity in the event.
+ * @param event Original Minecraft damage event.
+ * @param damage Damage in the event. Can be modified!
+ */
+ public EliteMobDamagedByEliteMobEvent(EliteEntity damager, EliteEntity damagee, EntityDamageByEntityEvent event, double damage) {
+ super(damage, event);
+ this.damager = damager;
+ this.damagee = damagee;
+ this.entityDamageByEntityEvent = event;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public EliteEntity getDamager() {
+ return damager;
+ }
+
+ public EliteEntity getDamagee() {
+ return damagee;
+ }
+
+ public EntityDamageByEntityEvent getEntityDamageByEntityEvent() {
+ return entityDamageByEntityEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ //The thing that calls the event
+ public static class EliteMobDamagedByEliteMobFilter implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
+ EliteEntity damagee = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (damagee == null) return;
+ LivingEntity livingEntity = EntityFinder.filterRangedDamagers(event.getDamager());
+ EliteEntity damager = EntityTracker.getEliteMobEntity(livingEntity);
+ if (damager == null) return;
+ if (damager.getLivingEntity() == null) return;
+ if (EliteMobProperties.getPluginData(damager.getLivingEntity().getType()) == null) return;
+ double damage = EliteMobProperties.getBaselineDamage(damager.getLivingEntity().getType(), damager) + damager.getLevel();
+ EliteMobDamagedByEliteMobEvent eliteMobDamagedByEliteMobEvent = new EliteMobDamagedByEliteMobEvent(damager, damagee, event, damage);
+ new EventCaller(eliteMobDamagedByEliteMobEvent);
+ if (eliteMobDamagedByEliteMobEvent.isCancelled()) return;
+ event.setDamage(damage);
+ if (damagee instanceof RegionalBossEntity regionalBossEntity) regionalBossEntity.removeSlow();
+ }
+ }
+
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerAntiExploitEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerAntiExploitEvent.java
new file mode 100644
index 000000000..5ad66656e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerAntiExploitEvent.java
@@ -0,0 +1,64 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class EliteMobDamagedByPlayerAntiExploitEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity entity;
+ private final EliteEntity eliteEntity;
+ private final EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent;
+ private boolean isCancelled = false;
+ private boolean isTriggered = false;
+
+ public EliteMobDamagedByPlayerAntiExploitEvent(EliteEntity eliteEntity, EliteMobDamagedByPlayerEvent event) {
+ this.entity = eliteEntity.getLivingEntity();
+ this.eliteEntity = eliteEntity;
+ this.eliteMobDamagedByPlayerEvent = event;
+ if (eliteEntity.getLivingEntity() != null && !eliteEntity.getLivingEntity().hasAI())
+ setCancelled(true);
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Entity getEntity() {
+ return entity;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return eliteEntity;
+ }
+
+ public EliteMobDamagedByPlayerEvent getEliteMobDamagedByPlayerEvent() {
+ return eliteMobDamagedByPlayerEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+
+ public boolean isTriggered() {
+ return isTriggered;
+ }
+
+ public void setTriggered(boolean triggered) {
+ isTriggered = triggered;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java
new file mode 100644
index 000000000..a86da6566
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedByPlayerEvent.java
@@ -0,0 +1,275 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.EliteMobs;
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.adventurersguild.GuildRank;
+import com.magmaguy.elitemobs.api.utils.EliteItemManager;
+import com.magmaguy.elitemobs.config.ItemSettingsConfig;
+import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import com.magmaguy.elitemobs.entitytracker.CustomProjectileData;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker;
+import com.magmaguy.elitemobs.utils.EntityFinder;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import com.magmaguy.magmacore.util.Round;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.*;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.ProjectileLaunchEvent;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+public class EliteMobDamagedByPlayerEvent extends EliteDamageEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Entity entity;
+ @Getter
+ private final EliteEntity eliteMobEntity;
+ @Getter
+ private final Player player;
+ @Getter
+ private final EntityDamageByEntityEvent entityDamageByEntityEvent;
+ @Getter
+ private final boolean criticalStrike;
+ @Getter
+ private final boolean isCustomDamage;
+ @Getter
+ private final double damageModifier;
+ @Getter
+ public boolean rangedAttack;
+
+ /**
+ * Event fired when an elite is damaged by a player.
+ *
+ * @param eliteEntity Elite damaged.
+ * @param player Player acting as the damged.
+ * @param event Original Minecraft damage event.
+ * @param damage Damage. Can be modifed!
+ * @param criticalStrike Whether the strike is a critical strike.
+ * @param isCustomDamage Whether the amount of damage is custom, meaning it should apply with no damage reduction of any kind, including armor!
+ * @param damageModifier Damage modifiers that the boss may have to reduce incoming damage.
+ */
+ public EliteMobDamagedByPlayerEvent(EliteEntity eliteEntity, Player player, EntityDamageByEntityEvent event, double damage, boolean criticalStrike, boolean isCustomDamage, double damageModifier) {
+ super(damage, event);
+ this.entity = eliteEntity.getLivingEntity();
+ this.eliteMobEntity = eliteEntity;
+ this.player = player;
+ this.entityDamageByEntityEvent = event;
+ this.rangedAttack = event.getDamager() instanceof Projectile;
+ this.criticalStrike = criticalStrike;
+ this.isCustomDamage = isCustomDamage;
+ this.damageModifier = damageModifier;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+
+ //The thing that calls the event
+ public static class EliteMobDamagedByPlayerEventFilter implements Listener {
+ public static boolean bypass = false;
+
+ private static double getThornsDamage(Player player) {
+ if (!ItemSettingsConfig.isUseEliteEnchantments()) return 0D;
+ ElitePlayerInventory elitePlayerInventory = ElitePlayerInventory.getPlayer(player);
+ int thornsLevel = 0;
+ if (elitePlayerInventory.helmet.thornsLevel > Enchantment.THORNS.getMaxLevel())
+ thornsLevel += elitePlayerInventory.helmet.thornsLevel - Enchantment.THORNS.getMaxLevel();
+ if (elitePlayerInventory.chestplate.thornsLevel > Enchantment.THORNS.getMaxLevel())
+ thornsLevel += elitePlayerInventory.chestplate.thornsLevel - Enchantment.THORNS.getMaxLevel();
+ if (elitePlayerInventory.leggings.thornsLevel > Enchantment.THORNS.getMaxLevel())
+ thornsLevel += elitePlayerInventory.helmet.thornsLevel - Enchantment.THORNS.getMaxLevel();
+ if (elitePlayerInventory.boots.thornsLevel > Enchantment.THORNS.getMaxLevel())
+ thornsLevel += elitePlayerInventory.boots.thornsLevel - Enchantment.THORNS.getMaxLevel();
+ return thornsLevel * 2.5D;
+ }
+
+ /**
+ * Gets the amount of damage dealt by EliteMobs-specific features
+ *
+ * @param player Damager
+ * @return Bonus damage applied
+ */
+ private static double getEliteMeleeDamage(Player player, LivingEntity livingEntity) {
+ if (player.getInventory().getItemInMainHand().getType().equals(Material.BOW) || player.getInventory().getItemInMainHand().getType().equals(Material.CROSSBOW))
+ return 0.0;
+ double eliteDamage = ElitePlayerInventory.getPlayer(player).getEliteDamage(true);
+ double bonusEliteDamage = secondaryEnchantmentDamageIncrease(player, livingEntity);
+ return (eliteDamage + bonusEliteDamage) * player.getAttackCooldown();
+ }
+
+ private static double getEliteRangedDamage(Projectile arrow) {
+ //note: the arrow velocity amplitude at full load is about 2.8
+ double arrowSpeedMultiplier = Math.sqrt(Math.pow(arrow.getVelocity().getX(), 2D) + Math.pow(arrow.getVelocity().getY(), 2D) + Math.pow(arrow.getVelocity().getZ(), 2D));
+ arrowSpeedMultiplier /= 4.0D;
+ double arrowDamage = EliteItemManager.getArrowEliteDamage(arrow);
+ return arrowSpeedMultiplier * arrowDamage;
+ }
+
+ private static double getCustomDamageModifier(EliteEntity eliteEntity, Material itemStackType) {
+ if (!(eliteEntity instanceof CustomBossEntity)) return 1;
+ //This doesn't really take into account people switching their weapon out on ranged attacks. That's probably fine.
+ return ((CustomBossEntity) eliteEntity).getDamageModifier(itemStackType);
+ }
+
+ private static double secondaryEnchantmentDamageIncrease(Player player, LivingEntity livingEntity) {
+ if (ItemSettingsConfig.isUseEliteEnchantments()) return 0D;
+ if (livingEntity instanceof Spider || livingEntity instanceof Silverfish) {
+ int level = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).mainhand.getDamageArthropodsLevel(player.getInventory().getItemInMainHand(), false);
+ level -= Enchantment.BANE_OF_ARTHROPODS.getMaxLevel();
+ if (level < 1) return 0D;
+ return level * 2.5D;
+ }
+ if (livingEntity instanceof Zombie || livingEntity instanceof Skeleton || livingEntity instanceof Wither || livingEntity instanceof SkeletonHorse || livingEntity instanceof ZombieHorse || livingEntity.getType().equals(EntityType.ZOMBIFIED_PIGLIN)) {
+ int level = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).mainhand.getDamageUndeadLevel(player.getInventory().getItemInMainHand(), false);
+ level -= Enchantment.SMITE.getMaxLevel();
+ if (level < 1) return 0D;
+ return level * 2.5D;
+ }
+ return 0;
+ }
+
+ private static boolean isCriticalHit(Player player) {
+ double criticalStrike = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getCritChance(false);
+ criticalStrike += (GuildRank.critBonusValue(GuildRank.getGuildPrestigeRank(player), GuildRank.getActiveGuildRank(player)) / 100);
+ return ThreadLocalRandom.current().nextDouble() < criticalStrike;
+ }
+
+ @EventHandler(ignoreCancelled = true)
+ public void onPlayerShootArrow(ProjectileLaunchEvent event) {
+ if (!(event.getEntity().getShooter() instanceof Player)) return;
+ EliteItemManager.tagArrow(event.getEntity());
+ }
+
+ @EventHandler(ignoreCancelled = true)
+ public void onEliteMobAttacked(EntityDamageByEntityEvent event) {
+ if (event.getEntity().getType().equals(EntityType.ENDER_DRAGON) && ((EnderDragon) event.getEntity()).getPhase().equals(EnderDragon.Phase.DYING))
+ return;
+ LivingEntity livingEntity = EntityFinder.filterRangedDamagers(event.getDamager());
+ if (livingEntity == null) return;
+ if (!livingEntity.getType().equals(EntityType.PLAYER)) return;
+ Player player = (Player) livingEntity;
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ //Living entity is sometimes null when the damage is dealt to an already dead entity - might happen with mcmmo due to DOTs and stuff
+ if (eliteEntity == null || !eliteEntity.isValid()) return;
+ //There's at least 1 gun plugin that makes players the projectile themselves.
+ if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE) && !(event.getDamager() instanceof Projectile))
+ return;
+
+ /*
+ From this point on, the damage is confirmed to be processed by EliteMobs
+ */
+
+ //nullify vanilla reductions, this is needed because boss armor is just cosmetic
+ for (EntityDamageEvent.DamageModifier modifier : EntityDamageByEntityEvent.DamageModifier.values())
+ if (event.isApplicable(modifier) && modifier != EntityDamageEvent.DamageModifier.BASE)
+ event.setDamage(modifier, 0);
+
+ //If the damage wasn't caused by an elite item, just allow the event to go as raw
+ double damage = event.getDamage();
+ double eliteDamage = 0;
+ //Sometimes players are "fake" due to npc plugins
+ boolean validPlayer = !player.hasMetadata("NPC") && ElitePlayerInventory.getPlayer(player) != null;
+
+ if (validPlayer && event.getCause().equals(EntityDamageEvent.DamageCause.THORNS))
+ //Thorns are their own kind of damage
+ eliteDamage = getThornsDamage(player);
+ else if (validPlayer && (event.getCause().equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK) || event.getCause().equals(EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK) && EliteItemManager.isEliteMobsItem(player.getInventory().getItemInMainHand())))
+ eliteDamage = getEliteMeleeDamage(player, livingEntity);
+ else if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE))
+ //Scan arrow for arrow damage
+ eliteDamage = getEliteRangedDamage((Projectile) event.getDamager());
+
+ double damageModifier = 1;
+ if (event.getCause().equals(EntityDamageEvent.DamageCause.PROJECTILE))
+ if (CustomProjectileData.getCustomProjectileDataHashMap().get((Projectile) event.getDamager()) == null)
+ damageModifier = getCustomDamageModifier(eliteEntity, null);
+ else
+ damageModifier = getCustomDamageModifier(eliteEntity, CustomProjectileData.getCustomProjectileDataHashMap().get(event.getDamager()).getProjectileShooterMaterial());
+ else getCustomDamageModifier(eliteEntity, player.getInventory().getItemInMainHand().getType());
+
+ if (eliteEntity instanceof CustomBossEntity customBossEntity && customBossEntity.isNormalizedCombat())
+ damage = Round.twoDecimalPlaces((damage + eliteDamage) * damageModifier * MobCombatSettingsConfig.getNormalizedDamageToEliteMultiplier());
+ else
+ damage = Round.twoDecimalPlaces((damage + eliteDamage) * damageModifier * MobCombatSettingsConfig.getDamageToEliteMultiplier());
+
+ boolean criticalHit = false;
+
+ if (validPlayer) {
+ criticalHit = isCriticalHit(player);
+ if (criticalHit) damage *= 1.5;
+ }
+
+ EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent = new EliteMobDamagedByPlayerEvent(eliteEntity, player, event, damage, criticalHit, bypass, damageModifier);
+
+ new EventCaller(eliteMobDamagedByPlayerEvent);
+
+ if (eliteMobDamagedByPlayerEvent.isCancelled()) {
+ event.setCancelled(true);
+ return;
+ }
+
+ //In case things got modified along the way
+ damage = eliteMobDamagedByPlayerEvent.getDamage();
+
+ if (validPlayer) {
+ //Time to deal custom damage!
+ eliteEntity.addDamager(player, damage);
+ }
+
+ //Dragons need special handling due to their custom deaths
+ if (eliteEntity.getLivingEntity() != null && eliteEntity.getLivingEntity().getType().equals(EntityType.ENDER_DRAGON) && eliteEntity.getLivingEntity().getHealth() - damage < 1) {
+ if (eliteEntity.isDying()) return;
+ damage = 0;
+ event.setCancelled(true);
+ ((EnderDragon) eliteEntity.getLivingEntity()).setPhase(EnderDragon.Phase.DYING);
+ eliteEntity.setDying(true);
+ //remove the dragon after it is done with the light show, this death doesn't show up on events
+ Bukkit.getScheduler().runTaskLater(MetadataHandler.PLUGIN, () -> new EventCaller(new EliteMobDeathEvent(eliteEntity)), 200);
+ }
+
+ event.setDamage(EntityDamageEvent.DamageModifier.BASE, damage);
+
+ eliteEntity.syncPluginHealth(((LivingEntity) event.getEntity()).getHealth());
+
+
+ runAntiexploit(eliteEntity, event, eliteMobDamagedByPlayerEvent);
+ }
+
+ private void runAntiexploit(EliteEntity eliteEntity, EntityDamageByEntityEvent event, EliteMobDamagedByPlayerEvent eliteMobDamagedByPlayerEvent) {
+ if (EliteMobsWorld.isEliteMobsWorld(event.getDamager().getWorld().getUID())) return;
+ if (EliteMobs.worldGuardIsEnabled) {
+ Boolean regionQuery = WorldGuardFlagChecker.checkNullableFlag(eliteEntity.getLocation(), WorldGuardCompatibility.getELITEMOBS_ANTIEXPLOIT());
+ if (regionQuery != null && !regionQuery) return;
+ }
+ if (event.getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK &&
+ event.getCause() != EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK &&
+ event.getCause() != EntityDamageEvent.DamageCause.PROJECTILE)
+ return;
+
+ if (eliteEntity.isInAntiExploitCooldown() ||
+ eliteEntity.getLivingEntity() == null) return;
+ Bukkit.getServer().getPluginManager().callEvent(new EliteMobDamagedByPlayerAntiExploitEvent(eliteEntity, eliteMobDamagedByPlayerEvent));
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java
new file mode 100644
index 000000000..888ce2e4a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDamagedEvent.java
@@ -0,0 +1,75 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.EliteMobs;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility;
+import com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardFlagChecker;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class EliteMobDamagedEvent extends EliteDamageEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Entity entity;
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private final EntityDamageEvent entityDamageEvent;
+
+ public EliteMobDamagedEvent(EliteEntity eliteEntity, EntityDamageEvent event, double damage) {
+ super(damage, event);
+ this.entity = eliteEntity.getLivingEntity();
+ this.eliteEntity = eliteEntity;
+ this.entityDamageEvent = event;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class EliteMobDamageEventFilter implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public void onEntityDamagedEvent(EntityDamageEvent event) {
+
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+
+ EliteMobDamagedEvent eliteMobDamagedEvent = new EliteMobDamagedEvent(eliteEntity, event, event.getDamage());
+ new EventCaller(eliteMobDamagedEvent);
+ if (eliteMobDamagedEvent.isCancelled()) {
+ eliteMobDamagedEvent.setCancelled(true);
+ return;
+ }
+
+ //happens if it dies
+ if (!eliteEntity.isValid()) return;
+
+ if (EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return;
+
+ if (EliteMobs.worldGuardIsEnabled && !WorldGuardFlagChecker.checkFlag(eliteEntity.getLivingEntity().getLocation(),
+ WorldGuardCompatibility.getELITEMOBS_ANTIEXPLOIT()))
+ return;
+
+ Bukkit.getServer().getPluginManager().callEvent(new GenericAntiExploitEvent(eliteEntity, event));
+
+ }
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobDeathEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDeathEvent.java
new file mode 100644
index 000000000..7ed9ca552
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobDeathEvent.java
@@ -0,0 +1,70 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.api.internal.RemovalReason;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDeathEvent;
+
+public class EliteMobDeathEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity entity;
+ private final EliteEntity eliteEntity;
+ private EntityDeathEvent entityDeathEvent = null;
+
+ public EliteMobDeathEvent(EliteEntity eliteEntity, EntityDeathEvent entityDeathEvent) {
+ this.entity = eliteEntity.getUnsyncedLivingEntity();
+ this.eliteEntity = eliteEntity;
+ this.entityDeathEvent = entityDeathEvent;
+ eliteEntity.remove(RemovalReason.DEATH);
+ }
+
+ /**
+ * This is necessary for End Dragons
+ *
+ * @param eliteEntity
+ */
+ public EliteMobDeathEvent(EliteEntity eliteEntity) {
+ this.entity = eliteEntity.getUnsyncedLivingEntity();
+ this.eliteEntity = eliteEntity;
+ new EventCaller(new EliteMobRemoveEvent(eliteEntity, RemovalReason.DEATH));
+ }
+
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Entity getEntity() {
+ return this.entity;
+ }
+
+ public EliteEntity getEliteEntity() {
+ return this.eliteEntity;
+ }
+
+ public EntityDeathEvent getEntityDeathEvent() {
+ return this.entityDeathEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class EliteMobDeathEventFilter implements Listener {
+ @EventHandler
+ public void onMobDeath(EntityDeathEvent event) {
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+ new EventCaller(new EliteMobDeathEvent(eliteEntity, event));
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobEnterCombatEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobEnterCombatEvent.java
new file mode 100644
index 000000000..9fc75f727
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobEnterCombatEvent.java
@@ -0,0 +1,95 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.utils.CommandRunner;
+import com.magmaguy.elitemobs.utils.EntitySearch;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import org.bukkit.Bukkit;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Mob;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+
+import java.util.ArrayList;
+
+public class EliteMobEnterCombatEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Player targetEntity;
+ private final EliteEntity eliteEntity;
+
+ public EliteMobEnterCombatEvent(EliteEntity eliteEntity, Player targetEntity) {
+ this.targetEntity = targetEntity;
+ this.eliteEntity = eliteEntity;
+
+ if (!DefaultConfig.isAlwaysShowNametags())
+ eliteEntity.setNameVisible(true);
+ if (eliteEntity instanceof CustomBossEntity customBossEntity)
+ CommandRunner.runCommandFromList(customBossEntity.getCustomBossesConfigFields().getOnCombatEnterCommands(), new ArrayList<>());
+ //Phase bosses can launch this event through phase switches
+ if (!eliteEntity.isInCombat())
+ Bukkit.getScheduler().runTaskTimerAsynchronously(MetadataHandler.PLUGIN, task -> {
+ if (!eliteEntity.isValid()) {
+ task.cancel();
+ Bukkit.getScheduler().runTask(MetadataHandler.PLUGIN, syncTask -> new EventCaller(new EliteMobExitCombatEvent(eliteEntity, EliteMobExitCombatEvent.EliteMobExitCombatReason.ELITE_NOT_VALID)));
+ return;
+ }
+ if (!eliteEntity.isInCombatGracePeriod()) {
+ double followRange = eliteEntity.getLivingEntity().getAttribute(Attribute.GENERIC_FOLLOW_RANGE).getValue();
+ if (eliteEntity.getLivingEntity().getType().equals(EntityType.ENDER_DRAGON))
+ followRange = 200;
+ if (EntitySearch.getNearbyCombatPlayers(eliteEntity.getLocation(), followRange).isEmpty()) {
+ task.cancel();
+ Bukkit.getScheduler().runTask(MetadataHandler.PLUGIN, syncTask -> new EventCaller(new EliteMobExitCombatEvent(eliteEntity, EliteMobExitCombatEvent.EliteMobExitCombatReason.NO_NEARBY_PLAYERS)));
+ }
+ }
+ }, 20L, 20L);
+ eliteEntity.setInCombat(true);
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Player getTargetEntity() {
+ return this.targetEntity;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return this.eliteEntity;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class EliteMobEnterCombatEventFilter implements Listener {
+ @EventHandler(ignoreCancelled = true)
+ public void onEliteMobDamaged(EliteMobDamagedByPlayerEvent event) {
+ if (event.getEliteMobEntity().isInCombat()) return;
+ if (!(event.getEliteMobEntity().getLivingEntity() instanceof Mob)) return;
+ Bukkit.getServer().getPluginManager().callEvent(new EliteMobEnterCombatEvent(event.getEliteMobEntity(), event.getPlayer()));
+ }
+
+ @EventHandler(ignoreCancelled = true)
+ public void onEliteMobDamage(PlayerDamagedByEliteMobEvent event) {
+ if (event.getEliteMobEntity().isInCombat()) return;
+ if (!(event.getEliteMobEntity().getLivingEntity() instanceof Mob)) return;
+ Bukkit.getServer().getPluginManager().callEvent(new EliteMobEnterCombatEvent(event.getEliteMobEntity(), event.getPlayer()));
+ }
+
+ @EventHandler(ignoreCancelled = true)
+ public void onEliteMobTarget(EliteMobTargetPlayerEvent event) {
+ if (event.getEliteMobEntity().isInCombat()) return;
+ Bukkit.getServer().getPluginManager().callEvent(new EliteMobEnterCombatEvent(event.getEliteMobEntity(), event.getPlayer()));
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobExitCombatEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobExitCombatEvent.java
new file mode 100644
index 000000000..c664d86c6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobExitCombatEvent.java
@@ -0,0 +1,64 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.utils.CommandRunner;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import java.util.ArrayList;
+
+public class EliteMobExitCombatEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final EliteEntity eliteEntity;
+ private final EliteMobExitCombatReason eliteMobExitCombatReason;
+
+
+ public EliteMobExitCombatEvent(EliteEntity eliteEntity, EliteMobExitCombatReason reason) {
+ this.eliteEntity = eliteEntity;
+ this.eliteMobExitCombatReason = reason;
+// if (!eliteEntity.isInCombat()) return; todo: this might be necessary
+ eliteEntity.setInCombat(false);
+ if (eliteEntity.getUnsyncedLivingEntity().isDead()) return;
+ //only run commands if the reason for leaving combat isn't death, onDeath commands exist for that case
+ if (eliteEntity instanceof CustomBossEntity)
+ CommandRunner.runCommandFromList(((CustomBossEntity) eliteEntity).getCustomBossesConfigFields().getOnCombatLeaveCommands(), new ArrayList<>());
+ if (eliteEntity.isValid() &&
+ MobCombatSettingsConfig.isRegenerateCustomBossHealthOnCombatEnd() &&
+ !reason.equals(EliteMobExitCombatReason.PHASE_SWITCH) &&
+ !eliteEntity.getUnsyncedLivingEntity().getType().equals(EntityType.PHANTOM)) {
+ eliteEntity.fullHeal();
+ }
+ if (!DefaultConfig.isAlwaysShowNametags())
+ eliteEntity.setNameVisible(false);
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return this.eliteEntity;
+ }
+
+ public EliteMobExitCombatReason getEliteMobExitCombatReason() {
+ return eliteMobExitCombatReason;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public enum EliteMobExitCombatReason {
+ NO_NEARBY_PLAYERS,
+ SPIRIT_WALK,
+ ELITE_NOT_VALID,
+ PHASE_SWITCH
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobHealEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobHealEvent.java
new file mode 100644
index 000000000..e80d6e71c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobHealEvent.java
@@ -0,0 +1,49 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import lombok.Getter;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class EliteMobHealEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private double healAmount = 0;
+ private boolean isCancelled = false;
+ @Getter
+ private boolean fullHeal = false;
+
+ public EliteMobHealEvent(EliteEntity eliteEntity, double healAmount) {
+ this.eliteEntity = eliteEntity;
+ this.healAmount = healAmount;
+ }
+
+ public EliteMobHealEvent(EliteEntity eliteEntity, boolean fullHeal) {
+ this.eliteEntity = eliteEntity;
+ this.fullHeal = fullHeal;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobRemoveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobRemoveEvent.java
new file mode 100644
index 000000000..452486484
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobRemoveEvent.java
@@ -0,0 +1,49 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.api.internal.RemovalReason;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class EliteMobRemoveEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity entity;
+ private final EliteEntity eliteEntity;
+ private final RemovalReason removalReason;
+
+ /**
+ * This is always the last event to be called when an Elite Mob dies, and is used to clean up references to it in memory.
+ *
+ * @param eliteEntity Elite Mob removed
+ * @param removalReason Reason for removal
+ */
+ public EliteMobRemoveEvent(EliteEntity eliteEntity, RemovalReason removalReason) {
+ this.entity = eliteEntity.getUnsyncedLivingEntity();
+ this.eliteEntity = eliteEntity;
+ this.removalReason = removalReason;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Entity getEntity() {
+ return this.entity;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return this.eliteEntity;
+ }
+
+ public RemovalReason getRemovalReason() {
+ return removalReason;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobSpawnEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobSpawnEvent.java
new file mode 100644
index 000000000..3e95484b6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobSpawnEvent.java
@@ -0,0 +1,90 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+
+public class EliteMobSpawnEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final LivingEntity livingEntity;
+ private final EliteEntity eliteEntity;
+ private final CreatureSpawnEvent.SpawnReason spawnReason;
+ private boolean isCancelled = false;
+
+ /**
+ * Cancelling this event will prevent the Elite Mob from being constructed by removing it and the entity it would've converted
+ *
+ * @param eliteEntity EliteMobEntity being formed
+ */
+ public EliteMobSpawnEvent(EliteEntity eliteEntity) {
+ this.livingEntity = eliteEntity.getLivingEntity();
+ this.eliteEntity = eliteEntity;
+ this.spawnReason = eliteEntity.getSpawnReason();
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * Returns the entity being converted to an EliteMobEntity
+ *
+ * @return Entity being converted into an Elite Mob
+ */
+ public LivingEntity getEntity() {
+ return this.livingEntity;
+ }
+
+ /**
+ * Returns the EliteMobEntity currently being formed
+ *
+ * @return EliteMobEntity currently being formed
+ */
+ public EliteEntity getEliteMobEntity() {
+ return this.eliteEntity;
+ }
+
+ /**
+ * Gets the reason for the Entity getting spawned
+ *
+ * @return Reason for the Entity getting spawned
+ */
+ public CreatureSpawnEvent.SpawnReason getReason() {
+ return this.spawnReason;
+ }
+
+ /**
+ * Returns if the event is cancelled
+ *
+ * @return If the event is cancelled
+ */
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ /**
+ * Cancels the event. This will cancel the formation of the Elite Mob and remove the living entity. Once cancelled it can't be uncancelled.
+ *
+ * @param cancel Cancels the event
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.isCancelled = cancel;
+ }
+
+ /**
+ * Returns a list of handlers
+ *
+ * @return List of handlers
+ */
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/EliteMobTargetPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/EliteMobTargetPlayerEvent.java
new file mode 100644
index 000000000..480f26a8b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/EliteMobTargetPlayerEvent.java
@@ -0,0 +1,67 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+
+public class EliteMobTargetPlayerEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity entity;
+ private final EliteEntity eliteEntity;
+ private final Player player;
+ private final EntityTargetLivingEntityEvent entityTargetLivingEntityEvent;
+
+ public EliteMobTargetPlayerEvent(EliteEntity eliteEntity, Player player, EntityTargetLivingEntityEvent event) {
+ this.entity = event.getEntity();
+ this.eliteEntity = eliteEntity;
+ this.player = player;
+ this.entityTargetLivingEntityEvent = event;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Entity getEntity() {
+ return this.entity;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return this.eliteEntity;
+ }
+
+ public Player getPlayer() {
+ return this.player;
+ }
+
+ public EntityTargetLivingEntityEvent entityTargetLivingEntityEvent() {
+ return this.entityTargetLivingEntityEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class EliteMobTargetPlayerEventFilter implements Listener {
+ @EventHandler
+ public void onMobTarget(EntityTargetLivingEntityEvent event) {
+ if (!(event.getTarget() instanceof Player player)) return;
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+
+ if (player.getGameMode().equals(GameMode.ADVENTURE) || player.getGameMode().equals(GameMode.SURVIVAL))
+ Bukkit.getServer().getPluginManager().callEvent(new EliteMobTargetPlayerEvent(eliteEntity, player, event));
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ElitePhaseSwitchEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ElitePhaseSwitchEvent.java
new file mode 100644
index 000000000..0f24c4520
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ElitePhaseSwitchEvent.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.PhaseBossEntity;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ElitePhaseSwitchEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final CustomBossEntity customBossEntity;
+ @Getter
+ private final PhaseBossEntity phaseBossEntity;
+
+ public ElitePhaseSwitchEvent(CustomBossEntity customBossEntity, PhaseBossEntity phaseBossEntity) {
+ this.customBossEntity = customBossEntity;
+ this.phaseBossEntity = phaseBossEntity;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/GenericAntiExploitEvent.java b/src/main/java/com/magmaguy/elitemobs/api/GenericAntiExploitEvent.java
new file mode 100644
index 000000000..30723f7ad
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/GenericAntiExploitEvent.java
@@ -0,0 +1,132 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.util.Vector;
+
+public class GenericAntiExploitEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity entity;
+ private final EliteEntity eliteEntity;
+ private final EntityDamageEvent entityDamageEvent;
+ public Block
+ block000, block001, block002,
+ block010, block011, block012,
+ block020, block021, block022,
+ block030, block031, block032,
+ block100, blockBelow, block102,
+ block110, ground, block112,
+ block120, headMaterial, block122,
+ block130, ceilingMaterial, block132,
+ block200, block201, block202,
+ block210, block211, block212,
+ block220, block221, block222,
+ block230, block231, block232;
+ private boolean isCancelled = false;
+ private boolean isTriggered = false;
+
+ public GenericAntiExploitEvent(EliteEntity eliteEntity, EntityDamageEvent event) {
+ this.entity = eliteEntity.getLivingEntity();
+ this.eliteEntity = eliteEntity;
+ this.entityDamageEvent = event;
+ this.isCancelled = event.isCancelled();
+ if (event.isCancelled()) return;
+ if (!eliteEntity.getLivingEntity().hasAI())
+ setCancelled(true);
+ block000 = defineMaterial(new Vector(-1, -1, -1));
+ block001 = defineMaterial(new Vector(-1, -1, 0));
+ block002 = defineMaterial(new Vector(-1, -1, 1));
+ block010 = defineMaterial(new Vector(-1, 0, -1));
+ block011 = defineMaterial(new Vector(-1, 0, 0));
+ block012 = defineMaterial(new Vector(-1, 0, 1));
+ block020 = defineMaterial(new Vector(-1, 1, -1));
+ block021 = defineMaterial(new Vector(-1, 1, 0));
+ block022 = defineMaterial(new Vector(-1, 1, 1));
+ block030 = defineMaterial(new Vector(-1, 2, -1));
+ block031 = defineMaterial(new Vector(-1, 2, 0));
+ block032 = defineMaterial(new Vector(-1, 2, 1));
+ block100 = defineMaterial(new Vector(0, -1, -1));
+ //mob floor location
+ blockBelow = defineMaterial(new Vector(0, -1, 0));
+ block102 = defineMaterial(new Vector(0, -1, 1));
+ block110 = defineMaterial(new Vector(0, 0, -1));
+ //mob ground location
+ ground = defineMaterial(new Vector(0, 0, 0));
+ block112 = defineMaterial(new Vector(0, 0, 1));
+ block120 = defineMaterial(new Vector(0, 1, -1));
+ //mob head location
+ headMaterial = defineMaterial(new Vector(0, 1, 0));
+ block122 = defineMaterial(new Vector(0, 1, 1));
+ block130 = defineMaterial(new Vector(0, 2, -1));
+ //ceiling block
+ ceilingMaterial = defineMaterial(new Vector(0, 2, 0));
+ block132 = defineMaterial(new Vector(0, 2, 1));
+ block200 = defineMaterial(new Vector(1, -1, -1));
+ block201 = defineMaterial(new Vector(1, -1, 0));
+ block202 = defineMaterial(new Vector(1, -1, 1));
+ block210 = defineMaterial(new Vector(1, 0, -1));
+ block211 = defineMaterial(new Vector(1, 0, 0));
+ block212 = defineMaterial(new Vector(1, 0, 1));
+ block220 = defineMaterial(new Vector(1, 1, -1));
+ block221 = defineMaterial(new Vector(1, 1, 0));
+ block222 = defineMaterial(new Vector(1, 1, 1));
+ block230 = defineMaterial(new Vector(1, 2, -1));
+ block231 = defineMaterial(new Vector(1, 2, 0));
+ block232 = defineMaterial(new Vector(1, 2, 1));
+
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private Block defineMaterial(Vector offset) {
+ Location clonedLocation = entity.getLocation().getBlock().getLocation().add(new Vector(0.5, 0.5, 0.5)).clone();
+ //Location templocation = clonedLocation.clone().add(offset);
+ //new DebugBlockLocation(templocation);
+ return clonedLocation.add(offset).getBlock();
+ }
+
+ public Entity getEntity() {
+ return entity;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return eliteEntity;
+ }
+
+ public EntityDamageEvent getEntityDamageEvent() {
+ return entityDamageEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+
+ public boolean isTriggered() {
+ return isTriggered;
+ }
+
+ public void setTriggered(boolean triggered) {
+ isTriggered = triggered;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/InstancedDungeonRemoveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/InstancedDungeonRemoveEvent.java
new file mode 100644
index 000000000..819891422
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/InstancedDungeonRemoveEvent.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class InstancedDungeonRemoveEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final DungeonInstance dungeonInstance;
+
+ public InstancedDungeonRemoveEvent(DungeonInstance dungeonInstance) {
+ this.dungeonInstance = dungeonInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/NPCEntityRemoveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/NPCEntityRemoveEvent.java
new file mode 100644
index 000000000..2d8ed2b0b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/NPCEntityRemoveEvent.java
@@ -0,0 +1,4 @@
+package com.magmaguy.elitemobs.api;
+
+public class NPCEntityRemoveEvent {
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/NPCEntitySpawnEvent.java b/src/main/java/com/magmaguy/elitemobs/api/NPCEntitySpawnEvent.java
new file mode 100644
index 000000000..dd29d735f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/NPCEntitySpawnEvent.java
@@ -0,0 +1,77 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.npcs.NPCEntity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class NPCEntitySpawnEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final LivingEntity livingEntity;
+ private final NPCEntity npcEntity;
+ private boolean isCancelled = false;
+
+ /**
+ * Cancelling this event will prevent the NPC from being constructed by removing it and the entity it would've converted
+ */
+ public NPCEntitySpawnEvent(LivingEntity livingEntity, NPCEntity npcEntity) {
+ this.livingEntity = livingEntity;
+ this.npcEntity = npcEntity;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * Returns the entity being converted to an EliteMobEntity
+ *
+ * @return Entity being converted into an Elite Mob
+ */
+ public LivingEntity getLivingEntity() {
+ return this.livingEntity;
+ }
+
+ /**
+ * Returns the EliteMobEntity currently being formed
+ *
+ * @return EliteMobEntity currently being formed
+ */
+ public NPCEntity getNPCEntity() {
+ return this.npcEntity;
+ }
+
+
+ /**
+ * Returns if the event is cancelled
+ *
+ * @return If the event is cancelled
+ */
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ /**
+ * Cancels the event. This will cancel the formation of the Elite Mob and remove the living entity. Once cancelled it can't be uncancelled.
+ *
+ * @param cancel Cancels the event
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.isCancelled = cancel;
+ if (isCancelled)
+ livingEntity.remove();
+ }
+
+ /**
+ * Returns a list of handlers
+ *
+ * @return List of handlers
+ */
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java
new file mode 100644
index 000000000..70e38bffd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerDamagedByEliteMobEvent.java
@@ -0,0 +1,256 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.adventurersguild.GuildRank;
+import com.magmaguy.elitemobs.collateralminecraftchanges.PlayerDeathMessageByEliteMob;
+import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
+import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import lombok.Getter;
+import lombok.Setter;
+import org.bukkit.Material;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.*;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.inventory.meta.Damageable;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class PlayerDamagedByEliteMobEvent extends EliteDamageEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity entity;
+ private final EliteEntity eliteEntity;
+ private final Player player;
+ private final EntityDamageByEntityEvent entityDamageByEntityEvent;
+ private final Projectile projectile;
+
+ public PlayerDamagedByEliteMobEvent(EliteEntity eliteEntity, Player player, EntityDamageByEntityEvent event, Projectile projectile, double damage) {
+ super(damage, event);
+ this.entity = event.getEntity();
+ this.eliteEntity = eliteEntity;
+ this.player = player;
+ this.entityDamageByEntityEvent = event;
+ this.projectile = projectile;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Entity getEntity() {
+ return this.entity;
+ }
+
+ public EliteEntity getEliteMobEntity() {
+ return this.eliteEntity;
+ }
+
+ public Player getPlayer() {
+ return this.player;
+ }
+
+ public Projectile getProjectile() {
+ return projectile;
+ }
+
+ public EntityDamageByEntityEvent getEntityDamageByEntityEvent() {
+ return this.entityDamageByEntityEvent;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ //Thing that launches the event
+ public static class PlayerDamagedByEliteMobEventFilter implements Listener {
+ @Getter
+ @Setter
+ private static boolean bypass = false;
+ @Getter
+ @Setter
+ private static double specialMultiplier = 1;
+
+ private static double eliteToPlayerDamageFormula(Player player, EliteEntity eliteEntity, EntityDamageByEntityEvent event) {
+ double baseDamage = EliteMobProperties.getBaselineDamage(eliteEntity.getLivingEntity().getType(), eliteEntity);
+ //Case for creeper and ghast explosions
+ if (eliteEntity.getLivingEntity() != null && player.isValid() && player.getLocation().getWorld().equals(eliteEntity.getLivingEntity().getWorld()))
+ if (eliteEntity.getLivingEntity().getType().equals(EntityType.CREEPER)) {
+ Creeper creeper = (Creeper) eliteEntity.getLivingEntity();
+ double distance = player.getLocation().distance(eliteEntity.getLivingEntity().getLocation());
+ double distanceAttenuation = 1 - distance / creeper.getExplosionRadius();
+ distanceAttenuation = distanceAttenuation < 0 ? 0 : distanceAttenuation;
+ baseDamage *= distanceAttenuation;
+ } else if (eliteEntity.getLivingEntity().getType().equals(EntityType.GHAST) &&
+ event.getDamager().getType().equals(EntityType.FIREBALL)) {
+ double distance = player.getLocation().distance(eliteEntity.getLivingEntity().getLocation());
+ double distanceAttenuation = 1 - distance / ((Fireball) event.getDamager()).getYield();
+ distanceAttenuation = distanceAttenuation < 0 ? 0 : distanceAttenuation;
+ baseDamage *= distanceAttenuation;
+ }
+ double bonusDamage = eliteEntity.getLevel() * .5; //A .5 increase in damage for every level the mob has
+
+ ElitePlayerInventory elitePlayerInventory = ElitePlayerInventory.getPlayer(player);
+ if (elitePlayerInventory == null) return 0;
+
+ //Bosses now gain .5 damage per level instead of 1 damage per level to make fight against high level and low level mobs more lenient
+ double damageReduction = elitePlayerInventory.getEliteDefense(true) * 0.5;
+ if (event.getDamager() instanceof AbstractArrow)
+ damageReduction += elitePlayerInventory.getEliteProjectileProtection(true);
+ if (event.getDamager() instanceof Fireball || event.getDamager() instanceof Creeper) {
+ damageReduction += elitePlayerInventory.getEliteBlastProtection(true);
+ }
+
+ double customBossDamageMultiplier = eliteEntity.getDamageMultiplier();
+ double potionEffectDamageReduction = 0;
+
+ if (player.hasPotionEffect(PotionEffectType.RESISTANCE))
+ potionEffectDamageReduction = (player.getPotionEffect(PotionEffectType.RESISTANCE).
+ getAmplifier() + 1) * MobCombatSettingsConfig.getResistanceDamageMultiplier();
+
+ double finalDamage;
+ if (eliteEntity instanceof CustomBossEntity customBossEntity && customBossEntity.isNormalizedCombat())
+ finalDamage = Math.max(baseDamage + bonusDamage - damageReduction - potionEffectDamageReduction, 1) *
+ customBossDamageMultiplier * specialMultiplier * MobCombatSettingsConfig.getNormalizedDamageToPlayerMultiplier();
+ else
+ finalDamage = Math.max(baseDamage + bonusDamage - damageReduction - potionEffectDamageReduction, 1) *
+ customBossDamageMultiplier * specialMultiplier * MobCombatSettingsConfig.getDamageToPlayerMultiplier();
+
+ if (specialMultiplier != 1) specialMultiplier = 1;
+
+ double playerMaxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
+
+ //Prevent 1-shots
+ finalDamage = Math.min(finalDamage, playerMaxHealth - 1);
+
+ return finalDamage;
+ }
+
+ //Remove potion effects of creepers when they blow up because Minecraft passes those effects to players, and they are infinite
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
+ private void explosionEvent(EntityExplodeEvent event) {
+ if (event.getEntity().getType().equals(EntityType.CREEPER) && EntityTracker.isEliteMob(event.getEntity())) {
+ //by default minecraft spreads potion effects
+ Set potionEffects = new HashSet<>(((Creeper) event.getEntity()).getActivePotionEffects());
+ potionEffects.forEach(potionEffectType -> ((Creeper) event.getEntity()).removePotionEffect(potionEffectType.getType()));
+ }
+ }
+
+ @EventHandler
+ public void onEliteDamagePlayer(EntityDamageByEntityEvent event) {
+ if (event.isCancelled()) {
+ bypass = false;
+ if (!(event.getDamager() instanceof Explosive))
+ return;
+ }
+ if (!(event.getEntity() instanceof Player player)) return;
+
+ //citizens
+ if (player.hasMetadata("NPC") || ElitePlayerInventory.getPlayer(player) == null)
+ return;
+
+ Projectile projectile = null;
+
+ EliteEntity eliteEntity = null;
+ if (event.getDamager() instanceof LivingEntity)
+ eliteEntity = EntityTracker.getEliteMobEntity(event.getDamager());
+ else if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof LivingEntity) {
+ eliteEntity = EntityTracker.getEliteMobEntity((LivingEntity) ((Projectile) event.getDamager()).getShooter());
+ projectile = (Projectile) event.getDamager();
+ } else if (event.getDamager().getType().equals(EntityType.EVOKER_FANGS))
+ if (((EvokerFangs) event.getDamager()).getOwner() != null)
+ eliteEntity = EntityTracker.getEliteMobEntity(((EvokerFangs) event.getDamager()).getOwner());
+
+ if (eliteEntity == null || eliteEntity.getLivingEntity() == null) return;
+
+ //By this point, it is guaranteed that this kind of damage should have custom EliteMobs behavior
+
+ //dodge chance
+ if (ThreadLocalRandom.current().nextDouble() < GuildRank.dodgeBonusValue(GuildRank.getGuildPrestigeRank(player), GuildRank.getActiveGuildRank(player)) / 100) {
+ player.sendTitle(" ", "Dodged!");
+ event.setCancelled(true);
+ return;
+ }
+
+ boolean blocking = false;
+
+ //Blocking reduces melee damage and nullifies most ranged damage at the cost of shield durability
+ if (player.isBlocking()) {
+ blocking = true;
+ if (player.getInventory().getItemInOffHand().getType().equals(Material.SHIELD)) {
+ ItemMeta itemMeta = player.getInventory().getItemInOffHand().getItemMeta();
+ org.bukkit.inventory.meta.Damageable damageable = (Damageable) itemMeta;
+
+ if (player.getInventory().getItemInOffHand().getItemMeta().hasEnchant(Enchantment.UNBREAKING) &&
+ player.getInventory().getItemInOffHand().getItemMeta().getEnchantLevel(Enchantment.UNBREAKING) / 20D > ThreadLocalRandom.current().nextDouble())
+ damageable.setDamage(damageable.getDamage() + 5);
+ player.getInventory().getItemInOffHand().setItemMeta(itemMeta);
+ if (Material.SHIELD.getMaxDurability() < damageable.getDamage())
+ player.getInventory().setItemInOffHand(null);
+ }
+
+ if (event.getDamager() instanceof Projectile) {
+ bypass = false;
+ event.getDamager().remove();
+ return;
+ }
+ }
+
+ //Calculate the damage for the event
+ double newDamage = eliteToPlayerDamageFormula(player, eliteEntity, event);
+ //Blocking reduces damage by 80%
+ if (blocking)
+ newDamage = newDamage - newDamage * MobCombatSettingsConfig.getBlockingDamageReduction();
+ //nullify vanilla reductions
+ for (EntityDamageEvent.DamageModifier modifier : EntityDamageByEntityEvent.DamageModifier.values())
+ if (event.isApplicable(modifier) && modifier != EntityDamageEvent.DamageModifier.ABSORPTION)
+ event.setDamage(modifier, 0);
+
+ //Check if we should be doing raw damage, which some powers have
+
+ if (bypass) {
+ //Use raw damage in case of bypass
+ newDamage = event.getOriginalDamage(EntityDamageEvent.DamageModifier.BASE);
+ bypass = false;
+ }
+
+ //Run the event, see if it will get cancelled or suffer further damage modifications
+ PlayerDamagedByEliteMobEvent playerDamagedByEliteMobEvent = new PlayerDamagedByEliteMobEvent(eliteEntity, player, event, projectile, newDamage);
+ new EventCaller(playerDamagedByEliteMobEvent);
+
+ //In case damage got modified along the way
+ newDamage = playerDamagedByEliteMobEvent.getDamage();
+
+ if (playerDamagedByEliteMobEvent.isCancelled()) {
+ bypass = false;
+ return;
+ }
+
+ //Set the final damage value
+ event.setDamage(EntityDamageEvent.DamageModifier.BASE, newDamage);
+
+ //Deal with the player getting killed todo: this is a bit busted, fix
+ if (player.getHealth() - event.getDamage() <= 0)
+ PlayerDeathMessageByEliteMob.addDeadPlayer(player, PlayerDeathMessageByEliteMob.initializeDeathMessage(player, eliteEntity));
+
+ }
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerJoinArenaEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerJoinArenaEvent.java
new file mode 100644
index 000000000..e937cee4d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerJoinArenaEvent.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerJoinArenaEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final ArenaInstance arenaInstance;
+
+ public PlayerJoinArenaEvent(ArenaInstance arenaInstance) {
+ this.arenaInstance = arenaInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerJoinDungeonEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerJoinDungeonEvent.java
new file mode 100644
index 000000000..d2c80ce2d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerJoinDungeonEvent.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerJoinDungeonEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final DungeonInstance dungeonInstance;
+
+ public PlayerJoinDungeonEvent(DungeonInstance dungeonInstance) {
+ this.dungeonInstance = dungeonInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerLeaveArenaEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerLeaveArenaEvent.java
new file mode 100644
index 000000000..66d038cdc
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerLeaveArenaEvent.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerLeaveArenaEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final ArenaInstance arenaInstance;
+
+ public PlayerLeaveArenaEvent(ArenaInstance arenaInstance) {
+ this.arenaInstance = arenaInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerLeaveDungeonEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerLeaveDungeonEvent.java
new file mode 100644
index 000000000..f01bb92f1
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerLeaveDungeonEvent.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.instanced.dungeons.DungeonInstance;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class PlayerLeaveDungeonEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final DungeonInstance dungeonInstance;
+
+ public PlayerLeaveDungeonEvent(DungeonInstance dungeonInstance) {
+ this.dungeonInstance = dungeonInstance;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java
new file mode 100644
index 000000000..1974d0b5b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerPreTeleportEvent.java
@@ -0,0 +1,120 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.config.CombatTagConfig;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+import org.bukkit.scheduler.BukkitRunnable;
+
+public class PlayerPreTeleportEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Location destination;
+ private final Location originalLocation;
+ private final Player player;
+ private boolean isCancelled = false;
+
+ /**
+ * Called when a player initiates a teleport to a location. The teleport will go through 3 seconds after the event is
+ * launched, assuming it isn't cancelled by the player or via code.
+ *
+ * @param player Player that will teleport
+ * @param destination Teleport destination
+ */
+ public PlayerPreTeleportEvent(Player player, Location destination) {
+ this.player = player;
+ this.destination = destination.clone();
+ this.originalLocation = player.getLocation().clone();
+ }
+
+ public static void teleportPlayer(Player player, Location destination) {
+ if (destination.getWorld() == null) return;
+ if (CombatTagConfig.isEnableTeleportTimer())
+ new EventCaller(new PlayerPreTeleportEvent(player, destination));
+ else
+ PlayerTeleportEvent.teleportPlayer(player, destination);
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public void startTeleport() {
+ new BukkitRunnable() {
+ int timerLeft = 3;
+
+ @Override
+ public void run() {
+ if (!player.isValid()) {
+ cancel();
+ return;
+ }
+
+ if (player.getLocation().getX() != originalLocation.getX() ||
+ player.getLocation().getY() != originalLocation.getY() ||
+ player.getLocation().getZ() != originalLocation.getZ())
+ isCancelled = true;
+
+ if (isCancelled) {
+ player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
+ TextComponent.fromLegacyText(ChatColorConverter.convert(CombatTagConfig.getTeleportCancelled())));
+ cancel();
+ return;
+ }
+
+ player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
+ TextComponent.fromLegacyText(ChatColorConverter.convert(CombatTagConfig.getTeleportTimeLeft())
+ .replace("$time", timerLeft + "")));
+
+
+ if (timerLeft == 0) {
+ PlayerTeleportEvent.teleportPlayer(player, destination);
+ cancel();
+ return;
+ }
+
+ timerLeft--;
+ }
+ }.runTaskTimer(MetadataHandler.PLUGIN, 0, 20);
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public Location getDestination() {
+ return destination;
+ }
+
+ public Location getOriginalLocation() {
+ return originalLocation;
+ }
+
+ public static class PlayerPreTeleportEventEvents implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
+ public void onTeleportEvent(PlayerPreTeleportEvent event) {
+ event.startTeleport();
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java
new file mode 100644
index 000000000..05177dd22
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/PlayerTeleportEvent.java
@@ -0,0 +1,80 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+
+public class PlayerTeleportEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final Location destination;
+ private final Location originalLocation;
+ private final Player player;
+ private boolean isCancelled = false;
+
+ /**
+ * Event fired when players teleport due to EliteMobs. This is used for teleporting to the Adventurer's Guild and to
+ * Dungeons.
+ *
+ * @param player Player to be teleported
+ * @param destination Teleport destination
+ */
+ public PlayerTeleportEvent(Player player, Location destination) {
+ this.player = player;
+ this.destination = destination;
+ this.originalLocation = player.getLocation().clone();
+ }
+
+ public static void teleportPlayer(Player player, Location destination) {
+ new EventCaller(new PlayerTeleportEvent(player, destination));
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.isCancelled = b;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public Location getDestination() {
+ return destination;
+ }
+
+ public Location getOriginalLocation() {
+ return originalLocation;
+ }
+
+ public void executeTeleport() {
+ if (!EliteMobsWorld.isEliteMobsWorld(player.getLocation().getWorld().getUID()))
+ PlayerData.setBackTeleportLocation(player, originalLocation);
+
+ player.teleport(destination);
+ }
+
+ public static class PlayerTeleportEventExecutor implements Listener {
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void onPlayerTeleport(PlayerTeleportEvent event) {
+ event.executeTeleport();
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java
new file mode 100644
index 000000000..3e3cce76c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestAcceptEvent.java
@@ -0,0 +1,92 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.quests.CustomQuest;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+
+public class QuestAcceptEvent extends Event implements Cancellable {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Player player;
+ @Getter
+ private final Quest quest;
+ private boolean isCancelled = false;
+
+ public QuestAcceptEvent(Player player, Quest quest) {
+ this.player = player;
+ this.quest = quest;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ isCancelled = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class QuestAcceptEventHandler implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
+ public void questAcceptLimiter(QuestAcceptEvent event) {
+ if (PlayerData.getQuests(event.getPlayer().getUniqueId()).size() < QuestsConfig.getMaximumActiveQuests())
+ return;
+ event.setCancelled(true);
+ event.getPlayer().sendMessage(ChatColorConverter.convert(QuestsConfig.getQuestCapMessage()));
+ }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
+ public void onQuestAccept(QuestAcceptEvent event) {
+ event.getPlayer().sendMessage(QuestsConfig.getQuestJoinMessage().replace("$questName", ChatColorConverter.convert(event.getQuest().getQuestName())));
+ event.getQuest().setAccepted(true);
+ if (QuestsConfig.isUseQuestAcceptTitles())
+ event.getPlayer().sendTitle(
+ ChatColorConverter.convert(QuestsConfig.getQuestStartTitle().replace("$questName", event.getQuest().getQuestName())),
+ ChatColorConverter.convert(QuestsConfig.getQuestStartSubtitle().replace("$questName", event.getQuest().getQuestName())),
+ 20, 60, 20);
+
+ boolean playedCustomSound = false;
+
+ if (event.getQuest() instanceof CustomQuest customQuest) {
+
+ customQuest.applyTemporaryPermissions(event.getPlayer());
+
+ if (customQuest.getCustomQuestsConfigFields().getQuestAcceptDialog() != null &&
+ !customQuest.getCustomQuestsConfigFields().getQuestAcceptDialog().isEmpty())
+ for (String dialog : customQuest.getCustomQuestsConfigFields().getQuestAcceptDialog())
+ event.getPlayer().sendMessage(dialog);
+
+ if (customQuest.getCustomQuestsConfigFields().getQuestAcceptSound() != null) {
+ Bukkit.getPlayer(customQuest.getPlayerUUID()).playSound(
+ Bukkit.getPlayer(customQuest.getPlayerUUID()),
+ customQuest.getCustomQuestsConfigFields().getQuestAcceptSound(),
+ 1f, 1f);
+ playedCustomSound = true;
+ }
+ }
+ if (!QuestsConfig.isAutoTrackQuestsOnAccept())
+ event.getQuest().getQuestObjectives().displayTemporaryObjectivesScoreboard(event.getPlayer());
+ PlayerData.addQuest(event.getPlayer().getUniqueId(), event.getQuest());
+ if (!playedCustomSound)
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questAcceptSound, 1, 1);
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java
new file mode 100644
index 000000000..1422c3de3
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestCompleteEvent.java
@@ -0,0 +1,58 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.SoundsConfig;
+import com.magmaguy.elitemobs.quests.CustomQuest;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+
+public class QuestCompleteEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Player player;
+ @Getter
+ private final Quest quest;
+ private boolean cancelled;
+
+ public QuestCompleteEvent(Player player, Quest quest) {
+ this.player = player;
+ this.quest = quest;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ public static class QuestCompleteEventHandler implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
+ public void onQuestComplete(QuestCompleteEvent event) {
+ new EventCaller(new QuestRewardEvent(event.getPlayer(), event.quest));
+ if (event.getQuest() instanceof CustomQuest customQuest &&
+ customQuest.getCustomQuestsConfigFields().getQuestCompleteSound() != null)
+ Bukkit.getPlayer(customQuest.getPlayerUUID()).playSound(
+ Bukkit.getPlayer(customQuest.getPlayerUUID()),
+ customQuest.getCustomQuestsConfigFields().getQuestCompleteSound(),
+ 1f, 1f);
+ else
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questCompleteSound, 1, 1);
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java
new file mode 100644
index 000000000..57f8bf775
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestLeaveEvent.java
@@ -0,0 +1,63 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.quests.CustomQuest;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.elitemobs.quests.QuestTracking;
+import lombok.Getter;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+import org.bukkit.permissions.PermissionAttachment;
+
+public class QuestLeaveEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Player player;
+ @Getter
+ private final Quest quest;
+
+ public QuestLeaveEvent(Player player, Quest quest) {
+ this.player = player;
+ this.quest = quest;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class QuestLeaveEventHandler implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
+ public void onQuestLeave(QuestLeaveEvent event) {
+ PlayerData.removeQuest(event.getPlayer().getUniqueId(), event.getQuest());
+ event.getPlayer().sendMessage(QuestsConfig.getQuestLeaveMessage().replace("$questName", event.getQuest().getQuestName()));
+ if (QuestsConfig.isUseQuestLeaveTitles())
+ event.getPlayer().sendTitle(
+ QuestsConfig.getQuestLeaveTitle().replace("$questName", event.getQuest().getQuestName()),
+ QuestsConfig.getQuestLeaveSubtitle().replace("$questName", event.getQuest().getQuestName()),
+ 20, 60, 20);
+ if (event.getQuest() instanceof CustomQuest customQuest) {
+ if (!customQuest.getCustomQuestsConfigFields().getTemporaryPermissions().isEmpty()) {
+ PermissionAttachment permissionAttachment = event.getPlayer().addAttachment(MetadataHandler.PLUGIN);
+ for (String permission : customQuest.getCustomQuestsConfigFields().getTemporaryPermissions())
+ permissionAttachment.setPermission(permission, false);
+ }
+
+ if (QuestTracking.getPlayerTrackingQuests().containsKey(event.getPlayer())) {
+ QuestTracking questTracking = QuestTracking.getPlayerTrackingQuests().get(event.getPlayer());
+ if (questTracking.getCustomQuest().getCustomQuestsConfigFields().equals(customQuest.getCustomQuestsConfigFields()))
+ questTracking.stop();
+ }
+ }
+
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questAbandonSound, 1, 1);
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestObjectivesCompletedEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestObjectivesCompletedEvent.java
new file mode 100644
index 000000000..97e37bafb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestObjectivesCompletedEvent.java
@@ -0,0 +1,40 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import lombok.Getter;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+
+public class QuestObjectivesCompletedEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Player player;
+ @Getter
+ private final Quest quest;
+
+ public QuestObjectivesCompletedEvent(Player player, Quest customQuest) {
+ this.player = player;
+ this.quest = customQuest;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class QuestObjectivesCompletedEventHandler implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
+ public void onObjectivesCompleted(QuestObjectivesCompletedEvent event) {
+ if (!QuestsConfig.isRequireQuestTurnIn()) {
+ QuestCompleteEvent questCompleteEvent = new QuestCompleteEvent(event.getPlayer(), event.getQuest());
+ new EventCaller(questCompleteEvent);
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java
new file mode 100644
index 000000000..4b617ee6d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestProgressionEvent.java
@@ -0,0 +1,49 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.config.SoundsConfig;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.elitemobs.quests.QuestTracking;
+import com.magmaguy.elitemobs.quests.objectives.Objective;
+import lombok.Getter;
+import org.bukkit.entity.Player;
+import org.bukkit.event.*;
+
+public class QuestProgressionEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Player player;
+ @Getter
+ private final Quest quest;
+ @Getter
+ private final Objective objective;
+
+ public QuestProgressionEvent(Player player, Quest quest, Objective objective) {
+ this.player = player;
+ this.quest = quest;
+ this.objective = objective;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static class QuestProgressionEventHandler implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
+ public void onQuestProgression(QuestProgressionEvent event) {
+ event.getQuest().getQuestObjectives().updateQuestStatus(event.getPlayer().getUniqueId());
+ if (QuestsConfig.isDoQuestChatProgression())
+ event.getPlayer().sendMessage(QuestsConfig.getQuestChatProgressionMessage(event.getObjective()));
+ if (!QuestTracking.isTracking(event.player))
+ event.getQuest().getQuestObjectives().displayTemporaryObjectivesScoreboard(event.getPlayer());
+ PlayerData.updateQuestStatus(event.getPlayer().getUniqueId(), event.getQuest());
+ event.getPlayer().playSound(event.getPlayer().getLocation(), SoundsConfig.questProgressionSound, 1, 1);
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java b/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java
new file mode 100644
index 000000000..c7a929cbb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/QuestRewardEvent.java
@@ -0,0 +1,59 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.QuestsConfig;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import lombok.Getter;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class QuestRewardEvent extends Event {
+
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final Player player;
+ @Getter
+ private final Quest quest;
+
+ public QuestRewardEvent(Player player, Quest quest) {
+ this.player = player;
+ this.quest = quest;
+
+ quest.getQuestObjectives().setTurnedIn(true);
+
+ doMessages();
+ doRewards();
+
+ completeQuestData();
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private void doMessages() {
+ player.sendMessage(QuestsConfig.getQuestCompleteMessage().replace("$questName", quest.getQuestName()));
+ if (QuestsConfig.isUseQuestCompleteTitles())
+ player.sendTitle(
+ ChatColorConverter.convert(QuestsConfig.getQuestCompleteTitle().replace("$questName", quest.getQuestName())),
+ ChatColorConverter.convert(QuestsConfig.getQuestCompleteSubtitle().replace("$questName", quest.getQuestName())),
+ 20, 60, 20);
+ }
+
+ private void doRewards() {
+ quest.getQuestObjectives().getQuestReward().doRewards();
+ }
+
+ private void completeQuestData() {
+ PlayerData.removeQuest(player.getUniqueId(), quest);
+ PlayerData.incrementQuestsCompleted(player.getUniqueId());
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java
new file mode 100644
index 000000000..2c9d55bb7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneEnterEvent.java
@@ -0,0 +1,29 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import lombok.Getter;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ScriptZoneEnterEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private final LivingEntity entity;
+
+ public ScriptZoneEnterEvent(EliteEntity customBossEntity, LivingEntity entity) {
+ this.eliteEntity = customBossEntity;
+ this.entity = entity;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java
new file mode 100644
index 000000000..6e2505042
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/ScriptZoneLeaveEvent.java
@@ -0,0 +1,29 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import lombok.Getter;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ScriptZoneLeaveEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final EliteEntity eliteEntity;
+ @Getter
+ private final LivingEntity entity;
+
+ public ScriptZoneLeaveEvent(EliteEntity customBossEntity, LivingEntity entity) {
+ this.eliteEntity = customBossEntity;
+ this.entity = entity;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/WorldInstanceEvent.java b/src/main/java/com/magmaguy/elitemobs/api/WorldInstanceEvent.java
new file mode 100644
index 000000000..dde7da10a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/WorldInstanceEvent.java
@@ -0,0 +1,48 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields;
+import lombok.Getter;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class WorldInstanceEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ @Getter
+ private final DungeonPackagerConfigFields dungeonPackagerConfigFields;
+ @Getter
+ private final String blueprintWorldName;
+ @Getter
+ private final String instancedWorldName;
+ private boolean cancelled = false;
+
+
+ public WorldInstanceEvent(String blueprintWorldName,
+ String instancedWorldName,
+ DungeonPackagerConfigFields dungeonPackagerConfigFields) {
+ this.blueprintWorldName = blueprintWorldName;
+ this.instancedWorldName = instancedWorldName;
+ this.dungeonPackagerConfigFields = dungeonPackagerConfigFields;
+ }
+
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/WorldUninstanceEvent.java b/src/main/java/com/magmaguy/elitemobs/api/WorldUninstanceEvent.java
new file mode 100644
index 000000000..87bffadce
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/WorldUninstanceEvent.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.api;
+
+import com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields;
+import lombok.Getter;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class WorldUninstanceEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+
+ @Getter
+ private final DungeonPackagerConfigFields dungeonPackagerConfigFields;
+
+ public WorldUninstanceEvent(DungeonPackagerConfigFields dungeonPackagerConfigFields) {
+ this.dungeonPackagerConfigFields = dungeonPackagerConfigFields;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchDestroyEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchDestroyEvent.java
new file mode 100644
index 000000000..2abe71334
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchDestroyEvent.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class MatchDestroyEvent extends Event implements MatchEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final MatchInstance matchInstance;
+
+ public MatchDestroyEvent(MatchInstance matchInstance) {
+ this.matchInstance = matchInstance;
+ }
+
+ @Override
+ public MatchInstance getInstance() {
+ return matchInstance;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchEndEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchEndEvent.java
new file mode 100644
index 000000000..18a668e99
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchEndEvent.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class MatchEndEvent extends Event implements MatchEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final MatchInstance matchInstance;
+
+ public MatchEndEvent(MatchInstance matchInstance) {
+ this.matchInstance = matchInstance;
+ }
+
+ @Override
+ public MatchInstance getInstance() {
+ return matchInstance;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchEvent.java
new file mode 100644
index 000000000..a96f1947d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchEvent.java
@@ -0,0 +1,7 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+
+public interface MatchEvent {
+ MatchInstance getInstance();
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java
new file mode 100644
index 000000000..e60e5268b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchInstantiateEvent.java
@@ -0,0 +1,38 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class MatchInstantiateEvent extends Event implements MatchEvent, Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final MatchInstance matchInstance;
+ private boolean cancelled = false;
+
+ public MatchInstantiateEvent(MatchInstance matchInstance) {
+ this.matchInstance = matchInstance;
+ }
+
+ @Override
+ public MatchInstance getInstance() {
+ return matchInstance;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.cancelled = b;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java
new file mode 100644
index 000000000..1378d400f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchJoinEvent.java
@@ -0,0 +1,46 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class MatchJoinEvent extends Event implements MatchEvent, MatchPlayerEvent, Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final MatchInstance matchInstance;
+ private final Player player;
+ private boolean cancelled = false;
+
+ public MatchJoinEvent(MatchInstance matchInstance, Player player) {
+ this.matchInstance = matchInstance;
+ this.player = player;
+ }
+
+ @Override
+ public MatchInstance getInstance() {
+ return matchInstance;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean b) {
+ this.cancelled = b;
+ }
+
+ @Override
+ public Player getPlayer() {
+ return player;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchLeaveEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchLeaveEvent.java
new file mode 100644
index 000000000..d1c140ee4
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchLeaveEvent.java
@@ -0,0 +1,34 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class MatchLeaveEvent extends Event implements MatchEvent, MatchPlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final MatchInstance matchInstance;
+ private final Player player;
+
+ public MatchLeaveEvent(MatchInstance matchInstance, Player player) {
+ this.matchInstance = matchInstance;
+ this.player = player;
+ }
+
+ @Override
+ public MatchInstance getInstance() {
+ return matchInstance;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @Override
+ public Player getPlayer() {
+ return player;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchPlayerEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchPlayerEvent.java
new file mode 100644
index 000000000..8eae674ee
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchPlayerEvent.java
@@ -0,0 +1,7 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import org.bukkit.entity.Player;
+
+public interface MatchPlayerEvent {
+ Player getPlayer();
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchStartEvent.java b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchStartEvent.java
new file mode 100644
index 000000000..b359e61dc
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/instanced/MatchStartEvent.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.api.instanced;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class MatchStartEvent extends Event implements MatchEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final MatchInstance matchInstance;
+
+ public MatchStartEvent(MatchInstance matchInstance) {
+ this.matchInstance = matchInstance;
+ }
+
+ @Override
+ public MatchInstance getInstance() {
+ return matchInstance;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/internal/RemovalReason.java b/src/main/java/com/magmaguy/elitemobs/api/internal/RemovalReason.java
new file mode 100644
index 000000000..6caa686ed
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/internal/RemovalReason.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.api.internal;
+
+/**
+ * DEATH is used for when Elites die in a way detected correctly by EliteMobs
+ * CHUNK_UNLOAD fires when an Elite is removed due to a chunk unload. This is a true removal, so persistent Elites won't have it.
+ * WORLD_UNLOAD fires when an Elite is removed due to a World unload. Persistent Elites can't survive this.
+ * SHUTDOWN fires when a server shuts down, reload or when EliteMobs reloads
+ * OTHER fires when the reason couldn't be determined, probably a #remove() API call by another plugin
+ * EFFECT_TIMEOUT fires when either a power has ended or when an effect is done being displayed for any reason
+ */
+public enum RemovalReason {
+ DEATH,
+ PHASE_BOSS_RESET,
+ PHASE_BOSS_PHASE_END,
+ CHUNK_UNLOAD,
+ WORLD_UNLOAD,
+ SHUTDOWN,
+ EFFECT_TIMEOUT,
+ BOSS_TIMEOUT,
+ NPC_TIMEOUT,
+ OTHER,
+ UNSPECIFIED_WATCHDOG_REMOVAL,
+ REMOVE_COMMAND,
+ KILL_COMMAND,
+ REINFORCEMENT_CULL,
+ ENTITY_REPLACEMENT,
+ ARENA_RESET
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java
new file mode 100644
index 000000000..a6457ac7b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/api/utils/EliteItemManager.java
@@ -0,0 +1,347 @@
+package com.magmaguy.elitemobs.api.utils;
+
+import com.magmaguy.elitemobs.combatsystem.CombatSystem;
+import com.magmaguy.elitemobs.config.ItemSettingsConfig;
+import com.magmaguy.elitemobs.items.EliteItemLore;
+import com.magmaguy.elitemobs.items.ItemTagger;
+import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment;
+import org.bukkit.Material;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.attribute.AttributeModifier;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+import org.jetbrains.annotations.NotNull;
+
+import javax.annotation.Nullable;
+
+public class EliteItemManager {
+ //This is a utility class for easy and fast interfacing with EliteMobs items! Use it as a shortcut to reading source.
+
+ /**
+ * Calculates the Elite DPS of an item aka EDPS. This is the damage per second dealt to Elites, which may or may not
+ * reflect the DPS dealt to other entities.
+ *
+ * @param itemStack ItemStack to analyze. Should be an {@ItemStack} with a GENERIC_ATTACK_SPEED and GENERIC_ATTACK_DAMAGE {@Attribute} but will handle any {@ItemStack}
+ * @return The EDPS of the ItemStack. Defaults to 4 as that is the unarmed DPS!
+ */
+ public static double getDPS(@Nullable ItemStack itemStack) {
+ return getDPS(getAttackSpeed(itemStack), getBaseDamage(itemStack)) + getDPS(getAttackSpeed(itemStack), getEliteMobsSpecificDamage(itemStack));
+ }
+
+ /**
+ * Calculates the DPS of any item
+ *
+ * @param attackSpeed Attack speed from item attribute
+ * @param damage Damage from attribute
+ * @return DPS value
+ */
+ public static double getDPS(Double attackSpeed, Double damage) {
+ if (attackSpeed == null || damage == null) return 4;
+ //Mojang sees attack speed as the number of attacks per 20 ticks (1 second).
+ double attackSpeedPerSecond = 1 / attackSpeed;
+ return damage / attackSpeedPerSecond;
+ }
+
+ /**
+ * Gets either the "real" damage of an {@ItemStack} based on the material attributes and further attribute modifications.
+ *
+ * @param itemStack {@ItemStack} to check the damage on.
+ * @return Damage attribute or calculated stored damage. Defaults to 1.
+ */
+ public static double getBaseDamage(ItemStack itemStack) {
+ //Default as per Minecraft defaults. This is the same as being unarmed.
+ double defaultDamage = 1.0;
+ if (itemStack == null) return defaultDamage;
+ //Ranged damage works differently. 6.0 damage is the best case scenario for the average arrow so that is the value used.
+ if (itemStack.getType() == Material.BOW) return 6.0;
+ if (itemStack.getType() == Material.CROSSBOW) return 7.0;
+ //Check the default modifiers - these are usually the only modifiers
+ try {
+ for (AttributeModifier attributeModifier : itemStack.getType().getDefaultAttributeModifiers(EquipmentSlot.HAND).get(Attribute.GENERIC_ATTACK_DAMAGE))
+ defaultDamage = attributeCrawler(defaultDamage, attributeModifier);
+ } catch (NoSuchMethodError e) {
+ //If you're on an ancient version the damage will not work that well for the default materials.
+ return 1.0;
+ }
+ //Check custom modifiers - this should only happen when third party plugins step in
+ if (itemStack.getItemMeta() != null &&
+ itemStack.getItemMeta().getAttributeModifiers() != null &&
+ itemStack.getItemMeta().getAttributeModifiers(EquipmentSlot.HAND).containsKey(Attribute.GENERIC_ATTACK_DAMAGE))
+ for (AttributeModifier attributeModifier : itemStack
+ .getItemMeta()
+ .getAttributeModifiers()
+ .get(Attribute.GENERIC_ATTACK_SPEED))
+ defaultDamage = attributeCrawler(defaultDamage, attributeModifier);
+ return defaultDamage;
+ }
+
+ /**
+ * Gets the GENERIC_ATTACK_SPEED {@Attribute} from any item - for players assuming a default {@Player} attack speed!
+ *
+ * @param itemStack ItemStack to analyze
+ * @return Attack speed value
+ */
+ public static double getAttackSpeed(@Nullable ItemStack itemStack) {
+ //Default as per Minecraft defaults. This is 1/default for the dps
+ double defaultAttackSpeed = 4.0;
+ if (itemStack == null) return defaultAttackSpeed;
+ //Ranged damage works differently. Bows take 1s to draw and crossbows take 1.25s to draw.
+ if (itemStack.getType() == Material.BOW) return 1.0;
+ else if (itemStack.getType() == Material.CROSSBOW) return 0.8;
+ //Check the default modifiers - these are usually the only modifiers
+ try {
+ for (AttributeModifier attributeModifier : itemStack.getType().getDefaultAttributeModifiers(EquipmentSlot.HAND).get(Attribute.GENERIC_ATTACK_SPEED))
+ defaultAttackSpeed = attributeCrawler(defaultAttackSpeed, attributeModifier);
+ } catch (NoSuchMethodError e) {
+ //If you're on an ancient version you just get the default sword speed.
+ defaultAttackSpeed = 4.0;
+ }
+ //Check custom modifiers - this should only happen when third party plugins step in
+ if (itemStack.getItemMeta() != null &&
+ itemStack.getItemMeta().getAttributeModifiers() != null &&
+ itemStack.getItemMeta().getAttributeModifiers(EquipmentSlot.HAND).containsKey(Attribute.GENERIC_ATTACK_SPEED))
+ for (AttributeModifier attributeModifier : itemStack
+ .getItemMeta()
+ .getAttributeModifiers()
+ .get(Attribute.GENERIC_ATTACK_SPEED))
+ defaultAttackSpeed = attributeCrawler(defaultAttackSpeed, attributeModifier);
+ return defaultAttackSpeed;
+ }
+
+ /**
+ * This goes through the attribute modifiers and applies them to a base value
+ *
+ * @param baseValue Default value. For damage, it's 1. For attack speed, it's 4, as set by Minecraft.
+ * @param attributeModifier Modifier to check against.
+ * @return Value after being appropriately modified.
+ */
+ private static double attributeCrawler(double baseValue, AttributeModifier attributeModifier) {
+ switch (attributeModifier.getOperation()) {
+ case ADD_NUMBER:
+ baseValue += attributeModifier.getAmount();
+ break;
+ case MULTIPLY_SCALAR_1:
+ case ADD_SCALAR:
+ //Yes, these two do the same thing. No, they shouldn't. This is a spigot thing.
+ baseValue += baseValue * attributeModifier.getAmount();
+ break;
+ }
+ return baseValue;
+ }
+
+ /**
+ * Calculates the item level of a weapon.
+ *
+ * @param itemStack ItemStack to analyze.
+ * @return Item level. Can't be lower than 0.
+ */
+ public static double getWeaponLevel(@Nullable ItemStack itemStack) {
+ //The weapon level takes the base stats of the item and the elite damage attribute into account. Elite sharpness
+ //is a part of the rarity, so it does not figure into the level math
+ return Math.max(Math.round(
+ (getDPS(getAttackSpeed(itemStack), getBaseDamage(itemStack)) +
+ getDPS(getAttackSpeed(itemStack), ItemTagger.getEliteDamageAttribute(itemStack)))
+ / CombatSystem.DPS_PER_LEVEL
+ ), 0);
+ }
+
+ public static double getEliteDamageFromEliteAttributes(@Nullable ItemStack itemStack) {
+ return ItemTagger.getEliteDamageAttribute(itemStack);
+ }
+
+ /**
+ * Calculates the damage specific to EliteMobs. More specifically, scans for the elite enchantment level of sharpness
+ * or power and adds the elite damage stored on the item. Note that this only adds elite enchantments, not vanilla ones.
+ * Those get handled through vanilla means!
+ *
+ * @return The bonus damage
+ */
+ public static double getEliteDamageFromEnchantments(@Nullable ItemStack itemStack) {
+ if (itemStack == null) return 0;
+ //Elite Items may have elite enchantments associated to an item
+ int enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.SHARPNESS.getKey());
+ if (enchantmentLevel > 0 && ItemSettingsConfig.isUseEliteEnchantments()) {
+ enchantmentLevel -= Enchantment.SHARPNESS.getMaxLevel();
+ if (enchantmentLevel < 0) enchantmentLevel = 0;
+ } else {
+ enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.POWER.getKey());
+ if (enchantmentLevel > 0 && ItemSettingsConfig.isUseEliteEnchantments())
+ enchantmentLevel -= Enchantment.POWER.getMaxLevel();
+ if (enchantmentLevel < 0) enchantmentLevel = 0;
+ }
+
+ if (enchantmentLevel < 1)
+ //Note: this means sharpness works on bows and that power works on weapons. By default, this state is not reachable, so it doesn't really matter.
+ enchantmentLevel += itemStack.getEnchantmentLevel(Enchantment.POWER) + itemStack.getEnchantmentLevel(Enchantment.SHARPNESS);
+ if (enchantmentLevel == 0) return 0;
+ //This is how vanilla sharpness works. Might as well use it for everything.
+ return 1 + enchantmentLevel * 0.5;
+ }
+
+ public static double getEliteMobsSpecificDamage(ItemStack itemStack) {
+ return getEliteDamageFromEliteAttributes(itemStack) + getEliteDamageFromEnchantments(itemStack);
+ }
+
+ /**
+ * Calculates the total DPS. This adds base damage to elite damage.
+ *
+ * @param itemStack ItemStack to scan
+ * @return EDPS value
+ */
+ public static double getTotalDPS(@Nullable ItemStack itemStack) {
+ if (itemStack == null) return 0;
+ double bonusDamage = getEliteMobsSpecificDamage(itemStack);
+ if (bonusDamage == 0) return 0;
+ return getDPS(getAttackSpeed(itemStack), bonusDamage);
+ }
+
+ /**
+ * Calculates the elite protection value. This value is completely divorced from vanilla Minecraft as the vanilla method does not scale well for MMORPG-like progression.
+ *
+ * @param itemStack ItemStack to analyze
+ * @return Elite protection value
+ */
+ public static double getEliteDefense(@Nullable ItemStack itemStack) {
+ if (itemStack == null || itemStack.getItemMeta() == null) return 0D;
+ //Since there are 4 pieces of armor, this gets divided by 4
+ double materialValue = CombatSystem.getMaterialTier(itemStack.getType()) / 4D;
+ double defenseAttribute = ItemTagger.getEliteDefenseAttribute(itemStack);
+ return materialValue + defenseAttribute;
+ }
+
+ public static double getArmorLevel(@Nullable ItemStack itemStack) {
+ if (itemStack == null || itemStack.getItemMeta() == null) return 0D;
+ //Each piece of armor lowers damage by .25, and .25 damage represents 1 level, so the level is the protection * 4
+ return getEliteDefense(itemStack) * 4D;
+ }
+
+ public static double getBonusEliteDefense(@Nullable ItemStack itemStack) {
+ if (itemStack == null || itemStack.getItemMeta() == null) return 0D;
+ int enchantmentLevel = 0;
+ enchantmentLevel = ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.PROTECTION.getKey());
+ return enchantmentLevel * .25;
+ }
+
+ /**
+ * Calculates the item level of any given {@ItemStack}
+ *
+ * @param itemStack ItemStack to analyze
+ * @return Item level
+ */
+ public static double getItemLevel(@Nullable ItemStack itemStack) {
+ double value = getWeaponLevel(itemStack);
+ if (value > 3.0) return value;
+ return getArmorLevel(itemStack);
+ }
+
+ public static int getRoundedItemLevel(@Nullable ItemStack itemStack) {
+ return (int) Math.round(getItemLevel(itemStack));
+ }
+
+ public static boolean isWeapon(@Nullable ItemStack itemStack) {
+ if (itemStack == null) return false;
+ //Wooden axe stats are so bad they can't even get detected properly
+ if (itemStack.getType().equals(Material.WOODEN_AXE) || itemStack.getType().equals(Material.CROSSBOW))
+ return true;
+ if (ItemSettingsConfig.isUseHoesAsWeapons() &&
+ (itemStack.getType().equals(Material.WOODEN_HOE) ||
+ itemStack.getType().equals(Material.GOLDEN_HOE) ||
+ itemStack.getType().equals(Material.STONE_HOE) ||
+ itemStack.getType().equals(Material.IRON_HOE) ||
+ itemStack.getType().equals(Material.DIAMOND_HOE) ||
+ itemStack.getType().equals(Material.NETHERITE_HOE)))
+ return true;
+ return getWeaponLevel(itemStack) > 3.0;
+ }
+
+ public static boolean isArmor(@Nullable ItemStack itemStack) {
+ return getArmorLevel(itemStack) > 0;
+ }
+
+ public static void setEliteLevel(@Nullable ItemStack itemStack, int level) {
+ if (itemStack == null) return;
+ registerEliteItem(itemStack);
+ if (isWeapon(itemStack)) {
+ double damage = calculateEliteBonus(itemStack, level);
+ if (damage > 0)
+ ItemTagger.setEliteDamageAttribute(itemStack, damage);
+ } else if (isArmor(itemStack)) {
+ double defense = calculateEliteBonus(itemStack, level);
+ if (defense > 0)
+ ItemTagger.setEliteDefenseAttribute(itemStack, defense);
+ }
+ new EliteItemLore(itemStack, false);
+ }
+
+ /**
+ * This returns how much elite damage an item would give, based on a level. This should be used when a level wants to
+ * be calculated instead of read, which should only be true when you're doing something tricky like temporarily limiting
+ * the level of items for instanced dungeons
+ *
+ * @param itemStack ItemStack to check the level of
+ * @param level Level to calculate
+ * @return Amount of damage an elite weapon of that level would deal
+ */
+ public static double calculateEliteBonus(ItemStack itemStack, int level) {
+ if (isWeapon(itemStack)) {
+ return level * CombatSystem.DPS_PER_LEVEL / 1 / getAttackSpeed(itemStack) - getBaseDamage(itemStack);
+ } else if (isArmor(itemStack)) {
+ return (level - CombatSystem.getMaterialTier(itemStack.getType())) / 4D;
+ }
+ return 0;
+ }
+
+ public static void tagArrow(@Nullable Projectile projectile) {
+ if (projectile == null) return;
+ if (!(projectile.getShooter() instanceof Player)) return;
+ ItemTagger.setEliteDamageAttribute(projectile, getEliteMobsSpecificDamage(((Player) projectile.getShooter()).getInventory().getItemInMainHand()));
+ }
+
+ public static double getArrowEliteDamage(@Nullable Projectile projectile) {
+ return ItemTagger.getEliteDamageAttribute(projectile);
+ }
+
+ /**
+ * Checks if an item is an EliteMobs item
+ *
+ * @param itemStack Item to analyze
+ * @return If the item is an elite item
+ */
+ public static boolean isEliteMobsItem(ItemStack itemStack) {
+ return ItemTagger.isEliteItem(itemStack);
+ }
+
+ public static void registerEliteItem(@Nullable ItemStack itemStack) {
+ if (itemStack == null || itemStack.getItemMeta() == null) return;
+ ItemMeta itemMeta = itemStack.getItemMeta();
+ ItemTagger.registerEliteItem(itemMeta);
+ itemStack.setItemMeta(itemMeta);
+ }
+
+ /**
+ * Returns whether an item meta has the soulbind enchantment
+ *
+ * @param itemMeta Item meta to be evaluated
+ * @return Whether the item has the soulbind meta
+ */
+ @Nullable
+ public static boolean hasSoulbindEnchantment(@NotNull ItemMeta itemMeta) {
+ return SoulbindEnchantment.itemHasSoulbindEnchantment(itemMeta);
+ }
+
+ /**
+ * Gets the {@link Player} to whom the item meta is linked.
+ *
+ * @param itemMeta Item meta to be evaluated.
+ * @return Player to whom the meta is linked. Returns null if no player is linked, or if the player linked is not online.
+ */
+ @Nullable
+ public static Player getSoulboundPlayer(@NotNull ItemMeta itemMeta) {
+ return SoulbindEnchantment.getSoulboundPlayer(itemMeta);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java
new file mode 100644
index 000000000..f805347df
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AlternativeDurabilityLoss.java
@@ -0,0 +1,88 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.api.utils.EliteItemManager;
+import com.magmaguy.elitemobs.config.ItemSettingsConfig;
+import com.magmaguy.elitemobs.items.ItemTagger;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityShootBowEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.event.player.PlayerItemDamageEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.Damageable;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class AlternativeDurabilityLoss implements Listener {
+
+ //these values are percentual
+ private static double durabilityLoss(ItemStack itemStack) {
+ boolean isWeaponMaterial = EliteItemManager.isWeapon(itemStack);
+ int maxDurability = itemStack.getType().getMaxDurability() > (isWeaponMaterial ? 2000 : 1000) ? (isWeaponMaterial ? 2000 : 1000) : itemStack.getType().getMaxDurability();
+ double baseModifier = isWeaponMaterial ? 2000 : 1000;
+ double durabilityLoss = ((baseModifier - maxDurability) / baseModifier) * ItemSettingsConfig.getEliteDurabilityMultiplier();
+ double durabilityLevel = 1 + (ItemTagger.getEnchantment(itemStack.getItemMeta(), Enchantment.UNBREAKING.getKey()) / 4d);
+ double defaultMultiplier = 0.5; //just tweaking defaults
+ return durabilityLoss / durabilityLevel * defaultMultiplier;
+ }
+
+ private static boolean isOnLastDamage(ItemStack itemStack) {
+ if (itemStack == null) return false;
+ if (!itemStack.hasItemMeta()) return false;
+ if (!ItemTagger.isEliteItem(itemStack)) return false;
+ if (!(itemStack.getItemMeta() instanceof Damageable)) return false;
+ if (itemStack.getType().getMaxDurability() == 0) return false;
+ return ((Damageable) itemStack.getItemMeta()).getDamage() + 1 >= itemStack.getType().getMaxDurability();
+ }
+
+ public static void doDurabilityLoss(Player player) {
+ if (!ItemSettingsConfig.isEliteDurability()) return;
+ List itemsList = new ArrayList<>(Arrays.stream(player.getInventory().getArmorContents()).toList());
+ itemsList.add(player.getInventory().getItemInMainHand());
+ itemsList.add(player.getInventory().getItemInOffHand());
+
+ for (ItemStack itemStack : itemsList)
+ if (itemStack != null &&
+ itemStack.getType().getMaxDurability() != 0 &&
+ EliteItemManager.isEliteMobsItem(itemStack) &&
+ itemStack.getItemMeta() instanceof Damageable damageable) {
+ int maxDurability = itemStack.getType().getMaxDurability();
+ int durabilityLoss = (int) (maxDurability * durabilityLoss(itemStack));
+ int currentDurability = damageable.getDamage();
+ int newDurability = currentDurability + durabilityLoss;
+ damageable.setDamage(newDurability);
+ itemStack.setItemMeta(damageable);
+ if (newDurability >= maxDurability)
+ if (ItemSettingsConfig.isPreventEliteItemsFromBreaking()) {
+ damageable.setDamage(maxDurability - 1);
+ itemStack.setItemMeta(damageable);
+ } else {
+ itemStack.setAmount(0);
+ }
+ }
+ }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
+ public void onDurabilityLoss(PlayerItemDamageEvent event) {
+ if (!EliteItemManager.isEliteMobsItem(event.getItem())) return;
+ if (!EliteItemManager.isArmor(event.getItem()) && !EliteItemManager.isWeapon(event.getItem())) return;
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onPlayerDeath(PlayerDeathEvent event) {
+ doDurabilityLoss(event.getEntity());
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onPlayerShoot(EntityShootBowEvent event) {
+ if (!EliteItemManager.isEliteMobsItem(event.getBow())) return;
+ if (isOnLastDamage(event.getBow())) event.setCancelled(true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AntiExploitMessage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AntiExploitMessage.java
deleted file mode 100644
index d77ec0b2d..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/AntiExploitMessage.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-
-
-public class AntiExploitMessage {
-
- public static void sendWarning(LivingEntity livingEntity) {
-
- for (Entity entity : livingEntity.getNearbyEntities(15, 15, 15))
- if (entity instanceof Player) {
- Player player = (Player) entity;
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
- TextComponent.fromLegacyText(ChatColorConverter.convert(ConfigValues.mobCombatSettingsConfig.getString(MobCombatSettingsConfig.ANTI_EXPLOIT_MESSAGE))));
- }
-
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ChunkUnloadMetadataPurge.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ChunkUnloadMetadataPurge.java
deleted file mode 100644
index df545a6a9..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ChunkUnloadMetadataPurge.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.EntityTracker;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.world.ChunkUnloadEvent;
-
-
-/**
- * Created by MagmaGuy on 20/12/2016.
- */
-public class ChunkUnloadMetadataPurge implements Listener {
-
- @EventHandler
- public void onUnload(ChunkUnloadEvent event) {
- EntityTracker.chunkWiper(event);
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/CombustionPrevention.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/CombustionPrevention.java
new file mode 100644
index 000000000..5491259a5
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/CombustionPrevention.java
@@ -0,0 +1,16 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.potion.PotionEffectType;
+
+public class CombustionPrevention implements Listener {
+ @EventHandler
+ public void onCombust(EntityCombustEvent event) {
+ if (event.getEntity() instanceof LivingEntity &&
+ ((LivingEntity) event.getEntity()).hasPotionEffect(PotionEffectType.FIRE_RESISTANCE))
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteBlazeWaterDamagePrevention.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteBlazeWaterDamagePrevention.java
new file mode 100644
index 000000000..4cd3e9b86
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteBlazeWaterDamagePrevention.java
@@ -0,0 +1,18 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedEvent;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class EliteBlazeWaterDamagePrevention implements Listener {
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onBlazeWaterDamage(EliteMobDamagedEvent event) {
+ if (event.getEntity() == null) return;
+ if (!event.getEntity().getType().equals(EntityType.BLAZE)) return;
+ if (!event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.DROWNING)) return;
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java
new file mode 100644
index 000000000..5655c3116
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EliteSlimeDeathSplit.java
@@ -0,0 +1,14 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.SlimeSplitEvent;
+
+public class EliteSlimeDeathSplit implements Listener {
+ @EventHandler (ignoreCancelled = true, priority = EventPriority.HIGHEST)
+ public void SlimeSplitEvent(SlimeSplitEvent event){
+ if (EntityTracker.isEliteMob(event.getEntity())) event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java
new file mode 100644
index 000000000..cd1b6ca52
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderCrystalDamageProtectionBypass.java
@@ -0,0 +1,19 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.utils.EntityFinder;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+
+public class EnderCrystalDamageProtectionBypass implements Listener {
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
+ if (!event.getEntity().getType().equals(EntityType.END_CRYSTAL)) return;
+ LivingEntity entity = EntityFinder.filterRangedDamagers(event.getDamager());
+ if (entity == null || !entity.getType().equals(EntityType.PLAYER)) return;
+ event.setCancelled(false);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderDragonUnstuck.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderDragonUnstuck.java
new file mode 100644
index 000000000..666bff7e9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnderDragonUnstuck.java
@@ -0,0 +1,47 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.api.EliteMobEnterCombatEvent;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import org.bukkit.entity.EnderDragon;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Wolf;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
+
+public class EnderDragonUnstuck implements Listener {
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
+ public void onDragonEnterCombat(EliteMobEnterCombatEvent event) {
+ if (event.getEliteMobEntity() == null) return;
+ if (event.getEliteMobEntity().getLivingEntity() == null) return;
+ if (!event.getEliteMobEntity().getLivingEntity().getType().equals(EntityType.ENDER_DRAGON)) return;
+ event.getEliteMobEntity().getLivingEntity().setAI(true);
+ ((EnderDragon) event.getEliteMobEntity().getLivingEntity()).setPhase(EnderDragon.Phase.LEAVE_PORTAL);
+ }
+
+ public static class AggroPrevention implements Listener {
+
+ @EventHandler(ignoreCancelled = true)
+ public void onTarget(EntityTargetLivingEntityEvent event) {
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+ //No modification for passive entities
+ if (eliteEntity instanceof CustomBossEntity customBossEntity && customBossEntity.getCustomBossesConfigFields().isNeutral())
+ return;
+ EliteEntity eliteEntity1 = EntityTracker.getEliteMobEntity(event.getTarget());
+ if (eliteEntity1 != null && eliteEntity1 instanceof CustomBossEntity customBossEntity && customBossEntity.getCustomBossesConfigFields().isNeutral())
+ return;
+ if (event.getEntity().getType().equals(EntityType.WOLF) && !((Wolf) event.getEntity()).isAngry() ||
+ event.getTarget() != null &&
+ event.getTarget().getType().equals(EntityType.WOLF) && !((Wolf) event.getTarget()).isAngry())
+ return;
+ if (EntityTracker.isEliteMob(event.getEntity()) && event.getTarget() != null && EntityTracker.isEliteMob(event.getTarget()) ||
+ EntityTracker.isEliteMob(event.getEntity()) && event.getTarget() != null && EntityTracker.isNPCEntity(event.getTarget()))
+ event.setCancelled(true);
+ }
+
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EntityDeathDataFlusher.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EntityDeathDataFlusher.java
deleted file mode 100644
index b402c859d..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EntityDeathDataFlusher.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.EntityTracker;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDeathEvent;
-
-/**
- * Created by MagmaGuy on 14/07/2017.
- */
-public class EntityDeathDataFlusher implements Listener {
-
- @EventHandler(priority = EventPriority.MONITOR)
- public void onEntityDeathFlushData(EntityDeathEvent event) {
-
- EntityTracker.deathWipe(event);
-
- }
-
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EntityTransformHandler.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EntityTransformHandler.java
new file mode 100644
index 000000000..85cafeef0
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EntityTransformHandler.java
@@ -0,0 +1,18 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityTransformEvent;
+
+public class EntityTransformHandler implements Listener {
+
+ @EventHandler
+ public void onMobTransform(EntityTransformEvent event) {
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+ event.setCancelled(true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java
new file mode 100644
index 000000000..347370d56
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/EnvironmentalDungeonDamage.java
@@ -0,0 +1,20 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.config.DungeonsConfig;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class EnvironmentalDungeonDamage implements Listener {
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onDamage(EntityDamageEvent event) {
+ if (!EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return;
+ switch (event.getCause()) {
+ case POISON -> event.setDamage(event.getDamage() * DungeonsConfig.getPoisonDamageMultiplier());
+ case WITHER -> event.setDamage(event.getDamage() * DungeonsConfig.getWitherDamageMultiplier());
+ case FIRE_TICK -> event.setDamage(event.getDamage() * DungeonsConfig.getFireDamageMultiplier());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindNewWorlds.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindNewWorlds.java
new file mode 100644
index 000000000..236a57873
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindNewWorlds.java
@@ -0,0 +1,16 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.config.ValidWorldsConfig;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.world.WorldLoadEvent;
+
+public class FindNewWorlds implements Listener {
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
+ public void onWorldLoad(WorldLoadEvent event) {
+ ValidWorldsConfig.addWorld(event.getWorld().getName());
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java
deleted file mode 100644
index 95ea00ed0..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FindSuperMobs.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
-import org.bukkit.entity.Entity;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.world.ChunkLoadEvent;
-
-public class FindSuperMobs implements Listener {
-
- @EventHandler
- public void findSuperMob(ChunkLoadEvent event) {
-
- for (Entity entity : event.getChunk().getEntities())
- if (SuperMobProperties.isValidSuperMobType(entity)) {
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java
new file mode 100644
index 000000000..7293e3822
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/FixPlayerOnLoginOrRespawn.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+
+public class FixPlayerOnLoginOrRespawn implements Listener {
+ @EventHandler
+ public void onPlayerRespawn(PlayerRespawnEvent event) {
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0));
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0));
+ if (DefaultConfig.isResetPlayerScaleOnLogin())
+ event.getPlayer().getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f);
+ }
+
+ @EventHandler
+ public void onPlayerJoin(PlayerJoinEvent event) {
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 0, 0));
+ event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 0, 0));
+ if (DefaultConfig.isResetPlayerScaleOnLogin())
+ event.getPlayer().getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1f);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemDisenchantPrevention.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemDisenchantPrevention.java
new file mode 100644
index 000000000..dc659474a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemDisenchantPrevention.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.api.utils.EliteItemManager;
+import com.magmaguy.elitemobs.config.ItemSettingsConfig;
+import org.bukkit.event.Event;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.inventory.InventoryType;
+
+public class ItemDisenchantPrevention implements Listener {
+ @EventHandler
+ public void onDisenchant(InventoryClickEvent event) {
+ if (!event.getSlotType().equals(InventoryType.SlotType.RESULT)) return;
+ if (!event.getInventory().getType().equals(InventoryType.GRINDSTONE)) return;
+ if (!EliteItemManager.isEliteMobsItem(event.getInventory().getItem(0)) &&
+ !EliteItemManager.isEliteMobsItem(event.getInventory().getItem(1))) return;
+ event.setResult(Event.Result.DENY);
+ event.setCancelled(true);
+ event.getWhoClicked().sendMessage(ItemSettingsConfig.getPreventEliteItemDisenchantmentMessage());
+ event.getWhoClicked().closeInventory();
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java
new file mode 100644
index 000000000..36e73ea9b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/ItemEnchantmentPrevention.java
@@ -0,0 +1,32 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.items.ItemTagger;
+import com.magmaguy.magmacore.util.ItemStackGenerator;
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.enchantment.PrepareItemEnchantEvent;
+import org.bukkit.event.inventory.PrepareAnvilEvent;
+
+public class ItemEnchantmentPrevention implements Listener {
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onResultGeneration(PrepareAnvilEvent event) {
+ if (!ItemTagger.isEliteItem(event.getInventory().getItem(0)) &&
+ !ItemTagger.isEliteItem(event.getInventory().getItem(1)))
+ return;
+ event.setResult(ItemStackGenerator.generateItemStack(Material.AIR));
+ event.getInventory().setRepairCost(300);
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onResultGeneration(PrepareItemEnchantEvent event) {
+ if (!ItemTagger.isEliteItem(event.getInventory().getItem(0)) &&
+ !ItemTagger.isEliteItem(event.getInventory().getItem(1)))
+ return;
+ event.setCancelled(true);
+ //todo: test this, also why was this feature not on?
+ //event.setResult(ItemStackGenerator.generateItemStack(Material.AIR));
+ //event.getInventory().setRepairCost(300);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/KeepNeutralsAngry.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/KeepNeutralsAngry.java
new file mode 100644
index 000000000..2beb66562
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/KeepNeutralsAngry.java
@@ -0,0 +1,60 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Mob;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Wolf;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.HashSet;
+import java.util.Objects;
+
+public class KeepNeutralsAngry {
+ private static final HashSet angryMobs = new HashSet<>();
+
+ private KeepNeutralsAngry() {
+ }
+
+ public static void showMeYouWarFace(EliteEntity eliteEntity) {
+ //might already contain
+ EntityType entityType = eliteEntity.getLivingEntity().getType();
+ if (angryMobs.contains(eliteEntity)) return;
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ if (eliteEntity instanceof CustomBossEntity customBossEntity && customBossEntity.getCustomBossesConfigFields().isNeutral())
+ return;
+ //It is possible for entities to change type during combat, in which case they need to be wiped
+ if (!eliteEntity.isValid() ||
+ !entityType.equals(eliteEntity.getLivingEntity().getType()) ||
+ entityType.equals(EntityType.WOLF) && ((Wolf) eliteEntity.getLivingEntity()).isTamed()) {
+ cancel();
+ angryMobs.remove(eliteEntity);
+ return;
+ }
+
+ if (!eliteEntity.getLivingEntity().getType().equals(EntityType.LLAMA) && !eliteEntity.getLivingEntity().getType().equals(EntityType.RABBIT) &&
+ ((Mob) eliteEntity.getLivingEntity()).getTarget() != null)
+ return;
+
+ for (Player player : Bukkit.getOnlinePlayers())
+ if (!player.getGameMode().equals(GameMode.SPECTATOR) && !player.getGameMode().equals(GameMode.CREATIVE) &&
+ Objects.equals(player.getLocation().getWorld(), eliteEntity.getLocation().getWorld()) &&
+ player.getLocation().distanceSquared(eliteEntity.getLocation()) <
+ Math.pow(Objects.requireNonNull(eliteEntity.getLivingEntity().getAttribute(Attribute.GENERIC_FOLLOW_RANGE)).getValue(), 2)) {
+ ((Mob) eliteEntity.getLivingEntity()).setTarget(player);
+ return;
+ }
+
+ ((Mob) eliteEntity.getLivingEntity()).setTarget(null);
+
+ }
+ }.runTaskTimer(MetadataHandler.PLUGIN, 0, 20);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java
new file mode 100644
index 000000000..a3566e5c7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningImmunity.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.config.powers.PowersConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+
+public class LightningImmunity implements Listener {
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void onLightningStrike(EntityDamageByEntityEvent event) {
+ if (!event.getDamager().getType().equals(EntityType.LIGHTNING_BOLT)) return;
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+ if (eliteEntity.hasPower(PowersConfig.getPower("attack_lightning.yml")) ||
+ eliteEntity.hasPower(PowersConfig.getPower("lightning_bolts.yml")))
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java
new file mode 100644
index 000000000..e102cee26
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/LightningSpawnBypass.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import org.bukkit.Location;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntitySpawnEvent;
+
+public class LightningSpawnBypass implements Listener {
+ private static boolean bypass = false;
+
+ public static void strikeLightingIgnoreProtections(Location location) {
+ if (location == null || location.getWorld() == null) return;
+ bypass = true;
+ location.getWorld().strikeLightningEffect(location);
+ }
+
+ public static void bypass() {
+ bypass = true;
+ }
+
+ //This overrides region protection plugins that would delete lightning - breaking powers and effects
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onLightningSpawn(EntitySpawnEvent event) {
+ if (!bypass) return;
+ if (!event.getEntity().getType().equals(EntityType.LIGHTNING_BOLT)) return;
+ bypass = true;
+ event.setCancelled(false);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/NPCsBecomeWitches.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/NPCsBecomeWitches.java
new file mode 100644
index 000000000..964209f17
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/NPCsBecomeWitches.java
@@ -0,0 +1,15 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityTransformEvent;
+
+public class NPCsBecomeWitches implements Listener {
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onNPCConversion(EntityTransformEvent event) {
+ if (!EntityTracker.isNPCEntity(event.getEntity())) return;
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java
index 5acac3794..b3e8ea913 100644
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerDeathMessageByEliteMob.java
@@ -1,24 +1,11 @@
-/*
- * 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 com.magmaguy.elitemobs.collateralminecraftchanges;
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.EntityTracker;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.config.mobproperties.MobPropertiesConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.playerdata.PlayerStatsTracker;
+import com.magmaguy.magmacore.util.ChatColorConverter;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -26,10 +13,11 @@
import org.bukkit.event.entity.PlayerDeathEvent;
import java.util.HashMap;
+import java.util.concurrent.ThreadLocalRandom;
public class PlayerDeathMessageByEliteMob implements Listener {
- private static HashMap deadPlayerList = new HashMap<>();
+ private static final HashMap deadPlayerList = new HashMap<>();
public static void addDeadPlayer(Player player, String deathMessage) {
deadPlayerList.put(player, deathMessage);
@@ -43,85 +31,26 @@ private static void removeDeadPlayer(Player player) {
deadPlayerList.remove(player);
}
- @EventHandler
- public void onPlayerDeath(PlayerDeathEvent event) {
+ public static String initializeDeathMessage(Player player, EliteEntity eliteEntity) {
- if (isDeadPlayer(event.getEntity())) {
- event.setDeathMessage(deadPlayerList.get(event.getEntity()));
- removeDeadPlayer(event.getEntity());
- }
+ String deathMessage = "";
- }
+ if (eliteEntity instanceof CustomBossEntity customBossEntity && customBossEntity.getCustomBossesConfigFields().getOnKillMessage() != null && !customBossEntity.getCustomBossesConfigFields().getOnKillMessage().isEmpty())
+ return deathMessageSender(customBossEntity.getCustomBossesConfigFields().getOnKillMessage().replace("$player", player.getDisplayName()), player, customBossEntity.getLivingEntity());
- public static String intializeDeathMessage(Player player, LivingEntity livingEntity) {
-
- String deathMessage;
-
- /*
- Deal with players dying from Elite Mobs
- */
-
- switch (livingEntity.getType()) {
-
- case BLAZE:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.BLAZE_DEATH_MESSAGE, player, livingEntity);
- break;
- case CREEPER:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.CREEPER_DEATH_MESSAGE, player, livingEntity);
- break;
- case ENDERMAN:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.ENDERMAN_DEATH_MESSAGE, player, livingEntity);
- break;
- case ENDERMITE:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.ENDERMITE_DEATH_MESSAGE, player, livingEntity);
- break;
- case IRON_GOLEM:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.IRONGOLEM_DEATH_MESSAGE, player, livingEntity);
- break;
- case POLAR_BEAR:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.POLARBEAR_DEATH_MESSAGE, player, livingEntity);
- break;
- case SILVERFISH:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.SILVERFISH_DEATH_MESSAGE, player, livingEntity);
- break;
- case SKELETON:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.SKELETON_DEATH_MESSAGE, player, livingEntity);
- break;
- case SPIDER:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.SPIDER_DEATH_MESSAGE, player, livingEntity);
- break;
- case WITCH:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.WITCH_DEATH_MESSAGE, player, livingEntity);
- break;
- case ZOMBIE:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.ZOMBIE_DEATH_MESSAGE, player, livingEntity);
- break;
- case HUSK:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.HUSK_DEATH_MESSAGE, player, livingEntity);
- break;
- case PIG_ZOMBIE:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.ZOMBIE_PIGMAN_DEATH_MESSAGE, player, livingEntity);
- break;
- case STRAY:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.STRAY_DEATH_MESSAGE, player, livingEntity);
- break;
- case WITHER_SKELETON:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.WITHER_SKELETON_DEATH_MESSAGE, player, livingEntity);
- break;
- default:
- deathMessage = deathMessageSender(MobCombatSettingsConfig.DEFAULT_DEATH_MESSAGE, player, livingEntity);
- break;
- }
+ if (MobPropertiesConfig.getMobProperties().containsKey(eliteEntity.getLivingEntity().getType()))
+ deathMessage = deathMessageSender
+ (MobPropertiesConfig.getMobProperties().get(eliteEntity.getLivingEntity().getType()).getDeathMessages()
+ .get(ThreadLocalRandom.current().nextInt(MobPropertiesConfig.getMobProperties().get(eliteEntity.getLivingEntity().getType()).getDeathMessages().size()))
+ , player, eliteEntity.getLivingEntity());
return deathMessage;
}
- private static String deathMessageSender(String configNode, Player player, LivingEntity livingEntity) {
+ private static String deathMessageSender(String deathMessage, Player player, LivingEntity livingEntity) {
- String deathMessage = ConfigValues.mobCombatSettingsConfig.getString(configNode);
deathMessage = deathMessagePlaceholderConversion(deathMessage, player, livingEntity);
-
return deathMessage;
}
@@ -132,10 +61,21 @@ private static String deathMessagePlaceholderConversion(String deathMessage, Pla
deathMessage = deathMessage.replace("$player", player.getDisplayName());
deathMessage = deathMessage.replace("$entity", livingEntityName);
- deathMessage = ChatColorConverter.convert(deathMessage);
+ deathMessage = ChatColorConverter.convert("&7" + deathMessage);
return deathMessage;
}
+ @EventHandler
+ public void onPlayerDeath(PlayerDeathEvent event) {
+
+ if (isDeadPlayer(event.getEntity())) {
+ event.setDeathMessage(deadPlayerList.get(event.getEntity()));
+ PlayerStatsTracker.registerPlayerDeath(event.getEntity());
+ removeDeadPlayer(event.getEntity());
+ }
+
+ }
+
}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java
new file mode 100644
index 000000000..3a88714f5
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PlayerQuitCleanup.java
@@ -0,0 +1,14 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.powers.scripts.ScriptAction;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class PlayerQuitCleanup implements Listener {
+ @EventHandler
+ public void onPlayerQuit(PlayerQuitEvent event) {
+ if (ScriptAction.getInvulnerablePlayers().contains(event.getPlayer()))
+ event.getPlayer().setInvulnerable(false);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java
deleted file mode 100644
index 1141263bf..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventCreeperPassiveEntityDamage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
-import org.bukkit.entity.*;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageEvent;
-
-/**
- * Created by MagmaGuy on 22/04/2017.
- */
-public class PreventCreeperPassiveEntityDamage implements Listener {
-
- //This cancels all creeper and entity-caused explosion damage on passive mobs
- @EventHandler
- public void superCreeperCollateralDamageAvoider(EntityDamageEvent event) {
-
- if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) {
-
- if (SuperMobProperties.isValidSuperMobType(event.getEntityType()) ||
- event.getEntity() instanceof Horse || event.getEntity() instanceof Villager ||
- event.getEntity() instanceof Bat || event.getEntity() instanceof ArmorStand ||
- event.getEntity() instanceof Rabbit) {
-
- event.setDamage(0);
-
- }
-
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventDarkroomExploit.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventDarkroomExploit.java
deleted file mode 100644
index 650b6182f..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventDarkroomExploit.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.EntityTracker;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.util.Vector;
-
-public class PreventDarkroomExploit implements Listener {
-
- @EventHandler
- public void onDamage(EntityDamageEvent event) {
-
- if (!EntityTracker.isNaturalEntity(event.getEntity())) return;
-
- int livingEntityCount = 1;
- for (Entity entity : event.getEntity().getNearbyEntities(1, 1, 1))
- if (entity instanceof LivingEntity)
- livingEntityCount++;
-
-
- if (livingEntityCount < 2) return;
-
- Location entityLocation = event.getEntity().getLocation().getBlock().getLocation().add(0.5, 0, 0.5);
-
- Block block1 = entityLocation.clone().add(new Vector(0, 0, 1)).getBlock();
- Block block2 = entityLocation.clone().add(new Vector(0, 0, -1)).getBlock();
- Block block3 = entityLocation.clone().add(new Vector(0, 1, 1)).getBlock();
- Block block4 = entityLocation.clone().add(new Vector(0, 1, -1)).getBlock();
- Block block5 = entityLocation.clone().add(new Vector(1, 0, 0)).getBlock();
- Block block6 = entityLocation.clone().add(new Vector(-1, 0, 0)).getBlock();
- Block block7 = entityLocation.clone().add(new Vector(1, 1, 0)).getBlock();
- Block block8 = entityLocation.clone().add(new Vector(-1, 1, 0)).getBlock();
-
- if (!block3.getType().equals(Material.AIR) && !block4.getType().equals(Material.AIR) &&
- !block7.getType().equals(Material.AIR) && !block8.getType().equals(Material.AIR)) {
- EntityTracker.unregisterNaturalEntity((LivingEntity) event.getEntity());
- Bukkit.getLogger().warning("Running");
- AntiExploitMessage.sendWarning((LivingEntity) event.getEntity());
- return;
- }
-
- int airCount = 0;
-
- if (block1.getType().equals(Material.AIR))
- airCount++;
- if (block2.getType().equals(Material.AIR))
- airCount++;
- if (block3.getType().equals(Material.AIR))
- airCount++;
- if (block4.getType().equals(Material.AIR))
- airCount++;
- if (block5.getType().equals(Material.AIR))
- airCount++;
- if (block6.getType().equals(Material.AIR))
- airCount++;
- if (block7.getType().equals(Material.AIR))
- airCount++;
- if (block8.getType().equals(Material.AIR))
- airCount++;
-
- if (airCount >= 4) return;
-
- EntityTracker.unregisterNaturalEntity((LivingEntity) event.getEntity());
- AntiExploitMessage.sendWarning((LivingEntity) event.getEntity());
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteBeeHiveEnter.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteBeeHiveEnter.java
new file mode 100644
index 000000000..1f257b4f5
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteBeeHiveEnter.java
@@ -0,0 +1,14 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityEnterBlockEvent;
+
+public class PreventEliteBeeHiveEnter implements Listener {
+ @EventHandler
+ public void onBeeEnterHive(EntityEnterBlockEvent event) {
+ if (EntityTracker.isEliteMob(event.getEntity()))
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteEquipmentDrop.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteEquipmentDrop.java
new file mode 100644
index 000000000..51f15d398
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteEquipmentDrop.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.api.EliteMobDeathEvent;
+import org.bukkit.Material;
+import org.bukkit.entity.Mob;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.inventory.ItemStack;
+
+public class PreventEliteEquipmentDrop implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onEliteDeath(EliteMobDeathEvent event) {
+ if (event.getEntityDeathEvent() == null) return;
+ if (!(event.getEntity() instanceof Mob)) return;
+ if (((Mob) event.getEntity()).getEquipment() == null) return;
+ for (ItemStack drop : event.getEntityDeathEvent().getDrops())
+ for (ItemStack equipment : ((Mob) event.getEntity()).getEquipment().getArmorContents())
+ if (drop != null && drop.equals(equipment))
+ drop.setType(Material.AIR);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteSilverfishBlockEnter.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteSilverfishBlockEnter.java
new file mode 100644
index 000000000..ef8b4f30c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventEliteSilverfishBlockEnter.java
@@ -0,0 +1,14 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
+
+public class PreventEliteSilverfishBlockEnter implements Listener {
+ @EventHandler
+ public void onSilverfishBlockEnter(EntityChangeBlockEvent event) {
+ if (EntityTracker.isEliteMob(event.getEntity()))
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventItemPickupByMobs.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventItemPickupByMobs.java
new file mode 100644
index 000000000..0b22b12c9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventItemPickupByMobs.java
@@ -0,0 +1,16 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityPickupItemEvent;
+
+public class PreventItemPickupByMobs implements Listener {
+
+ @EventHandler
+ public void onItemPickup(EntityPickupItemEvent event) {
+ if (EntityTracker.isEliteMob(event.getEntity()))
+ event.setCancelled(true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventMountExploit.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventMountExploit.java
deleted file mode 100644
index d5c2a5d11..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventMountExploit.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.EntityTracker;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.spigotmc.event.entity.EntityMountEvent;
-
-public class PreventMountExploit implements Listener {
-
- @EventHandler
- public void mountEvent(EntityMountEvent event) {
-
- if (EntityTracker.isEliteMob(event.getEntity())) event.setCancelled(true);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventTowerExploit.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventTowerExploit.java
deleted file mode 100644
index 2fa68dd35..000000000
--- a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventTowerExploit.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.magmaguy.elitemobs.collateralminecraftchanges;
-
-import com.magmaguy.elitemobs.EntityTracker;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Projectile;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.util.Vector;
-
-public class PreventTowerExploit implements Listener {
-
- @EventHandler
- public void onHit(EntityDamageByEntityEvent event) {
-
- if (!(event instanceof LivingEntity)) return;
- LivingEntity livingEntity = (LivingEntity) event.getEntity();
- if (!EntityTracker.isNaturalEntity(livingEntity)) return;
- if (!(event.getDamager() instanceof Projectile &&
- ((Projectile) event.getDamager()).getShooter() instanceof Player ||
- event.getDamager() instanceof Player))
- return;
-
- Location mobLocation = event.getEntity().getLocation().add(new Vector(0.5, 0, 0.5));
- Location playerLocation;
- if (event.getDamager() instanceof Player)
- playerLocation = event.getDamager().getLocation();
- else
- playerLocation = ((Player) ((Projectile) event.getDamager()).getShooter()).getLocation().getBlock().getLocation().add(new Vector(0.5, 0, 0.5));
-
- if (playerLocation.getY() - mobLocation.getY() < 2) return;
-
- Block block1 = playerLocation.clone().add(new Vector(0, -1, 1)).getBlock();
- Block block2 = playerLocation.clone().add(new Vector(0, -1, -1)).getBlock();
- Block block3 = playerLocation.clone().add(new Vector(0, -2, 1)).getBlock();
- Block block4 = playerLocation.clone().add(new Vector(0, -2, -1)).getBlock();
- Block block5 = playerLocation.clone().add(new Vector(1, -1, 0)).getBlock();
- Block block6 = playerLocation.clone().add(new Vector(-1, -1, 0)).getBlock();
- Block block7 = playerLocation.clone().add(new Vector(1, -2, 0)).getBlock();
- Block block8 = playerLocation.clone().add(new Vector(-1, -2, 0)).getBlock();
-
- if (!(block1.getType().equals(Material.AIR) && block2.getType().equals(Material.AIR) &&
- block3.getType().equals(Material.AIR) && block4.getType().equals(Material.AIR) &&
- block5.getType().equals(Material.AIR) && block6.getType().equals(Material.AIR) &&
- block7.getType().equals(Material.AIR) && block8.getType().equals(Material.AIR)))
- return;
-
- EntityTracker.unregisterNaturalEntity(livingEntity);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java
new file mode 100644
index 000000000..3de63fa7d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/PreventUpgradeDiamondToNetherite.java
@@ -0,0 +1,20 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.items.ItemTagger;
+import com.magmaguy.magmacore.util.ItemStackGenerator;
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.PrepareSmithingEvent;
+
+public class PreventUpgradeDiamondToNetherite implements Listener {
+ @EventHandler
+ public void UpgradeItemEvent(PrepareSmithingEvent event) {
+ if (!ItemTagger.isEliteItem(event.getInventory().getItem(0)) &&
+ !ItemTagger.isEliteItem(event.getInventory().getItem(1)))
+ return;
+ if (event.getInventory().getItem(0) != null &&
+ event.getInventory().getItem(0).getType().equals(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE))
+ event.setResult(ItemStackGenerator.generateItemStack(Material.AIR));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/VanillaReinforcementsCanceller.java b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/VanillaReinforcementsCanceller.java
new file mode 100644
index 000000000..94d0125ac
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/collateralminecraftchanges/VanillaReinforcementsCanceller.java
@@ -0,0 +1,18 @@
+package com.magmaguy.elitemobs.collateralminecraftchanges;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+
+public class VanillaReinforcementsCanceller implements Listener {
+ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
+ public void onSpawn(CreatureSpawnEvent event) {
+ if (!event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.REINFORCEMENTS)) return;
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+ event.setCancelled(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java
new file mode 100644
index 000000000..16fe8fbe2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/CombatSystem.java
@@ -0,0 +1,66 @@
+package com.magmaguy.elitemobs.combatsystem;
+
+import org.bukkit.Material;
+
+public class CombatSystem {
+ public static final double PER_LEVEL_POWER_INCREASE = 0.5;
+ /**
+ * This determines how many hits it takes to kill a boss.
+ * Unfortunately, since it's flat, at a scale, all bosses tend to end up having the same amount of life.
+ * It accomplishes this by adding this flat amount of health to bosses.
+ *
+ * Minus one because bosses start with 7 hp in the normalized combat system. They always have some baseline hp.
+ */
+ public static final double TARGET_HITS_TO_KILL_MINUS_ONE = 3D; //affects max health assignment on EliteMobEntity.java
+ //this sets the tier of various materials
+ public static final int NETHERITE_TIER_LEVEL = 8;
+ public static final int DIAMOND_TIER_LEVEL = 7;
+ public static final int IRON_TIER_LEVEL = 6;
+ public static final int STONE_CHAIN_TIER_LEVEL = 5;
+ public static final int GOLD_WOOD_LEATHER_TIER_LEVEL = 3;
+
+ //DPS increase per tier
+ public static final double DPS_PER_LEVEL = 1.6;
+
+
+ private CombatSystem() {
+ }
+
+ public static int getMaterialTier(Material material) {
+ switch (material) {
+ case DIAMOND_BOOTS:
+ case DIAMOND_CHESTPLATE:
+ case DIAMOND_HELMET:
+ case DIAMOND_LEGGINGS:
+ return DIAMOND_TIER_LEVEL;
+ case IRON_BOOTS:
+ case IRON_CHESTPLATE:
+ case IRON_HELMET:
+ case IRON_LEGGINGS:
+ return IRON_TIER_LEVEL;
+ case CHAINMAIL_BOOTS:
+ case CHAINMAIL_CHESTPLATE:
+ case CHAINMAIL_HELMET:
+ case CHAINMAIL_LEGGINGS:
+ return STONE_CHAIN_TIER_LEVEL;
+ case GOLDEN_BOOTS:
+ case GOLDEN_CHESTPLATE:
+ case GOLDEN_HELMET:
+ case GOLDEN_LEGGINGS:
+ case LEATHER_BOOTS:
+ case LEATHER_CHESTPLATE:
+ case LEATHER_HELMET:
+ case LEATHER_LEGGINGS:
+ case TURTLE_HELMET:
+ return GOLD_WOOD_LEATHER_TIER_LEVEL;
+ default:
+ if (material.equals(Material.NETHERITE_HELMET) ||
+ material.equals(Material.NETHERITE_CHESTPLATE) ||
+ material.equals(Material.NETHERITE_LEGGINGS) ||
+ material.equals(Material.NETHERITE_BOOTS))
+ return CombatSystem.NETHERITE_TIER_LEVEL;
+ }
+ return 0;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java
new file mode 100644
index 000000000..11bc31e52
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobDamagedByEliteMobHandler.java
@@ -0,0 +1,29 @@
+package com.magmaguy.elitemobs.combatsystem;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedByEliteMobEvent;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class EliteMobDamagedByEliteMobHandler implements Listener {
+
+ @EventHandler(ignoreCancelled = true)
+ public void onIronGolemDamage(EliteMobDamagedByEliteMobEvent event) {
+
+ if (event.getDamager().getLivingEntity() == null || event.getDamagee().getLivingEntity() == null) return;
+
+ if (!(event.getDamager().getLivingEntity().getType().equals(EntityType.IRON_GOLEM) ||
+ event.getDamagee().getLivingEntity().getType().equals(EntityType.IRON_GOLEM))) return;
+
+ double damage = event.getEntityDamageByEntityEvent().getDamage() * event.getDamager().getLevel() * CombatSystem.PER_LEVEL_POWER_INCREASE;
+
+ for (EntityDamageEvent.DamageModifier modifier : EntityDamageEvent.DamageModifier.values())
+ if (event.getEntityDamageByEntityEvent().isApplicable(modifier))
+ event.getEntityDamageByEntityEvent().setDamage(modifier, 0);
+
+ event.getEntityDamageByEntityEvent().setDamage(damage);
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobGenericDamagedHandler.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobGenericDamagedHandler.java
new file mode 100644
index 000000000..4ea1be964
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteMobGenericDamagedHandler.java
@@ -0,0 +1,19 @@
+package com.magmaguy.elitemobs.combatsystem;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedEvent;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class EliteMobGenericDamagedHandler implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void eliteMobDamagedGeneric(EliteMobDamagedEvent event) {
+ if (event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.ENTITY_ATTACK)) return;
+ if (!event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.CUSTOM))
+ event.getEntityDamageEvent().setDamage(EntityDamageEvent.DamageModifier.BASE, event.getEntityDamageEvent().getDamage());
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java
new file mode 100644
index 000000000..8401ac810
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/EliteProjectile.java
@@ -0,0 +1,63 @@
+package com.magmaguy.elitemobs.combatsystem;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.Location;
+import org.bukkit.NamespacedKey;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
+import org.bukkit.persistence.PersistentDataType;
+import org.bukkit.projectiles.ProjectileSource;
+import org.bukkit.util.Vector;
+
+public class EliteProjectile {
+ private EliteProjectile() {
+ }
+
+ public static Projectile create(EntityType entityType, Entity shooter, Entity victim, Vector shotVector, boolean gravity) {
+ Location projectileLocation = generateLocation(shooter, victim);
+ Projectile projectile = (Projectile) projectileLocation.getWorld().spawnEntity(projectileLocation, entityType);
+ projectile.setShooter((ProjectileSource) shooter);
+ projectile.setVelocity(shotVector);
+ projectile.setGravity(gravity);
+ projectile.setPersistent(false);
+ EntityTracker.registerProjectileEntity(projectile);
+ return projectile;
+ }
+
+ public static Projectile create(EntityType entityType, Entity shooter, Player victim, boolean gravity) {
+ Vector targetterToTargetted = victim.getEyeLocation().clone().subtract(victim.getLocation()).toVector().normalize().multiply(2);
+ return create(entityType, shooter, victim, targetterToTargetted, gravity);
+ }
+
+ public static Projectile create(EntityType entityType, Entity shooter, Vector targetterToTargetted, boolean gravity) {
+ Location projectileLocation = generateLocation(shooter, targetterToTargetted);
+ Projectile projectile = (Projectile) projectileLocation.getWorld().spawnEntity(projectileLocation, entityType);
+ projectile.setShooter((ProjectileSource) shooter);
+ projectile.setVelocity(targetterToTargetted);
+ projectile.setGravity(gravity);
+ projectile.setPersistent(false);
+ EntityTracker.registerProjectileEntity(projectile);
+ return projectile;
+ }
+
+ private static Location generateLocation(Entity shooter, Entity victim) {
+ Vector vector = victim.getLocation().clone().subtract(shooter.getLocation().clone()).toVector().normalize();
+ return shooter.getLocation().clone().add(0, 1, 0).add(vector).setDirection(vector);
+ }
+
+ private static Location generateLocation(Entity shooter, Vector targetterToTargetted) {
+ return shooter.getLocation().clone().add(targetterToTargetted).setDirection(targetterToTargetted).add(new Vector(0, 1, 0));
+ }
+
+ public static void signExplosiveWithPower(Projectile projectile, String powerName) {
+ projectile.getPersistentDataContainer().set(new NamespacedKey(MetadataHandler.PLUGIN, "detonationPower"), PersistentDataType.STRING, powerName);
+ }
+
+ public static String readExplosivePower(Projectile projectile) {
+ return projectile.getPersistentDataContainer().get(new NamespacedKey(MetadataHandler.PLUGIN, "detonationPower"), PersistentDataType.STRING);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java
new file mode 100644
index 000000000..05cd00243
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AmbientDamageExploit.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.api.GenericAntiExploitEvent;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+
+public class AmbientDamageExploit implements Listener {
+
+ @EventHandler(ignoreCancelled = true)
+ public void onDamage(GenericAntiExploitEvent event) {
+ if (!event.getEliteMobEntity().getLivingEntity().hasAI()) return;
+ if (!(event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.HOT_FLOOR) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.CRAMMING) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.DROWNING) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.FALL) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.SUFFOCATION) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.CONTACT) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.LAVA) ||
+ event.getEntityDamageEvent().getCause().equals(EntityDamageEvent.DamageCause.DRYOUT)))
+ return;
+
+ event.getEliteMobEntity().incrementAntiExploit(1, "ambientdamageexploit");
+ event.setTriggered(true);
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AntiExploitMessage.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AntiExploitMessage.java
new file mode 100644
index 000000000..8f0a01908
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/AntiExploitMessage.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.config.AntiExploitConfig;
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+
+public class AntiExploitMessage {
+
+ private AntiExploitMessage() {
+ }
+
+ public static void sendWarning(LivingEntity livingEntity, String code) {
+ for (Entity entity : livingEntity.getNearbyEntities(15, 15, 15))
+ if (entity instanceof Player player) {
+ if (!player.isOp())
+ player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(AntiExploitConfig.getAntiExploitMessage()));
+ else
+ player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(AntiExploitConfig.getAntiExploitMessage() + " OP-only:" + code));
+ }
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/EliteMobDamagedByPlayerAntiExploitListener.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/EliteMobDamagedByPlayerAntiExploitListener.java
new file mode 100644
index 000000000..db8d3365a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/EliteMobDamagedByPlayerAntiExploitListener.java
@@ -0,0 +1,15 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+
+public class EliteMobDamagedByPlayerAntiExploitListener implements Listener {
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void onDamage(EliteMobDamagedByPlayerAntiExploitEvent event) {
+ if (event.isTriggered()) return;
+ event.getEliteMobEntity().decrementAntiExploit(1);
+ event.getEliteMobEntity().setInAntiExploitCooldown();
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java
new file mode 100644
index 000000000..51ee70bd9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/HoneyBlockJumpExploit.java
@@ -0,0 +1,19 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.api.GenericAntiExploitEvent;
+import com.magmaguy.elitemobs.config.AntiExploitConfig;
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+public class HoneyBlockJumpExploit implements Listener {
+
+ @EventHandler
+ public void onDamage(GenericAntiExploitEvent event) {
+ if (!AntiExploitConfig.isHoneyBlockExploit()) return;
+ if (event.ground == null) return;
+ if (!event.ground.equals(Material.HONEY_BLOCK)) return;
+ event.getEliteMobEntity().incrementAntiExploit(5, "honeyexploit");
+ event.setTriggered(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventDarkroomExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventDarkroomExploit.java
new file mode 100644
index 000000000..a96ec515e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventDarkroomExploit.java
@@ -0,0 +1,55 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.api.GenericAntiExploitEvent;
+import com.magmaguy.elitemobs.config.AntiExploitConfig;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+public class PreventDarkroomExploit implements Listener {
+
+ @EventHandler
+ public void onDamage(GenericAntiExploitEvent event) {
+
+ if (event.isCancelled()) return;
+
+ //gets blocks at 1 height completely surrounding the entity
+ if (AntiExploitConfig.isDarkroomAntiExploit1() && !event.block021.isPassable() &&
+ !event.block120.isPassable() &&
+ !event.block122.isPassable() &&
+ !event.block221.isPassable()) {
+ event.getEliteMobEntity().incrementAntiExploit(4, "darkroom coffin ring");
+ return;
+ }
+
+ //gets blocks at 0 height plus if there's a block on top
+ if (AntiExploitConfig.isDarkroomAntiExploit2() &&
+ (!event.block011.isPassable() || !event.block021.isPassable()) &&
+ (!event.block110.isPassable() || !event.block120.isPassable()) &&
+ (!event.block112.isPassable() || !event.block122.isPassable()) &&
+ (!event.block211.isPassable() || !event.block221.isPassable()) &&
+ !event.ceilingMaterial.isPassable()) {
+ event.getEliteMobEntity().incrementAntiExploit(4, "darkroom mine");
+ return;
+ }
+
+ if (AntiExploitConfig.isDarkroomAntiExploit3())
+ darkRoomAntiExploit3(event);
+
+ }
+
+ private void darkRoomAntiExploit3(GenericAntiExploitEvent event) {
+ int wallCount = 0;
+ if (!event.block011.isPassable() && !event.block021.isPassable())
+ wallCount++;
+ if (!event.block110.isPassable() && !event.block120.isPassable())
+ wallCount++;
+ if (!event.block112.isPassable() && !event.block122.isPassable())
+ wallCount++;
+ if (!event.block211.isPassable() && !event.block221.isPassable())
+ wallCount++;
+
+ if (wallCount >= 3)
+ event.getEliteMobEntity().incrementAntiExploit(4, "darkroom walls");
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventEndermanHeightExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventEndermanHeightExploit.java
new file mode 100644
index 000000000..ca0565139
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventEndermanHeightExploit.java
@@ -0,0 +1,32 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent;
+import com.magmaguy.elitemobs.config.AntiExploitConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.EntityType;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.util.Vector;
+
+public class PreventEndermanHeightExploit implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onDamage(EliteMobDamagedByPlayerAntiExploitEvent event) {
+ if (!AntiExploitConfig.isEndermanHeightAntiExploit()) return;
+ if (!event.getEntity().getType().equals(EntityType.ENDERMAN)) return;
+
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) return;
+
+ Block block = event.getEliteMobDamagedByPlayerEvent().getPlayer().getLocation().getBlock().getLocation().add(new Vector(0, 2, 0)).getBlock();
+ if (block.getType().equals(Material.AIR) || block.getType().equals(Material.WATER)) return;
+
+ eliteEntity.incrementAntiExploit(9, "enderman height");
+ event.setTriggered(true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java
new file mode 100644
index 000000000..c6f537c58
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventLargeDarkroomExploit.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent;
+import com.magmaguy.elitemobs.config.AntiExploitConfig;
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.util.Vector;
+
+public class PreventLargeDarkroomExploit implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onEntityDamage(EliteMobDamagedByPlayerAntiExploitEvent event) {
+ if (event.isCancelled()) return;
+ if (event.getEliteMobEntity().getLivingEntity() == null) return;
+ antiHopper(event);
+ }
+
+ private void antiHopper(EliteMobDamagedByPlayerAntiExploitEvent event) {
+ if (!AntiExploitConfig.isLargeDarkroomAntiExploit1()) return;
+ if (event.getEliteMobEntity().getLivingEntity().getLocation().getBlock().getLocation().clone().subtract(new Vector(0, 1, 0)).getBlock().getType().equals(Material.HOPPER)) {
+ event.getEliteMobEntity().incrementAntiExploit(5, "largeRoomAntiExploit1");
+ event.setTriggered(true);
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java
new file mode 100644
index 000000000..741ba3d44
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventMountExploit.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.elitemobs.config.AntiExploitConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityMountEvent;
+
+public class PreventMountExploit implements Listener {
+
+ public static boolean bypass = false;
+
+ @EventHandler
+ public void mountEvent(EntityMountEvent event) {
+ if (bypass) {
+ bypass = false;
+ return;
+ }
+ if (!AntiExploitConfig.isMountAntiExploit()) return;
+ if (EntityTracker.isEliteMob(event.getEntity())) event.setCancelled(true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java
new file mode 100644
index 000000000..a1e9652a4
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/antiexploit/PreventPathfindingExploit.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.combatsystem.antiexploit;
+
+import com.magmaguy.easyminecraftgoals.NMSManager;
+import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerAntiExploitEvent;
+import com.magmaguy.elitemobs.dungeons.EliteMobsWorld;
+import org.bukkit.entity.Mob;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+public class PreventPathfindingExploit implements Listener {
+ @EventHandler
+ public void OnEliteDamagedbyPlayerEvent(EliteMobDamagedByPlayerAntiExploitEvent event) {
+ if (event.isCancelled()) return;
+ if (event.getEliteMobEntity().getLivingEntity() == null) return;
+ if (!NMSManager.isEnabled()) return;
+ //Only mobs pathfind
+ if (!(event.getEliteMobEntity().getLivingEntity() instanceof Mob)) return;
+ if (NMSManager.getAdapter().canReach(event.getEliteMobEntity().getLivingEntity(), event.getEliteMobDamagedByPlayerEvent().getPlayer().getLocation()))
+ return;
+ if (EliteMobsWorld.isEliteMobsWorld(event.getEntity().getWorld().getUID())) return;
+ event.getEliteMobEntity().incrementAntiExploit(5, "no path to player");
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java
new file mode 100644
index 000000000..adedaeaea
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/combattag/CombatTag.java
@@ -0,0 +1,66 @@
+package com.magmaguy.elitemobs.combatsystem.combattag;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.config.CombatTagConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
+import org.bukkit.GameMode;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.scheduler.BukkitRunnable;
+
+public class CombatTag implements Listener {
+
+ private static Player playerFinder(EntityDamageByEntityEvent event) {
+
+ if (event.getDamager() instanceof Player && EntityTracker.isEliteMob(event.getEntity()))
+ return (Player) event.getDamager();
+ if (event.getEntity() instanceof Player && (EntityTracker.isEliteMob(event.getEntity()) ||
+ event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof LivingEntity &&
+ EntityTracker.isEliteMob(((LivingEntity) ((Projectile) event.getDamager()).getShooter()))))
+ return (Player) event.getEntity();
+ if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player &&
+ EntityTracker.isEliteMob(event.getEntity()))
+ return (Player) ((Projectile) event.getDamager()).getShooter();
+
+ return null;
+
+ }
+
+ @EventHandler(ignoreCancelled = true)
+ public void onDamage(EntityDamageByEntityEvent event) {
+
+ Player player = playerFinder(event);
+
+ if (player == null) return;
+
+ if (player.getGameMode().equals(GameMode.CREATIVE)) return;
+
+ //if (player.isInvulnerable()) player.setInvulnerable(false);
+ if (player.isFlying()) {
+ player.setFlying(false);
+ player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
+ TextComponent.fromLegacyText(CombatTagConfig.getCombatTagMessage()));
+ player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20 * 60, 0));
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ if (!player.isOnline() || player.isDead())
+ cancel();
+ if (player.isOnGround()) {
+ cancel();
+ player.removePotionEffect(PotionEffectType.SLOWNESS);
+ }
+ }
+ }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1);
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/HealthDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/HealthDisplay.java
new file mode 100644
index 000000000..ccb8bb35f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/HealthDisplay.java
@@ -0,0 +1,38 @@
+package com.magmaguy.elitemobs.combatsystem.displays;
+
+import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent;
+import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.utils.DialogArmorStand;
+import org.bukkit.ChatColor;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+
+public class HealthDisplay implements Listener {
+
+ /*
+ Color progression: Dark green - Green - Red - Dark red
+ */
+ private static ChatColor setHealthColor(int currentHealth, int maxHealth) {
+ if (maxHealth <= 0) return ChatColor.WHITE;
+ double healthPercentage = currentHealth * 100 / (double) maxHealth;
+ if (healthPercentage > 75)
+ return ChatColor.DARK_GREEN;
+ if (healthPercentage > 50)
+ return ChatColor.GREEN;
+ if (healthPercentage > 25)
+ return ChatColor.RED;
+ if (healthPercentage > 0)
+ return ChatColor.DARK_RED;
+ return ChatColor.DARK_RED;
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void onHit(EliteMobDamagedByPlayerEvent event) {
+ if (!MobCombatSettingsConfig.isDisplayHealthOnHit()) return;
+ int maxHealth = (int) event.getEliteMobEntity().getMaxHealth();
+ int currentHealth = (int) (event.getEliteMobEntity().getHealth() - event.getDamage());
+ DialogArmorStand.createDialogArmorStand(event.getEliteMobEntity().getLivingEntity(), setHealthColor(currentHealth, maxHealth) + "" + currentHealth + "/" + maxHealth);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java
new file mode 100644
index 000000000..2426f38f3
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/combatsystem/displays/PopupDisplay.java
@@ -0,0 +1,159 @@
+package com.magmaguy.elitemobs.combatsystem.displays;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent;
+import com.magmaguy.elitemobs.api.EliteMobHealEvent;
+import com.magmaguy.elitemobs.api.internal.RemovalReason;
+import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.config.enchantments.premade.CriticalStrikesConfig;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.items.customenchantments.CriticalStrikesEnchantment;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.utils.DialogArmorStand;
+import com.magmaguy.elitemobs.utils.VisualDisplay;
+import com.magmaguy.magmacore.util.Round;
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.TextDisplay;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.EulerAngle;
+import org.bukkit.util.Vector;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+public class PopupDisplay implements Listener {
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void onHit(EliteMobDamagedByPlayerEvent event) {
+ if (!MobCombatSettingsConfig.isDisplayDamageOnHit()) return;
+
+ Location mobLocation = event.getEliteMobEntity().getLocation();
+
+ Vector offset = new Vector(ThreadLocalRandom.current().nextDouble(-2, 2), 0, ThreadLocalRandom.current().nextDouble(-2, 2));
+
+ String colorPrefix = "";
+ if (event.getDamageModifier() < 1) {
+ //resist
+ colorPrefix += MobCombatSettingsConfig.getResistTextColor();
+ DialogArmorStand.createDialogArmorStand(event.getEliteMobEntity().getUnsyncedLivingEntity(),
+ MobCombatSettingsConfig.getResistText(), offset.clone().subtract(new Vector(0, 0.2, 0)));
+ mobLocation.getWorld().playSound(mobLocation, Sound.BLOCK_ANVIL_USE, 1f, 1f);
+ if (MobCombatSettingsConfig.isDoResistEffect())
+ resistArmorStandCreator(event.getEliteMobEntity(), event.getPlayer(), Material.SHIELD);
+ } else if (event.getDamageModifier() > 1) {
+ //weak
+ colorPrefix += MobCombatSettingsConfig.getWeakTextColor();
+ DialogArmorStand.createDialogArmorStand(event.getEliteMobEntity().getUnsyncedLivingEntity(),
+ MobCombatSettingsConfig.getWeakText(), offset.clone().subtract(new Vector(0, 0.2, 0)));
+ mobLocation.getWorld().playSound(mobLocation, Sound.ENTITY_ITEM_BREAK, 1f, 1f);
+ if (MobCombatSettingsConfig.isDoWeakEffect())
+ weakArmorStandCreator(event.getEliteMobEntity(), event.getPlayer(), Material.DIAMOND_SWORD);
+ }
+ if (event.isCriticalStrike()) {
+ //crit
+ colorPrefix += CriticalStrikesConfig.getCriticalHitColor();
+ CriticalStrikesEnchantment.criticalStrikePopupMessage(event.getEliteMobEntity().getUnsyncedLivingEntity(), new Vector(0, 0.2, 0));
+ }
+
+ DialogArmorStand.createDialogArmorStand(event.getEliteMobEntity().getUnsyncedLivingEntity(), ChatColor.RED +
+ colorPrefix + ChatColor.BOLD + Round.twoDecimalPlaces(event.getDamage()), offset);
+
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void onHit(EliteMobHealEvent event) {
+ if (!MobCombatSettingsConfig.isDisplayDamageOnHit()) return;
+ if (!event.getEliteEntity().isValid()) return;
+
+ Vector offset = new Vector(ThreadLocalRandom.current().nextDouble(-1, 1), 0, ThreadLocalRandom.current().nextDouble(-1, 1));
+
+ if (event.isFullHeal()) {
+ DialogArmorStand.createDialogArmorStand(event.getEliteEntity().getUnsyncedLivingEntity(),
+ MobCombatSettingsConfig.getFullHealMessage(), offset.clone().subtract(new Vector(0, 0.2, 0)));
+ } else {
+ DialogArmorStand.createDialogArmorStand(event.getEliteEntity().getUnsyncedLivingEntity(),
+ ChatColor.GREEN + "" + event.getHealAmount() + " HP HEAL!", offset.clone().subtract(new Vector(0, 0.2, 0)));
+ }
+
+ }
+
+ private void resistArmorStandCreator(EliteEntity eliteEntity, Player player, Material material) {
+ if (!eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld()))
+ return;
+
+ ArmorStand armorStand = VisualDisplay.generateTemporaryArmorStand(getResistLocation(player, eliteEntity), "Resist");
+ armorStand.getEquipment().setItemInMainHand(new ItemStack(material));
+ armorStand.addEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING);
+ armorStand.setRightArmPose(new EulerAngle(Math.PI / 2d, Math.PI + Math.PI / 2d, Math.PI));
+
+ new BukkitRunnable() {
+ int counter = 0;
+
+ @Override
+ public void run() {
+ if (counter > 20 || !eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld())) {
+ EntityTracker.unregister(armorStand, RemovalReason.EFFECT_TIMEOUT);
+ cancel();
+ return;
+ }
+ try {
+ armorStand.teleport(getResistLocation(player, eliteEntity));
+ } catch (Exception e) {
+ //Sometimes, very rarely, x is not finite. Doesn't really matter.
+ }
+ counter++;
+ }
+ }.runTaskTimer(MetadataHandler.PLUGIN, 1, 1);
+ }
+
+ private Location getResistLocation(Player player, EliteEntity eliteEntity) {
+ Vector armorsStandVector = player.getLocation().subtract(eliteEntity.getLocation()).toVector().normalize().multiply(1.5);
+ Location armorStandLocation = eliteEntity.getLocation().add(armorsStandVector);
+ armorStandLocation.setDirection(armorsStandVector);
+ return armorStandLocation;
+ }
+
+ private void weakArmorStandCreator(EliteEntity eliteEntity, Player player, Material material) {
+ if (!eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld()))
+ return;
+
+ TextDisplay[] textDisplays = new TextDisplay[2];
+ textDisplays[0] = generateWeakArmorStand(player, eliteEntity, material, -1);
+ textDisplays[1] = generateWeakArmorStand(player, eliteEntity, material, 1);
+
+ new BukkitRunnable() {
+ int counter = 0;
+
+ @Override
+ public void run() {
+ if (counter > 10 || !eliteEntity.isValid() || !player.isValid() || !eliteEntity.getLocation().getWorld().equals(player.getWorld())) {
+ EntityTracker.unregister(textDisplays[0], RemovalReason.EFFECT_TIMEOUT);
+ EntityTracker.unregister(textDisplays[1], RemovalReason.EFFECT_TIMEOUT);
+ cancel();
+ return;
+ }
+ for (TextDisplay armorStand : textDisplays)
+ armorStand.teleport(armorStand.getLocation().add(eliteEntity.getLocation().add(new Vector(0, 0, 0))
+ .subtract(armorStand.getLocation()).toVector().normalize().multiply(.4)));
+ counter++;
+ }
+ }.runTaskTimer(MetadataHandler.PLUGIN, 1, 1);
+ }
+
+ private TextDisplay generateWeakArmorStand(Player player, EliteEntity eliteEntity, Material material, int offset) {
+ Vector armorsStandVector = player.getLocation().clone().add(new Vector(0, 2, 0)).subtract(eliteEntity.getLocation()).toVector().normalize().multiply(3.0).rotateAroundY(Math.PI / 8 * offset);
+ Location armorStandLocation = eliteEntity.getLocation().add(armorsStandVector);
+ armorStandLocation.setDirection(armorsStandVector.multiply(-1));
+ return VisualDisplay.generateTemporaryTextDisplay(armorStandLocation, "Weak");
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/combattag/CombatTag.java b/src/main/java/com/magmaguy/elitemobs/combattag/CombatTag.java
deleted file mode 100644
index a1efa636d..000000000
--- a/src/main/java/com/magmaguy/elitemobs/combattag/CombatTag.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.magmaguy.elitemobs.combattag;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.EntityTracker;
-import com.magmaguy.elitemobs.MetadataHandler;
-import com.magmaguy.elitemobs.config.CombatTagConfig;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import net.md_5.bungee.api.ChatMessageType;
-import net.md_5.bungee.api.chat.TextComponent;
-import org.bukkit.GameMode;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Projectile;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.scheduler.BukkitRunnable;
-
-public class CombatTag implements Listener {
-
- @EventHandler
- public void onDamage(EntityDamageByEntityEvent event) {
-
- Player player = playerFinder(event);
-
- if (player == null) return;
-
- if (player.getGameMode().equals(GameMode.CREATIVE)) return;
-
- if (player.isInvulnerable()) player.setInvulnerable(false);
- if (player.isFlying()) {
- player.setFlying(false);
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR,
- TextComponent.fromLegacyText(ChatColorConverter.convert(ConfigValues.combatTagConfig.getString(CombatTagConfig.COMBAT_TAG_MESSAGE))));
- new BukkitRunnable() {
- @Override
- public void run() {
- //TODO: introduce the featherfall potion effect for versions above 1.12.2
-// if (NameHandler.currentVersionIsUnder(13, 0)) {
- if (!player.isOnline() || player.isDead())
- cancel();
- if (player.isOnGround()) {
- player.setFallDistance(0F);
- cancel();
- }
-// } else {
-////TODO: introduce the featherfall potion effect for versions above 1.12.2
-// if (!player.isOnline() || player.isDead())
-// player.removePotionEffect(PotionEffectType.SLOW);
-// cancel();
-// if (player.isOnGround()) {
-// player.setFallDistance(0F);
-// cancel();
-// }
-//
-// }
- }
- }.runTaskTimer(MetadataHandler.PLUGIN, 0, 1);
- }
- }
-
- private static Player playerFinder(EntityDamageByEntityEvent event) {
-
- if (event.getDamager() instanceof Player && EntityTracker.isEliteMob(event.getEntity()))
- return (Player) event.getDamager();
- if (event.getEntity() instanceof Player && (EntityTracker.isEliteMob(event.getEntity()) ||
- event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof LivingEntity &&
- EntityTracker.isEliteMob(((LivingEntity) ((Projectile) event.getDamager()).getShooter()))))
- return (Player) event.getEntity();
- if (event.getDamager() instanceof Projectile && ((Projectile) event.getDamager()).getShooter() instanceof Player &&
- EntityTracker.isEliteMob(event.getEntity()))
- return (Player) ((Projectile) event.getDamager()).getShooter();
-
- return null;
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java
new file mode 100644
index 000000000..5ecc8de73
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildArgCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class AdventurersGuildArgCommand extends AdvancedCommand {
+ public AdventurersGuildArgCommand() {
+ super(List.of("ag", "adventurersguild"));
+ setUsage("/em adventurersguild");
+ setPermission("elitemobs.adventurersguild.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java
new file mode 100644
index 000000000..1c6f75897
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/AdventurersGuildCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+
+public class AdventurersGuildCommand extends AdvancedCommand {
+ public AdventurersGuildCommand() {
+ super(new ArrayList<>());
+ setUsage("/em adventurersguild");
+ setPermission("elitemobs.adventurersguild.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Teleports players to the Adventurer's Guild Hub or opens the Adventurer's Guild menu.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java
new file mode 100644
index 000000000..4a6f18b00
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/AltCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class AltCommand extends AdvancedCommand {
+ public AltCommand() {
+ super(List.of("alt"));
+ setUsage("/em alt");
+ setDescription("Changes the style of the /em menu.");
+ setPermission("elitemobs.alt");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ PlayerData.setUseBookMenus(commandData.getPlayerSender(), !PlayerData.getUseBookMenus(commandData.getPlayerSender().getUniqueId()));
+ Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getSwitchEMStyleMessage());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java
new file mode 100644
index 000000000..9c97bb5ab
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ArenaCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.ArenaMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ArenaCommand extends AdvancedCommand {
+ public ArenaCommand() {
+ super(List.of("arena"));
+ addArgument("arenaID", new ArrayList<>());
+ setUsage("/em arena ");
+ setPermission("elitemobs.arena.start");
+ setDescription("Open the Arena menu.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new ArenaMenu().constructArenaMenu(commandData.getPlayerSender(), commandData.getStringArgument("arenaID"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CheckMaxItemTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/CheckMaxItemTierCommand.java
deleted file mode 100644
index faa16eb9b..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/CheckMaxItemTierCommand.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.ItemsDropSettingsConfig;
-import com.magmaguy.elitemobs.config.ItemsProceduralSettingsConfig;
-import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
-import org.bukkit.command.CommandSender;
-
-public class CheckMaxItemTierCommand {
-
- public static void checkMaxItemTier(CommandSender commandSender) {
-
- commandSender.sendMessage("The current maximum item tier is tier " + ConfigValues.itemsDropSettingsConfig.getString(ItemsDropSettingsConfig.MAXIMUM_LOOT_TIER));
- commandSender.sendMessage("The current maximum power enchantment is " + ConfigValues.itemsProceduralSettingsConfig.getString(ItemsProceduralSettingsConfig.ARROW_DAMAGE_MAX_LEVEL));
- commandSender.sendMessage("The current maximum sharpness enchantment is " + ConfigValues.itemsProceduralSettingsConfig.getString(ItemsProceduralSettingsConfig.DAMAGE_ALL_MAX_LEVEL));
- commandSender.sendMessage("The current maximum protection enchantment is " + ConfigValues.itemsProceduralSettingsConfig.getString(ItemsProceduralSettingsConfig.PROTECTION_ENVIRONMENTAL_MAX_LEVEL));
- commandSender.sendMessage("The current maximum natural mob level is " + ConfigValues.mobCombatSettingsConfig.getString(MobCombatSettingsConfig.NATURAL_ELITEMOB_LEVEL_CAP));
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CheckTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/CheckTierCommand.java
deleted file mode 100644
index 18a6ca642..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/CheckTierCommand.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.adventurersguild.GuildRank;
-import com.magmaguy.elitemobs.items.ItemTierFinder;
-import org.bukkit.entity.Player;
-
-public class CheckTierCommand {
-
- public static void checkTier(Player player) {
-
- double gearTier = ItemTierFinder.findPlayerTier(player);
- double guildTier = (GuildRank.getGuildRank(player.getUniqueId()) - 10) * 0.2;
-
- player.sendMessage("Your combat tier is " + gearTier);
- player.sendMessage("Your guild tier bonus is " + guildTier);
- player.sendMessage("Your threat tier is " + (gearTier + guildTier));
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java
index 941813756..dfe83b9f2 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/CommandHandler.java
@@ -1,349 +1,106 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
import com.magmaguy.elitemobs.MetadataHandler;
-import com.magmaguy.elitemobs.adventurersguild.AdventurersGuildGUI;
-import com.magmaguy.elitemobs.commands.shops.CustomShopHandler;
-import com.magmaguy.elitemobs.commands.shops.ShopHandler;
-import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.DefaultConfig;
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.entity.Player;
-
-/**
- * Created by MagmaGuy on 21/01/2017.
- */
-
-public class CommandHandler implements CommandExecutor {
-
- private final static String STATS = "elitemobs.stats";
- private final static String GETLOOT = "elitemobs.getloot";
- private final static String SIMLOOT = "elitemobs.simloot";
- public final static String RELOAD_CONFIGS = "elitemobs.reload";
- private final static String RELOAD_LOOT = "elitemobs.reload.loot";
- private final static String GIVELOOT = "elitemobs.giveloot";
- private final static String SPAWNMOB = "elitemobs.spawnmob";
- private final static String SPAWN_BOSS_MOB = "elitemobs.spawnbossmob";
- public final static String KILLALL_AGGRESSIVEELITES = "elitemobs.killall.aggressiveelites";
- public final static String KILLALL_PASSIVEELITES = "elitemobs.killall.passiveelites";
- public final static String KILLALL_SPECIFICENTITY = "elitemobs.killall.specificentity";
- private final static String SHOP = "elitemobs.shop";
- private final static String CUSTOMSHOP = "elitemobs.customshop";
- private final static String CURRENCY_PAY = "elitemobs.currency.pay";
- private final static String CURRENCY_ADD = "elitemobs.currency.add";
- private final static String CURRENCY_SUBTRACT = "elitemobs.currency.subtract";
- private final static String CURRENCY_SET = "elitemobs.currency.set";
- private final static String CURRENCY_CHECK = "elitemobs.currency.check";
- private final static String CURRENCY_WALLET = "elitemobs.currency.wallet";
- private final static String CURRENCY_COINTOP = "elitemobs.currency.cointop";
- private final static String VERSION = "elitemobs.version";
- public final static String EVENT_LAUNCH_SMALLTREASUREGOBLIN = "elitemobs.events.smalltreasuregoblin";
- public final static String EVENT_LAUNCH_DEADMOON = "elitemobs.events.smalltreasuregoblin";
- private final static String CHECK_TIER = "elitemobs.checktier";
- private final static String SET_MAX_TIER = "elitemobs.config.setmaxtier";
- private final static String GET_TIER = "elitemobs.gettier";
- private final static String CHECK_MAX_TIER = "elitemobs.checkmaxtier";
- private final static String ADVENTURERS_GUILD = "elitemobs.adventurersguild";
-
- @Override
- public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) {
-
- switch (label) {
- case "ag":
- case "adventurersguild":
- case "adventurerguild":
- if (userPermCheck(ADVENTURERS_GUILD, commandSender) && ConfigValues.adventurersGuildConfig.getBoolean(AdventurersGuildConfig.ENABLE_ADVENTURERS_GUILD))
- AdventurersGuildGUI.mainMenu((Player) commandSender);
- return true;
- }
-
- if (args.length == 0) {
- validCommands(commandSender);
- return true;
- }
-
- args[0] = args[0].toLowerCase();
-
- switch (args[0]) {
- case "spawn":
- case "spawnmob":
- if (permCheck(SPAWNMOB, commandSender))
- SpawnMobCommandHandler.spawnMob(commandSender, args);
- return true;
- case "ag":
- case "adventurersguild":
- case "adventurerguild":
- if (userPermCheck(ADVENTURERS_GUILD, commandSender))
- AdventurersGuildGUI.mainMenu((Player) commandSender);
- return true;
- case "stats":
- if (permCheck(STATS, commandSender))
- StatsCommandHandler.statsHandler(commandSender);
- return true;
- case "getloot":
- case "gl":
- if (userPermCheck(GETLOOT, commandSender) && args.length == 1) {
- LootGUI lootGUI = new LootGUI();
- lootGUI.lootGUI((Player) commandSender);
- } else {
- if (GetLootCommandHandler.getLoot(((Player) commandSender), args[1]))
- return true;
- else
- ((Player) commandSender).sendTitle("", "Could not find that item name.");
- }
- return true;
- case "shop":
- case "store":
- if (userPermCheck(SHOP, commandSender)) {
- ShopHandler shopHandler = new ShopHandler();
- shopHandler.initializeShop((Player) commandSender);
- }
- return true;
- case "customshop":
- case "cshop":
- case "customstore":
- case "cstore":
- if (userPermCheck(CUSTOMSHOP, commandSender)) {
- CustomShopHandler customShopHandler = new CustomShopHandler();
- customShopHandler.initializeShop((Player) commandSender);
- }
- return true;
- case "wallet":
- case "bal":
- case "balance":
- case "currency":
- case "money":
- case "$":
- if (userPermCheck(CURRENCY_WALLET, commandSender))
- CurrencyCommandsHandler.walletCommand(commandSender, args);
- return true;
- case "cointop":
- case "baltop":
- case "cashtop":
- case "currencytop":
- case "$top":
- if (userPermCheck(CURRENCY_COINTOP, commandSender))
- CurrencyCommandsHandler.coinTop(commandSender);
- return true;
- case "version":
- if (permCheck(VERSION, commandSender))
- VersionHandler.versionCommand(commandSender, args);
- return true;
- case "checktier":
- case "tiercheck":
- case "tier":
- if (permCheck(CHECK_TIER, commandSender))
- CheckTierCommand.checkTier(((Player) commandSender));
- return true;
- case "checkmaxtier":
- case "maxtier":
- if (permCheck(CHECK_MAX_TIER, commandSender))
- CheckMaxItemTierCommand.checkMaxItemTier(commandSender);
- return true;
- case "reload":
- case "restart":
- if (permCheck(RELOAD_CONFIGS, commandSender))
- ReloadHandler.reloadCommand(commandSender, args);
- return true;
- case "killall":
- case "kill":
- KillHandler.killCommand(commandSender, args);
- return true;
- case "simloot":
- case "simulateloot":
- case "simdrop":
- case "simulatedrop":
- if (userPermCheck(SIMLOOT, commandSender))
- SimLootHandler.simLoot((Player) commandSender, Integer.parseInt(args[1]));
- return true;
- case "check":
- case "checkcurrency":
- case "checkbal":
- case "checkbalance":
- case "check$":
- if (permCheck(CURRENCY_CHECK, commandSender))
- CurrencyCommandsHandler.checkCommand(commandSender, args);
- return true;
- case "event":
- case "launchevent":
- case "startevent":
- case "triggerevent":
- TriggerEventHandler.triggerEventCommand(commandSender, args);
- return true;
- case "spawnbossmob":
- case "spawnboss":
- if (userPermCheck(SPAWNMOB, commandSender))
- SpawnMobCommandHandler.spawnBossMob((Player) commandSender, args);
- return true;
- case "gettier":
- case "spawntier":
- if (userPermCheck(GET_TIER, commandSender))
- TierSetSpawner.spawnTierItem(Integer.parseInt(args[1]), (Player) commandSender);
- return true;
- case "setmaxtier":
- if (permCheck(SET_MAX_TIER, commandSender))
- SetMaxItemTierCommand.setMaxItemTier(Double.parseDouble(args[1]), commandSender);
- return true;
- case "giveloot":
- if (permCheck(GIVELOOT, commandSender))
- GiveLootHandler.giveLootCommand(commandSender, args);
- return true;
- case "pay":
- if (userPermCheck(CURRENCY_PAY, commandSender))
- CurrencyCommandsHandler.payCommand((Player) commandSender, args);
- return true;
- case "add":
- if (permCheck(CURRENCY_ADD, commandSender))
- CurrencyCommandsHandler.addCommand(commandSender, args);
- return true;
- case ("subtract"):
- if (permCheck(CURRENCY_SUBTRACT, commandSender))
- CurrencyCommandsHandler.subtractCommand(commandSender, args);
- return true;
- case ("set"):
- if (permCheck(CURRENCY_SET, commandSender))
- CurrencyCommandsHandler.setCommand(commandSender, args);
- return true;
- default:
- validCommands(commandSender);
- return true;
-
- }
-
- }
-
- public static boolean permCheck(String permission, CommandSender commandSender) {
-
- if (commandSender.hasPermission(permission)) return true;
-
- if (commandSender instanceof Player &&
- Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getConfig().getBoolean(DefaultConfig.ENABLE_PERMISSION_TITLES)) {
-
- Player player = (Player) commandSender;
-
- player.sendTitle("I'm afraid I can't let you do that, " + player.getDisplayName() + ".",
- "You need the following permission: " + permission);
-
- } else {
-
- commandSender.sendMessage("[EliteMobs] You may not run this command.");
- commandSender.sendMessage("[EliteMobs] You don't have the permission " + permission);
-
- }
-
- return false;
+import com.magmaguy.magmacore.command.CommandManager;
+public class CommandHandler {
+ private static CommandManager emCommand;
+ private static CommandManager adventurersGuildCommand;
+ private CommandHandler() {
}
- public static boolean userPermCheck(String permission, CommandSender commandSender) {
-
- if (commandSender instanceof Player) {
-
- return permCheck(permission, commandSender);
-
- }
-
- commandSender.sendMessage("[EliteMobs] You may not run this command.");
- commandSender.sendMessage("[EliteMobs] This is a user command.");
- return false;
-
+ public static void registerCommands() {
+ emCommand = new CommandManager(MetadataHandler.PLUGIN, "elitemobs");
+
+ //Admin commands
+ emCommand.registerCommand(new SetupCommand());
+ emCommand.registerCommand(new SetupDoneCommand());
+ emCommand.registerCommand(new SetupToggleCommand());
+ emCommand.registerCommand(new SpawnBossCommand());
+ emCommand.registerCommand(new SpawnBossLevelCommand());
+ emCommand.registerCommand(new SpawnBossAtCommand());
+ emCommand.registerCommand(new SpawnBossLevelAtCommand());
+ emCommand.registerCommand(new PlaceBossCommand());
+ emCommand.registerCommand(new PlaceTreasureChestCommand());
+ emCommand.registerCommand(new PlaceNPCCommand());
+ emCommand.registerCommand(new RemoveCommand());
+ emCommand.registerCommand(new DebugCommand());
+ emCommand.registerCommand(new EventCommand());
+ emCommand.registerCommand(new StatsCommand());
+ emCommand.registerCommand(new LootMenuCommand());
+ emCommand.registerCommand(new LootGiveCommand());
+ emCommand.registerCommand(new LootRandomCommand());
+ emCommand.registerCommand(new LootSimulateMultipleCommand());
+ emCommand.registerCommand(new LootSimulateCommand());
+ emCommand.registerCommand(new VersionCommand());
+ emCommand.registerCommand(new ReloadCommand());
+ emCommand.registerCommand(new KillCommand());
+ emCommand.registerCommand(new KillRadiusCommand());
+ emCommand.registerCommand(new KillTypeCommand());
+ emCommand.registerCommand(new KillTypeRadiusCommand());
+ emCommand.registerCommand(new LootDebugCommand());
+ emCommand.registerCommand(new MoneyAddCommand());
+ emCommand.registerCommand(new MoneyAddAllCommand());
+ emCommand.registerCommand(new MoneySetCommand());
+ emCommand.registerCommand(new MoneyCheckPlayerCommand());
+ emCommand.registerCommand(new UnbindForceCommand());
+ emCommand.registerCommand(new FireballCommand());
+ emCommand.registerCommand(new RespawnAllCommand());
+ emCommand.registerCommand(new PackageDungeonCommand());
+ emCommand.registerCommand(new LanguageCommand());
+ emCommand.registerCommand(new PlaceWormholeCommand());
+ emCommand.registerCommand(new LootStats());
+ emCommand.registerCommand(new ShopProceduralOtherCommand());
+ emCommand.registerCommand(new ShopCustomOtherCommand());
+ emCommand.registerCommand(new ShopSellOtherCommand());
+ emCommand.registerCommand(new QuestBypassCommand());
+ emCommand.registerCommand(new QuestCompleteCommand());
+ emCommand.registerCommand(new QuestCompleteQuestCommand());
+ emCommand.registerCommand(new QuestResetCommand());
+ emCommand.registerCommand(new QuestResetAllCommand());
+ emCommand.registerCommand(new TransitiveBlocksCancelCommand());
+ emCommand.registerCommand(new TransitiveBlocksRegisterCommand());
+ emCommand.registerCommand(new TransitiveBlocksEditCommand());
+ emCommand.registerCommand(new TransitiveBlocksRegisterAreaCommand());
+ emCommand.registerCommand(new TransitiveBlocksEditAreaCommand());
+ emCommand.registerCommand(new RankSetCommand());
+ emCommand.registerCommand(new SpawnElite());
+ emCommand.registerCommand(new SpawnEliteAtCommand());
+ emCommand.registerCommand(new DiscordMessageCommand());
+ emCommand.registerCommand(new DiscordCommand());
+ emCommand.registerCommand(new MoneyRemoveCommand());
+ emCommand.registerCommand(new ProtectionBypassCommand());
+
+ //User commands
+// emCommand.registerCommand(new AdventurersGuildCommand());
+ emCommand.registerCommand(new ShareItemCommand());
+ emCommand.registerCommand(new ShopDynamicCommand());
+ emCommand.registerCommand(new ShopCustomCommand());
+ emCommand.registerCommand(new RepairCommand());
+ emCommand.registerCommand(new EnchantCommand());
+ emCommand.registerCommand(new ScrapCommand());
+ emCommand.registerCommand(new UnbindCommand());
+ emCommand.registerCommand(new MoneyCheckCommand());
+ emCommand.registerCommand(new QuestAcceptCommand());
+ emCommand.registerCommand(new QuestTrackCommand());
+ emCommand.registerCommand(new QuestLeaveCommand());
+ emCommand.registerCommand(new RankCommand());
+ emCommand.registerCommand(new LootCommand());
+ emCommand.registerCommand(new QuitCommand());
+ emCommand.registerCommand(new StartCommand());
+ emCommand.registerCommand(new ArenaCommand());
+ emCommand.registerCommand(new DismissCommand());
+ emCommand.registerCommand(new AltCommand());
+ emCommand.registerCommand(new SpawnTeleportCommand());
+ emCommand.registerCommand(new DungeonTeleportCommand());
+ emCommand.registerCommand(new TrackBossCommand());
+ emCommand.registerCommand(new PayCommand());
+ emCommand.registerCommand(new AdventurersGuildArgCommand());
+
+ emCommand.registerCommand(new EliteMobsCommand());
+ emCommand.registerCommand(new HelpCommand());
+
+ adventurersGuildCommand =new CommandManager(MetadataHandler.PLUGIN, "adventurersguild");
+ adventurersGuildCommand.registerCommand(new AdventurersGuildCommand());
}
-
- private static void validCommands(CommandSender commandSender) {
-
- if (commandSender instanceof Player) {
-
- Player player = (Player) commandSender;
-
- player.sendMessage("[EliteMobs] Valid commands:");
- if (silentPermCheck(STATS, commandSender))
- player.sendMessage("/elitemobs stats");
- if (silentPermCheck(SHOP, commandSender))
- player.sendMessage("/elitemobs shop");
- if (silentPermCheck(CUSTOMSHOP, commandSender))
- player.sendMessage("/elitemobs customshop");
- if (silentPermCheck(CURRENCY_WALLET, commandSender))
- player.sendMessage("/elitemobs wallet");
- if (silentPermCheck(CURRENCY_COINTOP, commandSender))
- player.sendMessage("/elitemobs cointop");
- if (silentPermCheck(CURRENCY_PAY, commandSender))
- player.sendMessage("/elitemobs pay [username]");
- if (silentPermCheck(CURRENCY_ADD, commandSender))
- player.sendMessage("/elitemobs add [username]");
- if (silentPermCheck(CURRENCY_SUBTRACT, commandSender))
- player.sendMessage("/elitemobs subtract [username]");
- if (silentPermCheck(CURRENCY_SET, commandSender))
- player.sendMessage("/elitemobs set [username]");
- if (silentPermCheck(CURRENCY_CHECK, commandSender))
- player.sendMessage("/elitemobs check [username]");
- if (silentPermCheck(RELOAD_CONFIGS, commandSender))
- player.sendMessage("/elitemobs reload");
- if (silentPermCheck(KILLALL_AGGRESSIVEELITES, commandSender))
- player.sendMessage("/elitemobs kill aggressive");
- if (silentPermCheck(KILLALL_PASSIVEELITES, commandSender))
- player.sendMessage("/elitemobs kill passive");
- if (silentPermCheck(SIMLOOT, commandSender))
- player.sendMessage("/elitemobs simloot [mob level]");
- if (silentPermCheck(GETLOOT, commandSender))
- player.sendMessage("/elitemobs getloot [loot name (no loot name = AdventurersGuildGUI)]");
- if (silentPermCheck(GIVELOOT, commandSender))
- player.sendMessage("/elitemobs giveloot [player name] random/[loot_name_underscore_for_spaces]");
- if (silentPermCheck(SPAWNMOB, commandSender))
- player.sendMessage("/elitemobs SpawnMob [mobType] [mobLevel] [mobPower] [mobPower2(keep adding as many as you'd like)]");
- if (silentPermCheck(SPAWN_BOSS_MOB, commandSender))
- commandSender.sendMessage("/elitemobs spawnBossMob [bossName]");
- if (silentPermCheck(CHECK_TIER, commandSender))
- commandSender.sendMessage("/elitemobs checktier");
- if (silentPermCheck(CHECK_MAX_TIER, commandSender))
- commandSender.sendMessage("/elitemobs checkmaxtier");
- if (silentPermCheck(SET_MAX_TIER, commandSender))
- commandSender.sendMessage("/elitemobs setmaxtier [tier]");
- if (silentPermCheck(GET_TIER, commandSender))
- commandSender.sendMessage("/elitemobs gettier [tier]");
-
-
- } else if (commandSender instanceof ConsoleCommandSender) {
-
- commandSender.sendMessage("[EliteMobs] Command not recognized. Valid commands:");
- commandSender.sendMessage("elitemobs stats");
- commandSender.sendMessage("elitemobs reload");
- commandSender.sendMessage("elitemobs check [username]");
- commandSender.sendMessage("elitemobs set [username]");
- commandSender.sendMessage("elitemobs add [username]");
- commandSender.sendMessage("elitemobs subtract [username]");
- commandSender.sendMessage("elitemobs killall passiveelites");
- commandSender.sendMessage("elitemobs killall aggressiveelites");
- commandSender.sendMessage("elitemobs giveloot [player name] random/[loot_name_underscore_for_spaces]");
- commandSender.sendMessage("elitemobs SpawnMob [worldName] [x] [y] [z] [mobType] [mobLevel] [mobPower] [mobPower2(keep adding as many as you'd like)]");
-
- }
-
- }
-
- private static boolean silentPermCheck(String permission, CommandSender commandSender) {
-
- return commandSender.hasPermission(permission);
-
- }
-
-
}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java
index 3dcb004a2..e11cdfd9e 100644
--- a/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java
+++ b/src/main/java/com/magmaguy/elitemobs/commands/CurrencyCommandsHandler.java
@@ -1,229 +1,145 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-import com.magmaguy.elitemobs.config.ConfigValues;
import com.magmaguy.elitemobs.config.EconomySettingsConfig;
import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.economy.UUIDFilter;
-import com.magmaguy.elitemobs.playerdata.PlayerData;
-import org.bukkit.ChatColor;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Round;
+import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.UUID;
-
-import static org.bukkit.Bukkit.getServer;
-
/**
* Created by MagmaGuy on 17/06/2017.
*/
public class CurrencyCommandsHandler {
- public static void payCommand(String playerName, double amount) {
-
- if (amount > 0)
- EconomyHandler.addCurrency(UUIDFilter.guessUUI(playerName), amount);
-
-
- }
-
- public static void payCommand(Player commandSender, String[] args) {
-
- try {
-
- if (Double.parseDouble(args[2]) > 0 && Integer.parseInt(args[2]) <= EconomyHandler.checkCurrency(UUIDFilter.guessUUI(commandSender.getName()))) {
-
- payCommand(args[1], Integer.parseInt(args[2]));
- subtractCommand(commandSender.getName(), Integer.parseInt(args[2]));
-
- commandSender.sendMessage("You have paisd " + args[2] + " " + ConfigValues.economyConfig.get("Currency name") + " to " + args[1]);
- commandSender.sendMessage("You now have " + EconomyHandler.checkCurrency(UUIDFilter.guessUUI(commandSender.getName())) + " " + ConfigValues.economyConfig.get("Currency name"));
-
- Player recipient = getServer().getPlayer(args[1]);
- recipient.sendMessage("You have received " + args[2] + " " + ConfigValues.economyConfig.get("Currency name") + " from " + commandSender.getDisplayName());
-
- } else if (Double.parseDouble(args[2]) < 0)
- commandSender.sendMessage("Nice try. This plugin doesn't make the same mistake as some banks have in the past.");
- else
- commandSender.sendMessage("You don't have enough " + ConfigValues.economyConfig.get("Currency name") + " to do that!");
-
-
- } catch (Exception e) {
-
- commandSender.sendMessage("Input not valid. Command format: /em pay [playerName] [amount]");
+ public static void payCommand(Player sender, String recipientName, double amount) {
+ //CASE: Negative amount
+ if (amount <= 0) {
+ sender.sendMessage(ChatColorConverter.convert("&4[EliteMobs]Nice try."));
+ return;
}
- }
-
- public static void addCommand(String playerName, double amount) {
-
- EconomyHandler.addCurrency(UUIDFilter.guessUUI(playerName), amount);
-
- }
-
- public static void addCommand(CommandSender commandSender, String[] args) {
-
- try {
-
- addCommand(args[1], Integer.parseInt(args[2]));
-
- commandSender.sendMessage("You have added " + args[2] + " to " + args[1]);
- commandSender.sendMessage("They now have " + EconomyHandler.checkCurrency(UUIDFilter.guessUUI(commandSender.getName())));
-
- } catch (Exception e) {
-
- commandSender.sendMessage("Input not valid. Command format: /em add [playerName] [amount]");
-
+ //CASE: Offline player
+ Player recipient = Bukkit.getPlayer(recipientName);
+ if (recipient == null) {
+ sender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + recipientName + " is not online and can therefore not get a payment."));
+ return;
}
- }
-
- public static void subtractCommand(String playerName, double amount) {
-
- EconomyHandler.subtractCurrency(UUIDFilter.guessUUI(playerName), amount);
-
- }
-
- public static void subtractCommand(CommandSender commandSender, String[] args) {
-
- try {
-
- subtractCommand(args[1], Integer.parseInt(args[2]));
-
- commandSender.sendMessage("You have subtracted " + args[2] + " from " + args[1]);
- commandSender.sendMessage("They now have " + EconomyHandler.checkCurrency(UUIDFilter.guessUUI(commandSender.getName())));
-
- } catch (Exception e) {
-
- commandSender.sendMessage("Input not valid. Command format: /em subtract [playerName] [amount]");
-
+ //CASE: Insufficient funds
+ double senderCurrency = EconomyHandler.checkCurrency(sender.getUniqueId());
+ if (senderCurrency - amount < 0) {
+ sender.sendMessage(
+ ChatColorConverter.convert(
+ EconomySettingsConfig.getEconomyPaymentInsufficientCurrency()
+ .replace("$currency_name", EconomySettingsConfig.getCurrencyName())));
+ return;
}
- }
-
- public static void setCommand(String playerName, double amount) {
-
- EconomyHandler.setCurrency(UUIDFilter.guessUUI(playerName), amount);
-
- }
-
- public static void setCommand(CommandSender commandSender, String[] args) {
-
- try {
-
- CurrencyCommandsHandler.setCommand(args[1], Integer.parseInt(args[2]));
- commandSender.sendMessage("You set " + args[1] + "'s " + ConfigValues.economyConfig.get("Currency name") + " to " + args[2]);
-
- } catch (Exception e) {
-
- commandSender.sendMessage("Input not valid. Command format: /em set [playerName] [amount]");
-
- }
+ double actuallyReceivedAmount = Round.twoDecimalPlaces(amount - amount * EconomySettingsConfig.getPlayerToPlayerTaxes());
+ double taxes = Round.twoDecimalPlaces(amount * EconomySettingsConfig.getPlayerToPlayerTaxes());
+
+ //CASE: Successful payment
+ EconomyHandler.addCurrency(recipient.getUniqueId(), actuallyReceivedAmount);
+ EconomyHandler.subtractCurrency(sender.getUniqueId(), amount);
+
+ sender.sendMessage(
+ ChatColorConverter.convert(
+ EconomySettingsConfig.getEconomyPayMessage()
+ .replace("$amount_sent", amount + "")
+ .replace("$amount_received", actuallyReceivedAmount + "")
+ .replace("$taxes", taxes + "")
+ .replace("$currency_name", EconomySettingsConfig.getCurrencyName())
+ .replace("$receiver", recipient.getDisplayName())));
+
+ sender.sendMessage(
+ ChatColorConverter.convert(
+ EconomySettingsConfig.getEconomyCurrencyLeftMessage()
+ .replace("$amount_left", String.valueOf(EconomyHandler.checkCurrency(sender.getUniqueId())))
+ .replace("$currency_name", EconomySettingsConfig.getCurrencyName())));
+
+ recipient.sendMessage(
+ ChatColorConverter.convert(
+ EconomySettingsConfig.getEconomyPaymentReceivedMessage()
+ .replace("$amount_sent", amount + "")
+ .replace("$amount_received", actuallyReceivedAmount + "")
+ .replace("$taxes", taxes + "")
+ .replace("$sender", sender.getDisplayName())
+ .replace("$currency_name", EconomySettingsConfig.getCurrencyName())));
+
+ recipient.sendMessage(
+ ChatColorConverter.convert(
+ EconomySettingsConfig.getEconomyCurrencyLeftMessage()
+ .replace("$amount_left", String.valueOf(EconomyHandler.checkCurrency(recipient.getUniqueId())))
+ .replace("$currency_name", EconomySettingsConfig.getCurrencyName())));
}
- public static Double checkCommand(String playerName) {
-
- return EconomyHandler.checkCurrency(UUIDFilter.guessUUI(playerName));
-
+ public static void addCommand(Player player, double amount) {
+ EconomyHandler.addCurrency(player.getUniqueId(), amount);
}
- public static void checkCommand(CommandSender commandSender, String[] args) {
-
- try {
- Double money = CurrencyCommandsHandler.checkCommand(args[1]);
- commandSender.sendMessage(args[1] + " has " + money + " " + ConfigValues.economyConfig.get("Currency name"));
- } catch (Exception e) {
- commandSender.sendMessage("Input not valid. Command format: /em check [playerName]");
+ public static void addCommand(CommandSender commandSender, String onlinePlayer, double amount) {
+ Player player = Bukkit.getPlayer(onlinePlayer);
+ if (player == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + onlinePlayer + " &4is not valid!"));
+ return;
}
-
+ addCommand(player, amount);
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2You have added " + amount + " to " + onlinePlayer));
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2They now have " + EconomyHandler.checkCurrency(player.getUniqueId())));
}
- public static Double walletCommand(String playerName) {
-
- return EconomyHandler.checkCurrency(UUIDFilter.guessUUI(playerName));
-
+ public static void addAllCommand(CommandSender commandSender, double amount) {
+ for (Player player : Bukkit.getOnlinePlayers())
+ addCommand(player, amount);
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2You have added " + amount + " to all online players."));
}
- public static void walletCommand(CommandSender commandSender, String[] args) {
-
- commandSender.sendMessage(ChatColor.GREEN + "You have " +
- CurrencyCommandsHandler.walletCommand(commandSender.getName()) + " " +
- ConfigValues.economyConfig.getString("Currency name"));
+ public static void subtractCommand(String playerName, double amount) {
+ EconomyHandler.subtractCurrency(Bukkit.getPlayer(playerName).getUniqueId(), amount);
}
- public static void coinTop(CommandSender commandSender) {
-
- ArrayList arrayList = new ArrayList();
-
- for (UUID uuid : PlayerData.playerCurrency.keySet()) {
-
- if (arrayList.size() == 0) {
-
- arrayList.add(uuid);
-
- } else {
-
- int index = arrayList.size();
-
- for (UUID inArrayUUID : arrayList) {
-
- double arrayEntryValue = PlayerData.playerCurrency.get(inArrayUUID);
- double newValue = PlayerData.playerCurrency.get(uuid);
-
- if (newValue > arrayEntryValue) {
-
- index = arrayList.indexOf(inArrayUUID);
- break;
-
- }
-
- }
-
- arrayList.add(index, uuid);
-
- }
-
+ public static void subtractCommand(CommandSender commandSender, String onlinePlayer, int amount) {
+ Player player = Bukkit.getPlayer(onlinePlayer);
+ if (player == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + onlinePlayer + " &4is not valid!"));
+ return;
}
+ subtractCommand(onlinePlayer, amount);
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2You have subtracted " + amount + " from " + onlinePlayer));
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]They now have " + EconomyHandler.checkCurrency(player.getUniqueId())));
+ }
- commandSender.sendMessage(ChatColor.RED + "[EliteMobs] " + ChatColor.DARK_GREEN + ConfigValues.economyConfig.get(EconomySettingsConfig.CURRENCY_NAME) + " High Score:");
-
- int iterationAmount = 10;
-
- if (arrayList.size() < 10) {
-
- iterationAmount = arrayList.size();
-
+ public static void setCommand(CommandSender commandSender, String onlinePlayer, double amount) {
+ Player player = Bukkit.getPlayer(onlinePlayer);
+ if (player == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + onlinePlayer + " &4is not valid!"));
+ return;
}
+ EconomyHandler.setCurrency(player.getUniqueId(), amount);
+ commandSender.sendMessage("You set " + onlinePlayer + "'s " + EconomySettingsConfig.getCurrencyName() + " to " + amount);
+ }
- for (int i = 0; i < iterationAmount; i++) {
-
- String name = PlayerData.playerDisplayName.get(arrayList.get(i));
- double amount = PlayerData.playerCurrency.get(arrayList.get(i));
-
- int place = i + 1;
-
- commandSender.sendMessage(ChatColor.GREEN + "#" + place + " " + ChatColor.WHITE + name + " with " +
- ChatColor.DARK_GREEN + amount + " " + ChatColor.GREEN + ConfigValues.economyConfig.get(EconomySettingsConfig.CURRENCY_NAME));
+ public static void checkCommand(CommandSender commandSender, String playerName) {
+ Player player = Bukkit.getPlayer(playerName);
+ if (player == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Player " + playerName + " &4is not valid!"));
+ return;
}
+ double money = EconomyHandler.checkCurrency(player.getUniqueId());
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs]&f " + playerName + " &2has " + money + " " + EconomySettingsConfig.getCurrencyName()));
+ }
+ public static void walletCommand(Player player) {
+ player.sendMessage(
+ ChatColorConverter.convert(
+ EconomySettingsConfig.getEconomyWalletCommand()
+ .replace("$balance", String.valueOf(EconomyHandler.checkCurrency(player.getUniqueId())))
+ .replace("$currency_name", EconomySettingsConfig.getCurrencyName())));
}
}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java
new file mode 100644
index 000000000..71fbd2efb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/CustomBossCommandHandler.java
@@ -0,0 +1,56 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.elitemobs.utils.DebugBlockLocation;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Location;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+public class CustomBossCommandHandler {
+ private CustomBossCommandHandler() {
+ }
+
+ public static Location autoSeekSafeSpawnLocation(Location originalLocation) {
+ Location newLocation = new Location(originalLocation.getWorld(),
+ originalLocation.getBlockX() + 0.5,
+ originalLocation.getBlockY() + 0.5,
+ originalLocation.getBlockZ() + 0.5);
+ for (int i = 0; i < 4; i++)
+ if (newLocation.add(new Vector(0, i, 0)).getBlock().isPassable()) {
+ new DebugBlockLocation(newLocation);
+ return newLocation;
+ }
+ return null;
+ }
+
+ public static void addSpawnLocation(String customBossConfigFieldsString, Player player) {
+ CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
+ if (customBossesConfigFields == null)
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add spawn location! Custom Boss " + customBossConfigFieldsString + " is not valid regional boss!"));
+ else {
+ Location safeSpawnLocation = autoSeekSafeSpawnLocation(player.getLocation());
+ if (safeSpawnLocation == null)
+ player.sendMessage("[EliteMobs] No safe spawn location found! Make sure the area is passable!");
+ else {
+ RegionalBossEntity.createPermanentRegionalBossEntity(customBossesConfigFields, safeSpawnLocation);
+ }
+ }
+ }
+
+ public static void setLeashRadius(String customBossConfigFieldsString, CommandSender commandSender, int leashRadius) {
+ CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
+ if (customBossesConfigFields == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed set the leash radius! Was the boss a valid regional boss?"));
+ return;
+ }
+ customBossesConfigFields.runtimeSetLeashRadius(leashRadius);
+ for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntitySet())
+ if (customBossesConfigFields.getFilename().equals(regionalBossEntity.getCustomBossesConfigFields().getFilename()))
+ regionalBossEntity.setLeashRadius(leashRadius);
+ }
+
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java
new file mode 100644
index 000000000..34f06fa3b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DebugCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.DebugScreen;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DebugCommand extends AdvancedCommand {
+ public DebugCommand() {
+ super(List.of("debug"));
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ setUsage("/em debug ");
+ setPermission("elitemobs.debug");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Debug bosses or players.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ DebugScreen.open(commandData.getPlayerSender(), commandData.getStringArgument("filename"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java
new file mode 100644
index 000000000..b06eb76f3
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.utils.DiscordLinks;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class DiscordCommand extends AdvancedCommand {
+ public DiscordCommand() {
+ super(List.of("discord"));
+ setUsage("/em discord");
+ setPermission("elitemobs.discord.link");
+ setDescription("Links to the EliteMobs discord.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Logger.sendMessage(commandData.getPlayerSender(), "&6Discord room for support & downloads: &9" + DiscordLinks.mainLink);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java
new file mode 100644
index 000000000..64988902c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DiscordMessageCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.thirdparty.discordsrv.DiscordSRVAnnouncement;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DiscordMessageCommand extends AdvancedCommand {
+ public DiscordMessageCommand() {
+ super(List.of("discord"));
+ addArgument("message", new ArrayList<>());
+ setUsage("/em discord ");
+ setPermission("elitemobs.discord.message");
+ setDescription("Sends a message to the Discord via DiscordSRV, for debugging purposes");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new DiscordSRVAnnouncement(commandData.getStringSequenceArgument("message"));
+ Logger.sendMessage(commandData.getCommandSender(), "&aAttempted to send a message to Discord!");
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java
new file mode 100644
index 000000000..bb1b02fd4
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DismissCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class DismissCommand extends AdvancedCommand {
+ public DismissCommand() {
+ super(List.of("dismiss"));
+ setDescription("Dismisses /em menu message.");
+ setUsage("/em dismiss");
+ setPermission("elitemobs.dismiss");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ PlayerData.setDismissEMStatusScreenMessage(commandData.getPlayerSender(), !PlayerData.getDismissEMStatusScreenMessage(commandData.getPlayerSender().getUniqueId()));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java
new file mode 100644
index 000000000..4cbe96b1c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonCommands.java
@@ -0,0 +1,37 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.api.PlayerPreTeleportEvent;
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.elitemobs.dungeons.WorldInstancedDungeonPackage;
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import com.magmaguy.elitemobs.menus.InstancedDungeonBrowser;
+import com.magmaguy.elitemobs.wormhole.Wormhole;
+import org.bukkit.entity.Player;
+
+public class DungeonCommands {
+ public static void teleport(Player player, String minidungeonName) {
+ EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonName);
+ if (emPackage == null) {
+ player.sendMessage("[EliteMobs] That dungeon isn't valid!");
+ return;
+ } else if (!emPackage.isInstalled()) {
+ player.sendMessage("[EliteMobs] That dungeon isn't installed, ask an admin to install it!");
+ return;
+ }
+ if (MatchInstance.getAnyPlayerInstance(player) != null) {
+ player.sendMessage("[EliteMobs] You're already in an instance! You will not be able to switch to another instance before you do /em quit");
+ return;
+ }
+ if (emPackage instanceof WorldInstancedDungeonPackage)
+ new InstancedDungeonBrowser(player, emPackage.getDungeonPackagerConfigFields().getFilename());
+ else {
+ if (emPackage.getDungeonPackagerConfigFields().getTeleportLocation() != null) {
+ PlayerPreTeleportEvent.teleportPlayer(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation());
+ Wormhole.addPlayerToCooldowns(player);
+ }
+ else
+ player.sendMessage("[EliteMobs] Can't teleport you to the dungeon because the teleport location isn't set!" +
+ " Ask an admin to reinstall the dungeon!");
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java
new file mode 100644
index 000000000..5c71e0f63
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/DungeonTeleportCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DungeonTeleportCommand extends AdvancedCommand {
+ public DungeonTeleportCommand() {
+ super(List.of("dungeontp"));
+ addArgument("dungeonID", new ArrayList<>());
+ setPermission("elitemobs.dungeon.tp");
+ setDescription("Teleports players to Lairs, Minidungeons and Dungeons.");
+ setUsage("/em dungeontp ");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ DungeonCommands.teleport(commandData.getPlayerSender(), commandData.getStringArgument("dungeonID"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java
new file mode 100644
index 000000000..c41a1a6b2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/EliteMobsCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+
+public class EliteMobsCommand extends AdvancedCommand {
+ public EliteMobsCommand() {
+ super(new ArrayList<>());
+ setDescription("The main command for EliteMobs, opens the main menu.");
+ setUsage("/em");
+ setPermission("elitemobs.command");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (DefaultConfig.isEmLeadsToStatusMenu())
+ new PlayerStatusScreen(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java
new file mode 100644
index 000000000..1e7bfa81c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/EnchantCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.ItemEnchantmentMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class EnchantCommand extends AdvancedCommand {
+ public EnchantCommand() {
+ super(List.of("enchant"));
+ setUsage("/em enchant");
+ setPermission("elitemobs.enchant.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the enchantment menu or teleports the player to the Adventurer's Guild Hub");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ new ItemEnchantmentMenu(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java
new file mode 100644
index 000000000..61a496b6d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/EventCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.events.TimedEvent;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class EventCommand extends AdvancedCommand {
+ public EventCommand() {
+ super(List.of("event"));
+ addArgument("filename", TimedEvent.getBlueprintEvents().stream().map(timedEvent -> timedEvent.getCustomEventsConfigFields().getFilename()).toList());
+ setUsage("/em event ");
+ setPermission("elitemobs.event.start");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Triggers a timed event to start at the next available time and place.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.admin.EventCommand.trigger(commandData.getCommandSender(), commandData.getStringArgument("filename"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java
new file mode 100644
index 000000000..f15b47354
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/FireballCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Fireball;
+
+import java.util.List;
+
+public class FireballCommand extends AdvancedCommand {
+ public FireballCommand() {
+ super(List.of("fireball"));
+ setUsage("/em fireball");
+ setPermission("elitemobs.fireball");
+ setDescription("Shoots a fireball, to test terrain protections and explosion regeneration.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Fireball fireball = (Fireball) commandData.getPlayerSender().getWorld().spawnEntity(commandData.getPlayerSender().getLocation(), EntityType.FIREBALL);
+ fireball.setDirection(commandData.getPlayerSender().getLocation().getDirection().normalize());
+ fireball.setShooter(commandData.getPlayerSender());
+ fireball.setYield(3F);
+ EntityTracker.registerProjectileEntity(fireball);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/GetLootCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/GetLootCommandHandler.java
deleted file mode 100644
index f18728d51..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/GetLootCommandHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.items.uniqueitems.UniqueItemInitializer;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-import static com.magmaguy.elitemobs.items.CustomItemConstructor.customItemList;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-public class GetLootCommandHandler {
-
- public static boolean getLoot(Player player, String args1) {
-
- boolean itemExists = false;
-
- for (ItemStack itemStack : customItemList)
- itemExists = getItem(itemStack, args1, player);
-
- if (itemExists) return true;
-
- for (ItemStack itemStack : UniqueItemInitializer.uniqueItemsList)
- itemExists = getItem(itemStack, args1, player);
-
- if (itemExists) return true;
- return false;
-
- }
-
- private static boolean getItem(ItemStack itemStack, String args1, Player player) {
-
- String itemRawName = itemStack.getItemMeta().getDisplayName();
-
- if (itemRawName != null) {
-
- Bukkit.getLogger().info(itemStack.getItemMeta().getDisplayName());
-
- String itemProcessedName = itemRawName.replaceAll(" ", "_").toLowerCase();
- itemProcessedName = ChatColor.stripColor(itemProcessedName);
-
- if (itemProcessedName.equalsIgnoreCase(args1) && player.isValid()) {
-
- player.getInventory().addItem(itemStack);
-
- return true;
-
- }
-
- }
-
- return false;
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/GiveLootHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/GiveLootHandler.java
deleted file mode 100644
index 59619128e..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/GiveLootHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.concurrent.ThreadLocalRandom;
-
-import static com.magmaguy.elitemobs.items.CustomItemConstructor.customItemList;
-
-public class GiveLootHandler {
-
- public static void giveLootCommand(CommandSender commandSender, String[] args) {
-
- if (Bukkit.getServer().getPlayer(args[1]) != null) {
-
- Player receiver = Bukkit.getServer().getPlayer(args[1]);
-
- if (args[2].equalsIgnoreCase("random") || args[2].equalsIgnoreCase("r")) {
-
- int index = ThreadLocalRandom.current().nextInt(customItemList.size());
- ItemStack itemStack = new ItemStack(customItemList.get(index));
- receiver.getInventory().addItem(itemStack);
-
- } else
- GetLootCommandHandler.getLoot(receiver, args[2]);
-
- } else
- commandSender.sendMessage("Can't give loot to player - player not found.");
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java
new file mode 100644
index 000000000..7764a5f4b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/GuildRankCommands.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.adventurersguild.GuildRank;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+public class GuildRankCommands {
+ public static void setGuildRank(CommandSender commandSender, String playerString, int prestigeLevel, int activeLevel) {
+
+ Player player = Bukkit.getPlayer(playerString);
+ if (player == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4The player isn't online!"));
+ return;
+ }
+
+ if (activeLevel < 0 || activeLevel > 10 + prestigeLevel || prestigeLevel > 10 || activeLevel > 20) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4The prestige rank / guild rank combination you picked is not valid!"));
+ return;
+ }
+
+ GuildRank.setGuildPrestigeRank(player, prestigeLevel);
+ GuildRank.setMaxGuildRank(player, activeLevel);
+ GuildRank.setActiveGuildRank(player, activeLevel);
+
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2You set the EliteMobs rank of " +
+ playerString + " to " + GuildRank.getRankName(GuildRank.getGuildPrestigeRank(player), GuildRank.getActiveGuildRank(player))));
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java
new file mode 100644
index 000000000..c2b49187d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/HelpCommand.java
@@ -0,0 +1,33 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.CommandManager;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class HelpCommand extends AdvancedCommand {
+ public HelpCommand() {
+ super(List.of("help"));
+ setUsage("/em help");
+ setPermission("elitemobs.help");
+ setDescription("Lists all commands.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Logger.sendMessage(commandData.getCommandSender(), "Commands:");
+ for (CommandManager commandManager : CommandManager.getCommandManagers()) {
+ commandManager.commands.forEach(command -> {
+ if (commandData.getCommandSender() instanceof Player player) {
+ player.spigot().sendMessage(Logger.hoverMessage(command.getUsage(), command.getDescription()));
+ } else {
+ Logger.sendSimpleMessage(commandData.getCommandSender(), command.getUsage());
+ Logger.sendSimpleMessage(commandData.getCommandSender(), command.getDescription());
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java
new file mode 100644
index 000000000..70c740edd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillCommand.java
@@ -0,0 +1,21 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.List;
+
+public class KillCommand extends AdvancedCommand {
+ public KillCommand() {
+ super(List.of("kill"));
+ setUsage("/em kill");
+ setPermission("elitemobs.kill.command");
+ setDescription("Kills all elites.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.killAggressiveMobs(commandData.getCommandSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/KillHandler.java
deleted file mode 100644
index cc6fd731a..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/KillHandler.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.EliteMobs;
-import com.magmaguy.elitemobs.EntityTracker;
-import com.magmaguy.elitemobs.mobconstructor.EliteMobEntity;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-
-public class KillHandler {
-
- public static void killCommand(CommandSender commandSender, String[] args) {
-
- if (args.length < 2)
- commandSender.sendMessage("[EliteMobs] Incorrect command syntax. Try /em kill aggressive/passive/mobType [radius]");
-
- /*
- Run with no radius search
- */
- if (args.length == 2) {
- if (args[1].equalsIgnoreCase("aggressive"))
- killAggressiveMobs(commandSender);
- else if (args[1].equalsIgnoreCase("passive"))
- killPassiveMobs(commandSender);
- else
- killEntityType(commandSender, args);
- return;
- }
-
- /*
- Run radius search
- */
- if (args.length == 3) {
- if (args[1].equalsIgnoreCase("aggressive"))
- radiusKillAggressiveMobs(commandSender, args);
- else if (args[1].equalsIgnoreCase("passive"))
- radiusKillPassiveMobs(commandSender, args);
- else
- radiusKillSpecificMobs(commandSender, args);
- } else
- commandSender.sendMessage("[EliteMobs] Incorrect command syntax. Try /em kill aggressive/passive/mobType [radius]");
-
-
- }
-
- private static void killAggressiveMobs(CommandSender commandSender) {
-
- if (CommandHandler.permCheck(CommandHandler.KILLALL_AGGRESSIVEELITES, commandSender)) {
- int counter = 0;
-
- for (EliteMobEntity eliteMobEntity : EntityTracker.getEliteMobs()) {
- eliteMobEntity.getLivingEntity().remove();
- EntityTracker.unregisterEliteMob(eliteMobEntity);
- counter++;
- }
-
-
- commandSender.sendMessage("Killed " + counter + " Elite Mobs.");
-
- }
-
- }
-
- private static void killPassiveMobs(CommandSender commandSender) {
-
- if (CommandHandler.permCheck(CommandHandler.KILLALL_PASSIVEELITES, commandSender)) {
- int counter = 0;
- for (World world : EliteMobs.validWorldList)
- for (LivingEntity livingEntity : world.getLivingEntities())
- if (EntityTracker.isSuperMob(livingEntity)) {
- livingEntity.remove();
- counter++;
- }
-
- commandSender.sendMessage("Killed " + counter + " Elite Mobs.");
-
- }
- }
-
- private static void killEntityType(CommandSender commandSender, String[] args) {
-
- if (CommandHandler.permCheck(CommandHandler.KILLALL_SPECIFICENTITY, commandSender)) {
-
- try {
- EntityType entityType = EntityType.fromName(args[1].toUpperCase());
- int counter = 0;
- for (World world : EliteMobs.validWorldList)
- for (LivingEntity livingEntity : world.getLivingEntities())
- if (livingEntity.getType().equals(entityType) &&
- (EntityTracker.isEliteMob(livingEntity) ||
- EntityTracker.isSuperMob(livingEntity))) {
- livingEntity.remove();
- counter++;
- }
-
- commandSender.sendMessage("Killed " + counter + " Elite " + args[1] + ".");
-
- } catch (Exception e) {
- commandSender.sendMessage("[EliteMobs] Entity type is not valid!");
- }
-
- }
-
- }
-
- private static void radiusKillAggressiveMobs(CommandSender commandSender, String[] args) {
-
- if (!CommandHandler.userPermCheck(CommandHandler.KILLALL_AGGRESSIVEELITES, commandSender))
- return;
-
- try {
-
- int counter = 0;
- for (Entity entity : ((Player) commandSender).getNearbyEntities(Integer.parseInt(args[2]), Integer.parseInt(args[2]), Integer.parseInt(args[2])))
- if (EntityTracker.isEliteMob(entity)) {
- entity.remove();
- counter++;
- }
-
- commandSender.sendMessage("Killed " + counter + " Elite Mobs.");
-
- } catch (Exception e) {
- commandSender.sendMessage("[EliteMobs] Incorrect command syntax. Try /em kill aggressive/passive/mobType [radius]");
- }
-
- }
-
- private static void radiusKillPassiveMobs(CommandSender commandSender, String[] args) {
-
- if (!CommandHandler.userPermCheck(CommandHandler.KILLALL_PASSIVEELITES, commandSender))
- return;
-
- try {
- int counter = 0;
- for (Entity entity : ((Player) commandSender).getNearbyEntities(Integer.parseInt(args[2]), Integer.parseInt(args[2]), Integer.parseInt(args[2])))
- if (EntityTracker.isSuperMob(entity)) {
- entity.remove();
- counter++;
- }
- commandSender.sendMessage("Killed " + counter + " Elite Mobs.");
-
- } catch (Exception e) {
- commandSender.sendMessage("[EliteMobs] Incorrect command syntax. Try /em kill aggressive/passive/mobType [radius]");
- }
-
- }
-
- private static void radiusKillSpecificMobs(CommandSender commandSender, String[] args) {
-
- if (!CommandHandler.userPermCheck(CommandHandler.KILLALL_SPECIFICENTITY, commandSender))
- return;
-
- try {
-
- EntityType entityType = EntityType.fromName(args[1].toUpperCase());
-
- int counter = 0;
- for (Entity entity : ((Player) commandSender).getNearbyEntities(Integer.parseInt(args[2]), Integer.parseInt(args[2]), Integer.parseInt(args[2])))
- if (entity.getType().equals(entityType) &&
- (EntityTracker.isEliteMob(entity) ||
- EntityTracker.isSuperMob(entity))) {
- entity.remove();
- counter++;
- }
- commandSender.sendMessage("Killed " + counter + " Elite " + args[1] + ".");
-
- } catch (Exception e) {
- commandSender.sendMessage("[EliteMobs] Incorrect command syntax. Try /em kill aggressive/passive/mobType [radius]");
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java
new file mode 100644
index 000000000..978c494a7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillRadiusCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KillRadiusCommand extends AdvancedCommand {
+ public KillRadiusCommand() {
+ super(List.of("kill"));
+ addArgument("radius", new ArrayList<>());
+ setUsage("/em kill ");
+ setPermission("elitemobs.kill.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Kills all elites in the specified radius.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.radiusKillAggressiveMobs(commandData.getPlayerSender(), commandData.getIntegerArgument("radius"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java
new file mode 100644
index 000000000..03b0ffdc6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.entity.EntityType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KillTypeCommand extends AdvancedCommand {
+ public KillTypeCommand() {
+ super(List.of("kill"));
+ addLiteral("type");
+ addArgument("type", new ArrayList<>());
+ setUsage("/em kill type ");
+ setPermission("elitemobs.kill.command");
+ setDescription("Kills all elites of the specified type.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.killEntityType(commandData.getCommandSender(), EntityType.valueOf(commandData.getStringArgument("type")));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java
new file mode 100644
index 000000000..33cd0d2e8
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/KillTypeRadiusCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.KillHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.EntityType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KillTypeRadiusCommand extends AdvancedCommand {
+ public KillTypeRadiusCommand() {
+ super(List.of("kill"));
+ addLiteral("type");
+ addArgument("type", new ArrayList<>());
+ addArgument("range", new ArrayList<>());
+ setUsage("/em kill type ");
+ setPermission("elitemobs.kill.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Kills all elites of the specified type within the specified radius.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ KillHandler.radiusKillSpecificMobs(commandData.getPlayerSender(),
+ EntityType.valueOf(commandData.getStringArgument("type")),
+ commandData.getIntegerArgument("range"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java
new file mode 100644
index 000000000..57d0aee9a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LanguageCommand.java
@@ -0,0 +1,35 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.config.translations.TranslationsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LanguageCommand extends AdvancedCommand {
+ public LanguageCommand() {
+ super(List.of("language"));
+ List suggestions = new ArrayList<>(TranslationsConfig.getTranslationConfigs().keySet().stream().toList());
+ suggestions.add("english");
+ addArgument("language", suggestions);
+ setUsage("/em language ");
+ setPermission("elitemobs.language");
+ setDescription("Sets the language that the server will use for EliteMobs, based on a translation file in the translation files.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ String language = commandData.getStringArgument("language");
+ if (!TranslationsConfig.getTranslationConfigs().containsKey(language) && !language.equals("english")) {
+ Logger.sendMessage(commandData.getCommandSender(), "Language not found. Valid languages:");
+ TranslationsConfig.getTranslationConfigs().keySet().forEach(key -> Logger.sendMessage(commandData.getCommandSender(), key));
+ return;
+ }
+ DefaultConfig.setLanguage(commandData.getCommandSender(), language);
+ Logger.sendMessage(commandData.getCommandSender(), "&2Language set to " + language +
+ " ! &4Translations are created and manged for free by the community through Crowdin ( https://crowdin.com/project/elitemobs ), use at your own discretion!");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java
new file mode 100644
index 000000000..d1035a41f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.LootMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class LootCommand extends AdvancedCommand {
+ public LootCommand() {
+ super(List.of("loot"));
+ setUsage("/em loot");
+ setDescription("Open the loot menu for group loot.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ LootMenu.openMenu(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java
new file mode 100644
index 000000000..ada2a14e9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootDebugCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.GetTierCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootDebugCommand extends AdvancedCommand {
+ public LootDebugCommand() {
+ super(List.of("loot"));
+ addLiteral("debug");
+ addArgument("level", new ArrayList<>());
+ setUsage("/em loot debug ");
+ setPermission("elitemobs.loot.debug");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Equips players with a complete armor set, weapons set of the specified level, and food for testing purposes.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ GetTierCommand.get(commandData.getPlayerSender(), commandData.getIntegerArgument("level"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGUI.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGUI.java
deleted file mode 100644
index e43a8f8c7..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/LootGUI.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.items.CustomItemConstructor;
-import com.magmaguy.elitemobs.items.uniqueitems.UniqueItemInitializer;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.SkullMeta;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Created by MagmaGuy on 04/05/2017.
- */
-public class LootGUI implements Listener {
-
- private int currentHeaderPage = 1;
- private int currentLootPage = 1;
- private boolean filter = false;
- private int filterRank = 0;
-
- private List lootSlots = new ArrayList<>(Arrays.asList(10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31,
- 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 46, 47, 48, 49, 50, 51, 52));
-
- private String shopName = "EliteMobs Custom Loot";
-
- public void lootGUI(Player player) {
-
- Inventory fakeChestInventory = Bukkit.createInventory(null, 54, shopName);
- tierConstructor(fakeChestInventory);
- headerConstructor(fakeChestInventory);
- lootNavigationConstructor(fakeChestInventory);
- lootConstructor(fakeChestInventory);
-
- player.openInventory(fakeChestInventory);
-
- }
-
- private void headerConstructor(Inventory inventory) {
-
- ItemStack arrowLeft = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta arrowLeftSkullMeta = (SkullMeta) arrowLeft.getItemMeta();
- arrowLeftSkullMeta.setOwner("MHF_ArrowLeft");
- arrowLeftSkullMeta.setDisplayName("Previous Item Ranks");
- arrowLeft.setItemMeta(arrowLeftSkullMeta);
-
- inventory.setItem(0, arrowLeft);
-
-
- ItemStack arrowRight = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta arrowRightSkullMeta = (SkullMeta) arrowRight.getItemMeta();
- arrowRightSkullMeta.setOwner("MHF_ArrowRight");
- arrowRightSkullMeta.setDisplayName("Next Item Ranks");
- arrowRight.setItemMeta(arrowRightSkullMeta);
-
- inventory.setItem(8, arrowRight);
-
-
- ItemStack signature = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta signatureSkullMeta = (SkullMeta) signature.getItemMeta();
- signatureSkullMeta.setOwner("magmaguy");
- signatureSkullMeta.setDisplayName("EliteMobs by MagmaGuy");
- List signatureList = new ArrayList<>();
- signatureList.add("Support the plugins you enjoy!");
- signatureSkullMeta.setLore(signatureList);
- signature.setItemMeta(signatureSkullMeta);
-
- inventory.setItem(4, signature);
-
- }
-
- private void tierConstructor(Inventory inventory) {
-
- List tierSlots = new ArrayList<>();
-
- tierSlots.add(1);
- tierSlots.add(2);
- tierSlots.add(3);
- tierSlots.add(5);
- tierSlots.add(6);
- tierSlots.add(7);
-
- List keySet = new ArrayList<>(CustomItemConstructor.dynamicRankedItemStacks.keySet());
-
- int counter = 1;
-
- for (int number : tierSlots) {
-
- if (keySet.size() >= counter + ((currentHeaderPage - 1) * 6)) {
-
- ItemStack chest = new ItemStack(Material.CHEST, 1);
- ItemMeta chestItemMeta = chest.getItemMeta();
- chestItemMeta.setDisplayName("Tier " + keySet.get((counter - 1) + ((currentHeaderPage - 1) * 6)));
- List lore = new ArrayList();
- lore.add("Filter by items of this rank.");
- chestItemMeta.setLore(lore);
- chest.setItemMeta(chestItemMeta);
-
- inventory.setItem(number, chest);
-
- }
-
- counter++;
-
- }
-
- }
-
- private void lootNavigationConstructor(Inventory inventory) {
-
- ItemStack arrowLeft = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta arrowLeftSkullMeta = (SkullMeta) arrowLeft.getItemMeta();
- arrowLeftSkullMeta.setOwner("MHF_ArrowLeft");
- arrowLeftSkullMeta.setDisplayName("Previous Loot Page");
- arrowLeft.setItemMeta(arrowLeftSkullMeta);
-
- inventory.setItem(27, arrowLeft);
-
-
- ItemStack arrowRight = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta arrowRightSkullMeta = (SkullMeta) arrowRight.getItemMeta();
- arrowRightSkullMeta.setOwner("MHF_ArrowRight");
- arrowRightSkullMeta.setDisplayName("Next Loot Page");
- arrowRight.setItemMeta(arrowRightSkullMeta);
-
- inventory.setItem(35, arrowRight);
-
- }
-
- private void lootConstructor(Inventory inventory) {
-
- List getLootList = new ArrayList<>();
- for (List list : CustomItemConstructor.dynamicRankedItemStacks.values())
- getLootList.addAll(list);
-
- getLootList.addAll(CustomItemConstructor.staticCustomItemHashMap.keySet());
- getLootList.addAll(UniqueItemInitializer.uniqueItemsList);
-
- int counter = 1;
-
- for (int number : lootSlots) {
-
- if (!filter) {
-
- if (getLootList.size() >= counter + ((currentLootPage - 1) * 35)) {
-
- inventory.setItem(number, getLootList.get(counter - 1 + ((currentLootPage - 1) * 35)));
-
- }
-
- } else {
-
- List currentRankloot = CustomItemConstructor.dynamicRankedItemStacks.get(filterRank);
-
- if (currentRankloot.size() >= counter + ((currentLootPage - 1) * 35)) {
-
- inventory.setItem(number, currentRankloot.get(counter - 1 + ((currentLootPage - 1) * 35)));
-
- }
-
- }
-
- counter++;
-
- }
-
- }
-
- @EventHandler
- public void onClick(InventoryClickEvent event) {
-
- if (event.getInventory().getName().equalsIgnoreCase(shopName)) {
-
- if (event.getCurrentItem() == null || event.getCurrentItem().getType().equals(Material.AIR)) {
-
- event.setCancelled(true);
- return;
-
- }
-
- String itemDisplayName = event.getCurrentItem().getItemMeta().getDisplayName();
- Player player = (Player) event.getWhoClicked();
-
- if (itemDisplayName != null) {
-
- if (itemDisplayName.equals("Next Loot Page")) {
-
- currentLootPage++;
- lootGUI(player);
-
- } else if (itemDisplayName.equals("Previous Loot Page")) {
-
- if (currentLootPage > 1) {
-
- currentLootPage--;
- lootGUI(player);
-
- }
-
- } else if (itemDisplayName.equals("Next Item Ranks")) {
-
- currentHeaderPage++;
- lootGUI(player);
-
- } else if (itemDisplayName.equals("Previous Item Ranks")) {
-
- if (currentHeaderPage > 1) {
-
- currentHeaderPage--;
- lootGUI(player);
-
- }
-
- } else if (itemDisplayName.equals("EliteMobs by MagmaGuy")) {
-
- filter = false;
- currentLootPage = 1;
- lootGUI(player);
-
- } else if (event.getCurrentItem().getItemMeta().getLore().get(0).equals("Filter by items of this rank.")) {
-
- filter = true;
- String[] lore = itemDisplayName.split("\\s");
- filterRank = Integer.valueOf(lore[1]);
- currentLootPage = 1;
- lootGUI(player);
-
- }
-
- }
-
- if (lootSlots.contains(event.getSlot())) {
-
- player.getInventory().addItem(event.getCurrentItem());
-
- }
-
- event.setCancelled(true);
-
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java
new file mode 100644
index 000000000..5938e9cfb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootGiveCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.LootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootGiveCommand extends AdvancedCommand {
+ public LootGiveCommand() {
+ super(List.of("loot"));
+ addLiteral("give");
+ addArgument("filename", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("playerName", new ArrayList<>());
+ setUsage("/em loot give ");
+ setPermission("elitemobs.loot.admin");
+ setDescription("Gives the specified loot to a specific player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ LootCommand.give(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getStringArgument("filename"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java
new file mode 100644
index 000000000..9126a677b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootMenuCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.GetLootMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class LootMenuCommand extends AdvancedCommand {
+ public LootMenuCommand() {
+ super(List.of("loot"));
+ addLiteral("menu");
+ setUsage("/em loot menu");
+ setPermission("elitemobs.loot.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the loot menu.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new GetLootMenu(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java
new file mode 100644
index 000000000..60c979976
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootRandomCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.SimLootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootRandomCommand extends AdvancedCommand {
+ public LootRandomCommand() {
+ super(List.of("loot"));
+ addLiteral("random");
+ addArgument("level", new ArrayList<>());
+ addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em loot random ");
+ setPermission("elitemobs.loot.admin");
+ setDescription("Gives the player random loot of the specified level.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SimLootCommand.forcePositiveLoot(commandData.getCommandSender(), commandData.getStringArgument("playerName"), commandData.getIntegerArgument("level"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java
new file mode 100644
index 000000000..9dbd97527
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateCommand.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.SimLootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootSimulateCommand extends AdvancedCommand {
+ public LootSimulateCommand() {
+ super(List.of("loot"));
+ addLiteral("simulate");
+ addArgument("level", new ArrayList<>());
+ addArgument("playerName", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em loot simulate ");
+ setPermission("elitemobs.loot.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Simulates loot drops for the specified level and player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SimLootCommand.run(
+ commandData.getPlayerSender(),
+ commandData.getIntegerArgument("level"),
+ commandData.getStringArgument("playerName"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java
new file mode 100644
index 000000000..a38e117cb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootSimulateMultipleCommand.java
@@ -0,0 +1,33 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.SimLootCommand;
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LootSimulateMultipleCommand extends AdvancedCommand {
+ public LootSimulateMultipleCommand() {
+ super(List.of("loot"));
+ addLiteral("simulate");
+ addArgument("level", new ArrayList<>());
+ addArgument("times", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("playerName", new ArrayList<>());
+ setUsage("/em loot simulate ");
+ setPermission("elitemobs.loot.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Simulates loot drops for the specified amount of times for the specified level and player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SimLootCommand.runMultipleTimes(
+ commandData.getPlayerSender(),
+ commandData.getIntegerArgument("level"),
+ commandData.getIntegerArgument("times"),
+ commandData.getStringArgument("playerName"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java
new file mode 100644
index 000000000..9e81fb2f6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/LootStats.java
@@ -0,0 +1,38 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.api.utils.EliteItemManager;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.List;
+
+public class LootStats extends AdvancedCommand {
+ public LootStats() {
+ super(List.of("loot"));
+ addLiteral("stats");
+ setUsage("/em loot stats");
+ setPermission("elitemobs.loot.stats");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Provides EliteMobs stats for the currently held item.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Player player = commandData.getPlayerSender();
+ ItemStack item = player.getInventory().getItemInMainHand();
+ double attackSpeed = EliteItemManager.getAttackSpeed(item);
+ double damage = EliteItemManager.getBaseDamage(item);
+ double dps = EliteItemManager.getDPS(item);
+ double itemLevel = EliteItemManager.getWeaponLevel(item);
+ double bonusEDPS = EliteItemManager.getTotalDPS(item);
+ player.sendMessage("[EliteMobs] Item Stats:");
+ player.sendMessage("Item attack speed: " + attackSpeed);
+ player.sendMessage("Item damage: " + damage);
+ player.sendMessage("Item EDPS: " + dps);
+ player.sendMessage("Item level: " + itemLevel);
+ player.sendMessage("Item bonus EDPS: " + bonusEDPS);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java
new file mode 100644
index 000000000..176e7f042
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddAllCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyAddAllCommand extends AdvancedCommand {
+ public MoneyAddAllCommand() {
+ super(List.of("money"));
+ addLiteral("addAll");
+ addArgument("amount", new ArrayList<>());
+ setUsage("/em money addAll ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Gives every player on the server the specified amount of money.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.addAllCommand(
+ commandData.getCommandSender(),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java
new file mode 100644
index 000000000..e7089faa2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyAddCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyAddCommand extends AdvancedCommand {
+ public MoneyAddCommand() {
+ super(List.of("money"));
+ addLiteral("add");
+ addArgument("player", new ArrayList<>());
+ addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em money add ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Gives the specified amount of money to the designated player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.addCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java
new file mode 100644
index 000000000..14cee4268
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class MoneyCheckCommand extends AdvancedCommand {
+ public MoneyCheckCommand() {
+ super(List.of("money"));
+ addLiteral("check");
+ setUsage("/em money check");
+ setPermission("elitemobs.money.check.self");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Checks your EliteMobs currency.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (DefaultConfig.isOtherCommandsLeadToEMStatusMenu())
+ new PlayerStatusScreen(commandData.getPlayerSender());
+ else
+ CurrencyCommandsHandler.walletCommand(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java
new file mode 100644
index 000000000..a73f8def9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyCheckPlayerCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyCheckPlayerCommand extends AdvancedCommand {
+ public MoneyCheckPlayerCommand() {
+ super(List.of("money"));
+ addLiteral("check");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em money check ");
+ setPermission("elitemobs.money.check.others");
+ setDescription("Checks the currency of the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.checkCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("player"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java
new file mode 100644
index 000000000..3bb188cd2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneyRemoveCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneyRemoveCommand extends AdvancedCommand {
+ public MoneyRemoveCommand() {
+ super(List.of("money"));
+ addLiteral("remove");
+ addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em money remove ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Deducts the specified amount of currency from a player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.subtractCommand(
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java
new file mode 100644
index 000000000..5a1c9802d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/MoneySetCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customitems.CustomItemsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MoneySetCommand extends AdvancedCommand {
+ public MoneySetCommand() {
+ super(List.of("money"));
+ addLiteral("set");
+ addArgument("player", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ addArgument("amount", new ArrayList<>(CustomItemsConfig.getCustomItems().keySet()));
+ setUsage("/em money set ");
+ setPermission("elitemobs.money.admin");
+ setDescription("Sets the specified amount of currency for the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.setCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java
new file mode 100644
index 000000000..4a9c8131e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageCommand.java
@@ -0,0 +1,109 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Logger;
+import com.magmaguy.magmacore.util.ZipFile;
+import org.bukkit.command.CommandSender;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+
+public class PackageCommand {
+ CommandSender commandSender;
+ String dungeonFolderName;
+
+ public PackageCommand(CommandSender commandSender, String dungeonFolderName, String versionNumber) {
+ this.commandSender = commandSender;
+ if (dungeonFolderName == null || dungeonFolderName.isEmpty()) {
+ commandSender.sendMessage("[EliteMobs] This commands needs a valid dungeon name!");
+ return;
+ }
+ int version = 0;
+ try {
+ version = Integer.parseInt(versionNumber);
+ } catch (Exception exception) {
+ commandSender.sendMessage("This command needs a valid natural number! (1, 2, 3, 4...)");
+ return;
+ }
+
+ this.dungeonFolderName = dungeonFolderName;
+ clearPreviousContents();
+ packContents("custombosses");
+ packContents("customevents");
+ packContents("npcs");
+ packContents("customitems");
+ packContents("customquests");
+ packContents("customarenas");
+ packContents("customspawns");
+ packContents("customtreasurechests");
+ packContents("wormholes");
+ packContents("world_blueprints");
+ packContents("powers");
+
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Done! You can find your package in &9~/plugins/EliteMobs/exports &2. &6If you are making a dungeon, make sure to create your own dungeonpackages file!"));
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &6Don't forget to add your world and schematic files to the package if needed!"));
+
+ try {
+ ZipFile.ZipUtility.zip(new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + "exports" + File.separatorChar + dungeonFolderName),
+ MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + "exports" + File.separatorChar + dungeonFolderName + "_packaged.zip");
+ } catch (Exception exception) {
+ commandSender.sendMessage(ChatColorConverter.convert("4&[EliteMobs] Failed to zip package!"));
+ }
+
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &6Zipped files for your convenience. Don't forget any additional files like the dungeonpackager or world/schematics files before distributing!"));
+ }
+
+ private void clearPreviousContents() {
+ File targetFolder = new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + "exports" + File.separatorChar + dungeonFolderName);
+ if (targetFolder.exists()) delete(targetFolder.toPath());
+ if (new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + "exports" + File.separatorChar + dungeonFolderName + "_packaged.zip").exists())
+ delete(Path.of(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + "exports" + File.separatorChar + dungeonFolderName + "_packaged.zip"));
+ }
+
+ private void delete(Path path) {
+ for (File file : path.toFile().listFiles()) {
+ if (file.isDirectory()) delete(file.toPath());
+ else file.delete();
+ }
+ }
+
+ private void packContents(String subdirectory) {
+ Path path = Path.of(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + subdirectory + File.separatorChar + dungeonFolderName);
+
+ if (!Files.exists(path) || !Files.isDirectory(path)) {
+ commandSender.sendMessage("[EliteMobs] Could not find any " + subdirectory + " for this dungeon. This might be normal depending on your setup.");
+ return;
+ }
+ File sourceFolder = new File(path.toString());
+ File targetFolder = new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + File.separatorChar + "exports" + File.separatorChar + dungeonFolderName + File.separatorChar + subdirectory + File.separatorChar + dungeonFolderName);
+ if (!targetFolder.exists()) {
+ try {
+ targetFolder.mkdirs();
+ targetFolder.mkdir();
+ } catch (Exception ex) {
+ commandSender.sendMessage("[EliteMobs] Failed to create directory " + targetFolder.getPath());
+ ex.printStackTrace();
+ return;
+ }
+ }
+ for (File file : sourceFolder.listFiles())
+ recursivelyGetFiles(file, targetFolder);
+ }
+
+ private void recursivelyGetFiles(File scannedFile, File destination) {
+ try {
+ if (scannedFile.isDirectory()) {
+ File newDestination = new File(destination.getAbsolutePath() + File.separatorChar + scannedFile.getName());
+ newDestination.mkdir();
+ for (File file : scannedFile.listFiles())
+ recursivelyGetFiles(file, newDestination);
+ } else
+ Files.copy(scannedFile.toPath(), Path.of(destination.getAbsolutePath() + File.separatorChar + scannedFile.getName()), StandardCopyOption.REPLACE_EXISTING);
+ } catch (Exception exception) {
+ Logger.warn("Failed to recursively pack dungeon!");
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java
new file mode 100644
index 000000000..1e867ea92
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PackageDungeonCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PackageDungeonCommand extends AdvancedCommand {
+ public PackageDungeonCommand() {
+ super(List.of("package"));
+ addArgument("dungeonName", new ArrayList<>());
+ addArgument("version", new ArrayList<>());
+ setUsage("/em package ");
+ setPermission("elitemobs.package");
+ setDescription("Packages an EliteMobs dungeon for distribution.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new PackageCommand(commandData.getCommandSender(),
+ commandData.getStringArgument("dungeonName"),
+ commandData.getStringArgument("version"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java
new file mode 100644
index 000000000..fdd48e0a0
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PayCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PayCommand extends AdvancedCommand {
+ public PayCommand() {
+ super(List.of("pay"));
+ addArgument("player", new ArrayList<>());
+ addArgument("amount", new ArrayList<>());
+ setDescription("Send money to a player, minus tax.");
+ setUsage("/em pay ");
+ setPermission("elitemobs.money.pay");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CurrencyCommandsHandler.payCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("player"),
+ commandData.getDoubleArgument("amount"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java
new file mode 100644
index 000000000..2a65ae715
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceBossCommand.java
@@ -0,0 +1,32 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class PlaceBossCommand extends AdvancedCommand {
+ public PlaceBossCommand() {
+ super(List.of("place"));
+ addLiteral("boss");
+ List regionalBosses = new ArrayList<>();
+ for (Map.Entry entry : CustomBossesConfig.getCustomBosses().entrySet())
+ if (entry.getValue().isRegionalBoss())
+ regionalBosses.add(entry.getKey());
+ addArgument("filename", regionalBosses);
+ setUsage("/em place boss ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Add a spawn location for the specified boss at your current location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CustomBossCommandHandler.addSpawnLocation(commandData.getStringArgument("filename"), commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java
new file mode 100644
index 000000000..c1f31c9cd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceNPCCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.admin.NPCCommands;
+import com.magmaguy.elitemobs.config.npcs.NPCsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlaceNPCCommand extends AdvancedCommand {
+ public PlaceNPCCommand() {
+ super(List.of("place"));
+ addLiteral("npc");
+ addArgument("filename", new ArrayList<>(NPCsConfig.npcEntities.keySet()));
+ setUsage("/em place npc ");
+ setPermission("elitemobs.place.npc");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Permanently adds an npc to the location the user is standing on.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ NPCCommands.set(commandData.getPlayerSender(), commandData.getStringArgument("filename"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java
new file mode 100644
index 000000000..b47ae3621
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceTreasureChestCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlaceTreasureChestCommand extends AdvancedCommand {
+ public PlaceTreasureChestCommand() {
+ super(List.of("place"));
+ addLiteral("treasureChest");
+ addArgument("filename", new ArrayList<>(CustomTreasureChestsConfig.getCustomTreasureChestConfigFields().keySet()));
+ setUsage("/em place treasureChest ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Permanently adds a treasure chest to the location the user is standing on.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ CustomTreasureChestsConfig.addTreasureChestEntry(commandData.getPlayerSender(), commandData.getStringArgument("filename"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java
new file mode 100644
index 000000000..04cb8aa06
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/PlaceWormholeCommand.java
@@ -0,0 +1,42 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.wormholes.WormholeConfig;
+import com.magmaguy.elitemobs.wormhole.Wormhole;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PlaceWormholeCommand extends AdvancedCommand {
+ public PlaceWormholeCommand() {
+ super(List.of("place"));
+ addLiteral("wormhole");
+ addArgument("filename", new ArrayList<>(WormholeConfig.getWormholes().keySet()));
+ addArgument("wormholeOption", List.of(1, 2));
+ setUsage("/em place wormhole <1/2>");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Place a wormhole teleport at your current location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ for (Wormhole wormhole : Wormhole.getWormholes()) {
+ if (wormhole.getWormholeConfigFields().getFilename().equals(commandData.getStringArgument("filename")))
+ switch (commandData.getStringArgument("wormholeOption")) {
+ case "1":
+ wormhole.getWormholeEntry1().updateLocation(commandData.getPlayerSender());
+ return;
+ case "2":
+ wormhole.getWormholeEntry2().updateLocation(commandData.getPlayerSender());
+ return;
+ default:
+ Logger.sendMessage(commandData.getCommandSender(), "Not a valid wormhole option! Pick 1 or 2 to set either end of the wormhole.");
+ }
+ }
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to set location for this wormhole.");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java
new file mode 100644
index 000000000..89e65f2ed
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ProtectionBypassCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.dungeons.DungeonProtector;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class ProtectionBypassCommand extends AdvancedCommand {
+ public ProtectionBypassCommand() {
+ super(List.of("protection"));
+ addLiteral("bypass");
+ setPermission("elitemobs.protection.bypass");
+ setDescription("Allows admins to toggle bypassing protections");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ boolean outcome = DungeonProtector.toggleBypass(commandData.getPlayerSender().getUniqueId());
+ Logger.sendMessage(commandData.getCommandSender(), "Bypassing dungeon protections is now " + outcome);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java
new file mode 100644
index 000000000..e5526ea69
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestAcceptCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestAcceptCommand extends AdvancedCommand {
+ public QuestAcceptCommand() {
+ super(List.of("quest"));
+ addLiteral("accept");
+ addArgument("questID", new ArrayList<>());
+ setUsage("/em quest accept ");
+ setPermission("elitemobs.quest.accept");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Accepts a quest. Used via menu, can't be directly used.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.joinQuest(commandData.getStringArgument("questID"), commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java
new file mode 100644
index 000000000..83619bbae
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestBypassCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class QuestBypassCommand extends AdvancedCommand {
+ public QuestBypassCommand() {
+ super(List.of("quest"));
+ addLiteral("bypass");
+ setUsage("/em quest bypass");
+ setPermission("elitemobs.quest.bypass");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Bypasses permission restrictions for elite quests.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.bypassQuestRequirements(commandData.getPlayerSender());
+ if (PlayerQuestCooldowns.bypassesQuestRestrictions(commandData.getPlayerSender()))
+ Logger.sendMessage(commandData.getCommandSender(), "Now bypassing quest permission requirements!");
+ else
+ Logger.sendMessage(commandData.getCommandSender(), "No longer bypassing quest permission requirements!");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java
new file mode 100644
index 000000000..232fb266a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class QuestCompleteCommand extends AdvancedCommand {
+ public QuestCompleteCommand() {
+ super(List.of("quest"));
+ addLiteral("complete");
+ setUsage("/em quest complete");
+ setPermission("elitemobs.quest.complete.force");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Forces all of your currently active elite quests to be completed. For debugging use only.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.completeQuest(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java
new file mode 100644
index 000000000..be7f31614
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestCompleteQuestCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestCompleteQuestCommand extends AdvancedCommand {
+ public QuestCompleteQuestCommand() {
+ super(List.of("quest"));
+ addLiteral("complete");
+ addArgument("id", new ArrayList<>());
+ setUsage("/em quest complete");
+ setPermission("elitemobs.quest.complete");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Completes a quest for a player. Meant to be used via menu, not directly.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.completeQuest(commandData.getStringArgument("id"), commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java
new file mode 100644
index 000000000..3472647ca
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestLeaveCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestLeaveCommand extends AdvancedCommand {
+ public QuestLeaveCommand() {
+ super(List.of("quest"));
+ addLiteral("leave");
+ addArgument("questID", new ArrayList<>());
+ setUsage("/em quest leave");
+ setPermission("elitemobs.quest.leave");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Leaves a quest. Used via menu, can't be directly used.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.leaveQuest(commandData.getPlayerSender(), commandData.getStringArgument("questID"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java
new file mode 100644
index 000000000..18b968908
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetAllCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestResetAllCommand extends AdvancedCommand {
+ public QuestResetAllCommand() {
+ super(List.of("quest"));
+ addLiteral("resetAll");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em quest resetAll ");
+ setPermission("elitemobs.quest.reset.all");
+ setDescription("Resets all quests for a specific player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.resetQuests(commandData.getCommandSender(), commandData.getStringArgument("player"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java
new file mode 100644
index 000000000..f57951bbd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestResetCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestResetCommand extends AdvancedCommand {
+ public QuestResetCommand() {
+ super(List.of("quest"));
+ addLiteral("reset");
+ addArgument("player", new ArrayList<>());
+ addArgument("questName", new ArrayList<>(CustomQuestsConfig.getCustomQuests().keySet()));
+ setUsage("/em quest reset ");
+ setPermission("elitemobs.quest.reset");
+ setDescription("Resets a specific quest for a specific player.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.resetQuest(commandData.getCommandSender(), commandData.getStringArgument("player"), commandData.getStringArgument("questName"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java
new file mode 100644
index 000000000..207a34243
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuestTrackCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.quests.QuestCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestTrackCommand extends AdvancedCommand {
+ public QuestTrackCommand() {
+ super(List.of("quest"));
+ addLiteral("track");
+ addArgument("questID", new ArrayList<>());
+ setUsage("/em quest track ");
+ setPermission("elitemobs.quest.track");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Tracks a quest. Used via menu, can't be directly used.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ QuestCommand.trackQuest(commandData.getStringArgument("questID"), commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java
new file mode 100644
index 000000000..148b2b2bf
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/QuitCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class QuitCommand extends AdvancedCommand {
+ public QuitCommand() {
+ super(List.of("quit"));
+ setDescription("When in instanced content, makes the player leave the instance.");
+ setUsage("/em quit");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ MatchInstance matchInstance = MatchInstance.getAnyPlayerInstance(commandData.getPlayerSender());
+ if (matchInstance != null)
+ matchInstance.removeAnyKind(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java
new file mode 100644
index 000000000..b85485726
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RankCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class RankCommand extends AdvancedCommand {
+ public RankCommand() {
+ super(List.of("rank"));
+ setUsage("/em rank");
+ setDescription("Opens the EliteMobs rank menu or teleports you to the Adventurer's Guild.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ AdventurersGuildCommand.adventurersGuildCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java
new file mode 100644
index 000000000..b4730d04b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RankSetCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RankSetCommand extends AdvancedCommand {
+ public RankSetCommand() {
+ super(List.of("rank"));
+ addArgument("player", new ArrayList<>());
+ addArgument("prestigeLevel", new ArrayList<>());
+ addArgument("guildLevel", new ArrayList<>());
+ setUsage("/em rank ");
+ setPermission("elitemobs.rank.set");
+ setDescription("Manually sets a player's guild rank to a the prestige level and guild level specified.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ GuildRankCommands.setGuildRank(commandData.getCommandSender(),
+ commandData.getStringArgument("player"),
+ commandData.getIntegerArgument("prestigeLevel"),
+ commandData.getIntegerArgument("guildLevel"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java
new file mode 100644
index 000000000..efc3774b9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ReloadCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.command.CommandSender;
+
+import java.util.List;
+
+public class ReloadCommand extends AdvancedCommand {
+ public ReloadCommand() {
+ super(List.of("reload"));
+ setUsage("/em reload");
+ setPermission("elitemobs.reload");
+ setDescription("Reloads EliteMobs.");
+ }
+
+ public static void reload(CommandSender commandSender) {
+ MetadataHandler.PLUGIN.onDisable();
+ MetadataHandler.PLUGIN.onLoad();
+ MetadataHandler.PLUGIN.onEnable();
+ Logger.sendMessage(commandSender, "Plugin reloaded!");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ reload(commandData.getCommandSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadConfigCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadConfigCommandHandler.java
deleted file mode 100644
index af9977664..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadConfigCommandHandler.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.items.CustomItemConstructor;
-import org.bukkit.Bukkit;
-
-/**
- * Created by MagmaGuy on 13/05/2017.
- */
-public class ReloadConfigCommandHandler {
-
- public void reloadConfiguration() {
-
- //Reload all configs
- ConfigValues.initializeCachedConfigurations();
-
- //reload config-based initialized data
- CustomItemConstructor customItemConstructor = new CustomItemConstructor();
- customItemConstructor.superDropParser();
-
- Bukkit.getLogger().info("EliteMobs config reloaded!");
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ReloadHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/ReloadHandler.java
deleted file mode 100644
index 77d208483..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/ReloadHandler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.items.CustomItemConstructor;
-import com.magmaguy.elitemobs.items.uniqueitems.UniqueItemInitializer;
-import org.bukkit.command.CommandSender;
-
-public class ReloadHandler {
-
- public static void reloadCommand(CommandSender commandSender, String[] args) {
-
- ConfigValues.initializeCachedConfigurations();
- CustomItemConstructor.customItemList.clear();
- CustomItemConstructor.staticCustomItemHashMap.clear();
- CustomItemConstructor.dynamicRankedItemStacks.clear();
- UniqueItemInitializer.uniqueItemsList.clear();
- CustomItemConstructor customItemConstructor = new CustomItemConstructor();
- customItemConstructor.superDropParser();
-// UniqueItemConstructor uniqueItemConstructor = new UniqueItemConstructor();
-// uniqueItemConstructor.intializeUniqueItems();
- UniqueItemInitializer.initialize();
- commandSender.sendMessage("EliteMobs reloaded!");
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java
new file mode 100644
index 000000000..2110beb14
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RemoveCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class RemoveCommand extends AdvancedCommand {
+ public RemoveCommand() {
+ super(List.of("remove"));
+ setUsage("/em remove");
+ setPermission("elitemobs.remove");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Toggle removal mode for EliteMobs, which can permanently remove any EliteMobs-related content.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.admin.RemoveCommand.remove(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java
new file mode 100644
index 000000000..a1d6adeab
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RepairCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.RepairMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class RepairCommand extends AdvancedCommand {
+ public RepairCommand() {
+ super(List.of("repair"));
+ setUsage("/em repair");
+ setPermission("elitemobs.repair.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the repair item menu or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) {
+ RepairMenu repairMenu = new RepairMenu();
+ repairMenu.constructRepairMenu(commandData.getPlayerSender());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java
new file mode 100644
index 000000000..63766ad2d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/RespawnAllCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+
+import java.util.List;
+
+public class RespawnAllCommand extends AdvancedCommand {
+ public RespawnAllCommand() {
+ super(List.of("respawn"));
+ addLiteral("all");
+ setUsage("/em respawn all");
+ setPermission("elitemobs.respawn.force");
+ setDescription("Forces all regional bosses to respawn.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ RegionalBossEntity.getRegionalBossEntities().forEach(regionalBossEntity -> {
+ if (regionalBossEntity.isRespawning()) regionalBossEntity.forceRespawn();
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java
new file mode 100644
index 000000000..534216f7e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ScrapCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.ScrapperMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ScrapCommand extends AdvancedCommand {
+ public ScrapCommand() {
+ super(List.of("scrap"));
+ setUsage("/em scrap");
+ setPermission("elitemobs.scrap.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the scrap menu or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) {
+ ScrapperMenu scrapperMenu = new ScrapperMenu();
+ scrapperMenu.constructScrapMenu(commandData.getPlayerSender());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetMaxItemTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetMaxItemTierCommand.java
deleted file mode 100644
index 9d84fdb8c..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/SetMaxItemTierCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import com.magmaguy.elitemobs.config.*;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.Configuration;
-
-public class SetMaxItemTierCommand {
-
- public static void setMaxItemTier(double tier, CommandSender commandSender) {
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- Configuration itemsDropSettingsConfig = customConfigLoader.getCustomConfig(ItemsDropSettingsConfig.CONFIG_NAME);
-
- itemsDropSettingsConfig.set(ItemsDropSettingsConfig.MAXIMUM_LOOT_TIER, tier);
- customConfigLoader.saveCustomConfig(ItemsDropSettingsConfig.CONFIG_NAME);
-
- CustomConfigLoader customConfigLoader1 = new CustomConfigLoader();
- Configuration itemsProceduralSettingsConfig = customConfigLoader1.getCustomConfig(ItemsProceduralSettingsConfig.CONFIG_NAME);
-
- itemsProceduralSettingsConfig.set(ItemsProceduralSettingsConfig.ARROW_DAMAGE_MAX_LEVEL, tier-1);
- itemsProceduralSettingsConfig.set(ItemsProceduralSettingsConfig.DAMAGE_ALL_MAX_LEVEL, tier-1);
- itemsProceduralSettingsConfig.set(ItemsProceduralSettingsConfig.PROTECTION_ENVIRONMENTAL_MAX_LEVEL, tier-1);
- customConfigLoader1.saveCustomConfig(ItemsProceduralSettingsConfig.CONFIG_NAME);
-
-
- int maxMobLevel = (int) (tier * ConfigValues.mobCombatSettingsConfig.getDouble(MobCombatSettingsConfig.PER_TIER_LEVEL_INCREASE) * 10);
-
- CustomConfigLoader customConfigLoader2 = new CustomConfigLoader();
- Configuration mobCombatSettingsConfig = customConfigLoader2.getCustomConfig(MobCombatSettingsConfig.CONFIG_NAME);
- mobCombatSettingsConfig.set(MobCombatSettingsConfig.NATURAL_ELITEMOB_LEVEL_CAP, maxMobLevel);
- customConfigLoader2.saveCustomConfig(MobCombatSettingsConfig.CONFIG_NAME);
-
- ConfigValues.initializeCachedConfigurations();
-
- commandSender.sendMessage(ChatColorConverter.convert(
- "Warning: You have set the max tier to " + tier + "!"));
- commandSender.sendMessage(ChatColorConverter.convert(
- "The max protection enchantment has been increased to " + (tier - 1)));
- commandSender.sendMessage(ChatColorConverter.convert(
- "The max sharpness enchantment has been increased to " + (tier- 1)));
- commandSender.sendMessage(ChatColorConverter.convert(
- "The max power enchantment has been increased to " + (tier - 1)));
- commandSender.sendMessage(ChatColorConverter.convert(
- "The max mob level has been increased to " + maxMobLevel));
- commandSender.sendMessage(ChatColorConverter.convert(
- "You can run this command again to tweak the values or change them in the ItemProceduralSettings.yml file," +
- " as well as the ItemsDropSettings and the MobCombatSettings"));
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java
new file mode 100644
index 000000000..743545e32
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.setup.SetupMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class SetupCommand extends AdvancedCommand {
+ public SetupCommand() {
+ super(List.of("setup"));
+ setPermission("elitemobs.setup");
+ setSenderType(SenderType.PLAYER);
+ setDescription("The main command for setting up EliteMobs!");
+ setUsage("/em setup");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ new SetupMenu(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java
new file mode 100644
index 000000000..c94084e30
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupDoneCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class SetupDoneCommand extends AdvancedCommand {
+ public SetupDoneCommand() {
+ super(List.of("setup"));
+ addLiteral("done");
+ setUsage("/em setup done");
+ setPermission("elitemobs.setup");
+ setDescription("Toggles whether the setup message will show up.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ DefaultConfig.toggleSetupDone();
+ if (DefaultConfig.isSetupDone())
+ Logger.sendMessage(commandData.getCommandSender(), "&aEliteMobs will no longer send messages on login. You can do [/em setup done] again to revert this.");
+ else
+ Logger.sendMessage(commandData.getCommandSender(), "&aEliteMobs will once again send messages on login. You can do [/em setup done] again to revert this.");
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java
new file mode 100644
index 000000000..89082a29f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SetupToggleCommand.java
@@ -0,0 +1,35 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SetupToggleCommand extends AdvancedCommand {
+ public SetupToggleCommand() {
+ super(List.of("setup"));
+ addLiteral("toggle");
+ addArgument("empackages", EMPackage.getEmPackages().values().stream().map(emPackage -> emPackage.getDungeonPackagerConfigFields().getFilename()).collect(Collectors.toUnmodifiableList()));
+ setUsage("/em setup toggle ");
+ setPermission("elitemobs.setup");
+ setDescription("Allows you to toggle the installation of specified EliteMobs content.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ String dungeon = commandData.getStringArgument("empackages");
+ if (dungeon.isEmpty() || EMPackage.getEmPackages().get(dungeon) == null)
+ Logger.sendMessage(commandData.getCommandSender(), "Not a valid em package!");
+ EMPackage emPackage = EMPackage.getEmPackages().get(dungeon);
+ if (emPackage.install()) {
+ if (emPackage.isInstalled())
+ Logger.sendMessage(commandData.getCommandSender(), "Successfully installed content!");
+ else
+ Logger.sendMessage(commandData.getCommandSender(), "Successfully uninstalled content!");
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java
new file mode 100644
index 000000000..46b26dea2
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShareItemCommand.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.items.ShareItem;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ShareItemCommand extends AdvancedCommand {
+ public ShareItemCommand() {
+ super(List.of("shareItem"));
+ setUsage("/em shareItem");
+ setPermission("elitemobs.shareitem");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Shares the stats of the currently held EliteMobs item in chat.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ ShareItem.showOnChat(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java
new file mode 100644
index 000000000..51d1ee9db
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.CustomShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ShopCustomCommand extends AdvancedCommand {
+ public ShopCustomCommand() {
+ super(List.of("shop"));
+ addLiteral("custom");
+ setUsage("/em shop custom");
+ setPermission("elitemobs.shop.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ CustomShopMenu.customShopInitializer(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java
new file mode 100644
index 000000000..2d005cc46
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopCustomOtherCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.CustomShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopCustomOtherCommand extends AdvancedCommand {
+ public ShopCustomOtherCommand() {
+ super(List.of("shop"));
+ addLiteral("custom");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em shop custom ");
+ setPermission("elitemobs.shop.custom.other");
+ setDescription("Opens the EliteMobs shop for custom items for the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ try {
+ CustomShopMenu.customShopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player")));
+ } catch (Exception ex) {
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java
new file mode 100644
index 000000000..a4c047071
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopDynamicCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class ShopDynamicCommand extends AdvancedCommand {
+ public ShopDynamicCommand() {
+ super(List.of("shop"));
+ addLiteral("dynamic");
+ setUsage("/em shop dynamic");
+ setPermission("elitemobs.shop.dynamic");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the procedurally generated item shop or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender()))
+ ProceduralShopMenu.shopInitializer(commandData.getPlayerSender());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java
new file mode 100644
index 000000000..5984710df
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopProceduralOtherCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.ProceduralShopMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopProceduralOtherCommand extends AdvancedCommand {
+ public ShopProceduralOtherCommand() {
+ super(List.of("shop"));
+ addLiteral("procedural");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em shop procedural ");
+ setPermission("elitemobs.*");
+ setDescription("Opens the EliteMobs shop for procedurally generated items.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ try {
+ ProceduralShopMenu.shopConstructor(Bukkit.getPlayer(commandData.getStringArgument("player")));
+ } catch (Exception ex) {
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java
new file mode 100644
index 000000000..f4af0c02d
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/ShopSellOtherCommand.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.menus.SellMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShopSellOtherCommand extends AdvancedCommand {
+ public ShopSellOtherCommand() {
+ super(List.of("shop"));
+ addLiteral("sell");
+ addArgument("player", new ArrayList<>());
+ setUsage("/em shop sell ");
+ setPermission("elitemobs.shop.sell.other");
+ setDescription("Opens the EliteMobs shop sell menu for the specified player.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SellMenu sellMenu = new SellMenu();
+ try {
+ sellMenu.constructSellMenu(Bukkit.getPlayer(commandData.getStringArgument("player")));
+ } catch (Exception ex) {
+ Logger.sendMessage(commandData.getCommandSender(), "Failed to get player with that username!");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SimLootHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SimLootHandler.java
deleted file mode 100644
index 62ae75a82..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/SimLootHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-
-import org.bukkit.entity.Player;
-
-/**
- * Created by MagmaGuy on 08/06/2017.
- */
-public class SimLootHandler {
-
- public static void simLoot(Player player, int level) {
-
-// if (level < 1)
-// level = 0;
-//
-// LootTables.generateLoot(player);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java
new file mode 100644
index 000000000..8f2871d95
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossAtCommand.java
@@ -0,0 +1,39 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.Bukkit;
+import org.bukkit.generator.WorldInfo;
+import org.bukkit.util.Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SpawnBossAtCommand extends AdvancedCommand {
+ public SpawnBossAtCommand() {
+ super(List.of("spawn"));
+ addLiteral("bossAt");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ addArgument("worldName", Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toList()));
+ addArgument("x", new ArrayList<>());
+ addArgument("y", new ArrayList<>());
+ addArgument("z", new ArrayList<>());
+ setUsage("/em spawn bossAt ");
+ setPermission("elitemobs.place.admin");
+ setDescription("Spawns a custom boss at the specified location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("worldName"),
+ new Vector(
+ commandData.getDoubleArgument("x"),
+ commandData.getDoubleArgument("y"),
+ commandData.getDoubleArgument("z")));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java
new file mode 100644
index 000000000..2deb74068
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SpawnBossCommand extends AdvancedCommand {
+ public SpawnBossCommand() {
+ super(List.of("spawn"));
+ addLiteral("boss");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ setUsage("/em spawn boss ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Spawns a custom boss at the location the user is looking at.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java
new file mode 100644
index 000000000..1fe0eecfc
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelAtCommand.java
@@ -0,0 +1,41 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import org.bukkit.Bukkit;
+import org.bukkit.generator.WorldInfo;
+import org.bukkit.util.Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class SpawnBossLevelAtCommand extends AdvancedCommand {
+ public SpawnBossLevelAtCommand() {
+ super(List.of("spawn"));
+ addLiteral("bossAt");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ addArgument("worldName", Bukkit.getWorlds().stream().map(WorldInfo::getName).collect(Collectors.toList()));
+ addArgument("x", new ArrayList<>());
+ addArgument("y", new ArrayList<>());
+ addArgument("z", new ArrayList<>());
+ addArgument("level", new ArrayList<>());
+ setUsage("/em spawn bossAt ");
+ setPermission("elitemobs.place.admin");
+ setDescription("Spawns a custom boss at the specified location with the specified level.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getCommandSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("worldName"),
+ new Vector(
+ commandData.getDoubleArgument("x"),
+ commandData.getDoubleArgument("y"),
+ commandData.getDoubleArgument("z")),
+ commandData.getIntegerArgument("level"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java
new file mode 100644
index 000000000..cb6a6515e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnBossLevelCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SpawnBossLevelCommand extends AdvancedCommand {
+ public SpawnBossLevelCommand() {
+ super(List.of("spawn"));
+ addLiteral("boss");
+ addArgument("filename", new ArrayList<>(CustomBossesConfig.getCustomBosses().keySet()));
+ addArgument("level", List.of("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"));
+ setUsage("/em spawn boss ");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Spawns a custom boss at the location the user is looking at with the specified level.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnCustomBossCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getIntegerArgument("level"));
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java
new file mode 100644
index 000000000..322e88eeb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnCommand.java
@@ -0,0 +1,175 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.CustomConfigFields;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields;
+import com.magmaguy.elitemobs.config.powers.PowersConfig;
+import com.magmaguy.elitemobs.config.powers.PowersConfigFields;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
+import com.magmaguy.elitemobs.powers.meta.ElitePower;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.util.Vector;
+
+import java.util.HashSet;
+import java.util.Optional;
+
+/**
+ * Created by MagmaGuy on 01/05/2017.
+ */
+public class SpawnCommand {
+
+ public static void spawnEliteEntityTypeCommand(Player player, EntityType entityType, Integer level, Optional powers) {
+ LivingEntity livingEntity = (LivingEntity) player.getLocation().getWorld().spawnEntity(getLocation(player), entityType);
+ EliteEntity eliteEntity = new EliteEntity();
+ eliteEntity.setLevel(level);
+
+ if (powers.isPresent()) {
+ String[] powersArray = powers.get().split(" ");
+ HashSet mobPowers = getPowers(powersArray, player);
+ eliteEntity.applyPowers(mobPowers);
+ } else {
+ eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity));
+ }
+ eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
+ }
+
+ public static void spawnEliteEntityTypeCommand(CommandSender commandSender,
+ EntityType entityType,
+ String world,
+ Vector coords,
+ Integer level,
+ Optional powers) {
+ try {
+ Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ());
+ spawnEliteEntityTypeCommand(commandSender,
+ location,
+ entityType,
+ level,
+ powers);
+ } catch (Exception e) {
+ commandSender.sendMessage("[EliteMobs] World argument was not valid!");
+ }
+ }
+
+ public static void spawnEliteEntityTypeCommand(CommandSender commandSender,
+ Location location,
+ EntityType entityType,
+ Integer level,
+ Optional powers) {
+ if (!EliteMobProperties.getValidMobTypes().contains(entityType)) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Entity type " + entityType.toString() + " can't be an Elite!"));
+ return;
+ }
+ LivingEntity livingEntity = (LivingEntity) location.getWorld().spawnEntity(location, entityType);
+ HashSet mobPowers = new HashSet<>();
+ if (powers.isPresent()) {
+ String[] powersArray = powers.get().split(" ");
+ mobPowers = getPowers(powersArray, commandSender);
+ }
+ EliteEntity eliteEntity = new EliteEntity();
+ eliteEntity.setLevel(level);
+ eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
+ if (!mobPowers.isEmpty()) eliteEntity.applyPowers(mobPowers);
+ else eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity));
+ }
+
+ public static void spawnCustomBossCommand(CommandSender commandSender,
+ String fileName,
+ String world,
+ Vector coords) {
+ try {
+ Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ());
+ CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
+ if (customBossesConfigFields == null) {
+ commandSender.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
+ return;
+ }
+ CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
+ customBossEntity.setSpawnLocation(location);
+ customBossEntity.spawn(false);
+ } catch (Exception e) {
+ commandSender.sendMessage("[EliteMobs] World argument was not valid!");
+ }
+
+ }
+
+ public static void spawnCustomBossCommand(CommandSender commandSender,
+ String fileName,
+ String world,
+ Vector coords,
+ int level) {
+ try {
+ Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ());
+ CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
+ if (customBossesConfigFields == null) {
+ commandSender.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
+ return;
+ }
+ CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
+ customBossEntity.setSpawnLocation(location);
+ customBossEntity.setLevel(level);
+ customBossEntity.spawn(false);
+ } catch (Exception e) {
+ commandSender.sendMessage("[EliteMobs] World argument was not valid!");
+ }
+
+ }
+
+ public static void spawnCustomBossCommand(Player player, String fileName, int level) {
+ CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
+ if (customBossesConfigFields == null) {
+ player.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
+ return;
+ }
+ CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
+ customBossEntity.setSpawnLocation(getLocation(player));
+ customBossEntity.setLevel(level);
+ customBossEntity.spawn(false);
+ }
+
+ public static void spawnCustomBossCommand(Player player, String fileName) {
+ CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
+ if (customBossesConfigFields == null) {
+ player.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
+ return;
+ }
+ CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
+ customBossEntity.setSpawnLocation(getLocation(player));
+ customBossEntity.spawn(false);
+ }
+
+
+ private static Location getLocation(Player player) {
+ return player.getTargetBlock(null, 30).getLocation().add(0.5, 1, 0.5);
+ }
+
+ private static HashSet getPowers(String[] mobPowers, CommandSender commandSender) {
+
+ HashSet elitePowers = new HashSet<>();
+
+ for (String string : mobPowers) {
+ PowersConfigFields powersConfigFields = PowersConfig.getPower(string);
+ if (powersConfigFields == null) {
+ commandSender.sendMessage("[EliteMobs] Power " + string + " is not a valid power! Valid powers:");
+ StringBuilder allPowers = new StringBuilder();
+ for (CustomConfigFields iteratedField : ElitePower.getElitePowers().values())
+ allPowers.append(iteratedField.getFilename()).append(", ");
+ allPowers.append("custom");
+ commandSender.sendMessage(allPowers.toString());
+ return new HashSet<>();
+ }
+ elitePowers.add(powersConfigFields);
+ }
+ return elitePowers;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java
new file mode 100644
index 000000000..4823c0c5e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnElite.java
@@ -0,0 +1,34 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.powers.meta.ElitePower;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.EntityType;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+public class SpawnElite extends AdvancedCommand {
+ public SpawnElite() {
+ super(List.of("spawn"));
+ addLiteral("elite");
+ addArgument("entityType", new ArrayList<>());
+ addArgument("level", new ArrayList<>());
+ addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList());
+ setUsage("/em spawn elite <...>");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Spawns an elite of the specified type and level, and optionally with the specified powers.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnEliteEntityTypeCommand(
+ commandData.getPlayerSender(),
+ EntityType.valueOf(commandData.getStringArgument("entityType")),
+ commandData.getIntegerArgument("level"),
+ Optional.of(commandData.getStringSequenceArgument("powers")));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java
new file mode 100644
index 000000000..502bb1811
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnEliteAtCommand.java
@@ -0,0 +1,44 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.powers.meta.ElitePower;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.entity.EntityType;
+import org.bukkit.util.Vector;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+public class SpawnEliteAtCommand extends AdvancedCommand {
+ public SpawnEliteAtCommand() {
+ super(List.of("spawn"));
+ addLiteral("eliteAt");
+ addArgument("world", new ArrayList<>());
+ addArgument("x", new ArrayList<>());
+ addArgument("y", new ArrayList<>());
+ addArgument("z", new ArrayList<>());
+ addArgument("entityType", new ArrayList<>());
+ addArgument("level", new ArrayList<>());
+ addArgument("powers", ElitePower.getElitePowers().keySet().stream().toList());
+ setUsage("/em spawn eliteAt <...>");
+ setPermission("elitemobs.place.admin");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Spawns an elite of the specified type and level, optionally with specified powers, at the chosen location.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ SpawnCommand.spawnEliteEntityTypeCommand(
+ commandData.getPlayerSender(),
+ EntityType.valueOf(commandData.getStringArgument("entityType")),
+ commandData.getStringArgument("world"),
+ new Vector(
+ commandData.getIntegerArgument("x"),
+ commandData.getIntegerArgument("y"),
+ commandData.getIntegerArgument("z")),
+ commandData.getIntegerArgument("level"),
+ Optional.of(commandData.getStringSequenceArgument("powers")));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnMobCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnMobCommandHandler.java
deleted file mode 100644
index f1a072e90..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/SpawnMobCommandHandler.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.events.mobs.*;
-import com.magmaguy.elitemobs.mobconstructor.EliteMobEntity;
-import com.magmaguy.elitemobs.mobconstructor.SuperMobConstructor;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
-import com.magmaguy.elitemobs.mobconstructor.mobdata.passivemobs.SuperMobProperties;
-import com.magmaguy.elitemobs.mobpowers.ElitePower;
-import com.magmaguy.elitemobs.mobpowers.defensivepowers.*;
-import com.magmaguy.elitemobs.mobpowers.majorpowers.*;
-import com.magmaguy.elitemobs.mobpowers.miscellaneouspowers.BonusLoot;
-import com.magmaguy.elitemobs.mobpowers.miscellaneouspowers.MovementSpeed;
-import com.magmaguy.elitemobs.mobpowers.miscellaneouspowers.Taunt;
-import com.magmaguy.elitemobs.mobpowers.offensivepowers.*;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.command.BlockCommandSender;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Squid;
-import org.bukkit.util.Vector;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-
-import static com.magmaguy.elitemobs.EliteMobs.validWorldList;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-public class SpawnMobCommandHandler {
-
- public static void spawnMob(CommandSender commandSender, String[] args) {
-
- Location location = getLocation(commandSender, args);
- if (location == null) return;
-
- EntityType entityType = getEntityType(commandSender, args);
- if (entityType == null) return;
-
- if (SuperMobProperties.isValidSuperMobType(entityType)) {
- spawnSuperMob(entityType, location);
- return;
- }
-
- Integer mobLevel = getLevel(commandSender, args);
- if (mobLevel == null) return;
-
- HashSet mobPowers = getPowers(commandSender, args);
-
- EliteMobEntity eliteMobEntity = new EliteMobEntity(entityType, location, mobLevel, mobPowers);
-
- }
-
- private static Location getLocation(CommandSender commandSender, String args[]) {
-
- if (commandSender instanceof Player)
- return getLocation((Player) commandSender);
-
-
- if (commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender) {
-
- World world = null;
-
- try {
-
- for (World worldIterator : validWorldList)
- if (worldIterator.getName().equals(args[1]))
- world = worldIterator;
-
- } catch (Exception e) {
-
- commandSender.sendMessage("[EliteMobs] Invalid world name when summoning Elite Mob.");
- commandSender.sendMessage("[EliteMobs] Valid worlds:");
- for (World worldIterator : validWorldList)
- commandSender.sendMessage(worldIterator.getName());
- commandSender.sendMessage("[EliteMobs] Is your world enabled in the ValidWorlds.yml config file?");
- return null;
-
- }
-
- double xCoord, yCoord, zCoord;
-
- try {
-
- xCoord = Double.parseDouble(args[2]);
- yCoord = Double.parseDouble(args[3]);
- zCoord = Double.parseDouble(args[4]);
-
- } catch (Exception e) {
-
- commandSender.sendMessage("[EliteMobs] Invalid X Y Z coordinates.");
- return null;
-
- }
-
- return new Location(world, xCoord, yCoord, zCoord);
-
- }
-
- return null;
-
- }
-
- private static Location getLocation(Player player) {
- return player.getTargetBlock(null, 30).getLocation().add(0.5, 1, 0.5);
- }
-
-
- private static EntityType getEntityType(CommandSender commandSender, String args[]) {
-
- String entityInput = "";
-
- if (commandSender instanceof Player) {
-
- try {
-
- entityInput = args[1].toLowerCase();
-
- } catch (Exception e) {
-
- commandSender.sendMessage("[EliteMobs] Error trying to obtain mob type.");
- String validEntities = "";
- for (EntityType entities : EliteMobProperties.getValidMobTypes())
- validEntities += entities + ", ";
- commandSender.sendMessage("[EliteMobs] Valid mob types:" + validEntities);
-
- }
-
-
- } else if (commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender) {
-
-
- try {
-
- entityInput = args[5].toLowerCase();
-
- } catch (Exception e) {
-
- commandSender.sendMessage("[EliteMobs] Error trying to obtain mob type.");
- String validEntities = "";
- for (EntityType entities : EliteMobProperties.getValidMobTypes())
- validEntities += entities + ", ";
- commandSender.sendMessage("[EliteMobs] Valid mob types:" + validEntities);
-
- }
-
- }
-
- try {
- return EntityType.valueOf(entityInput.toUpperCase());
- } catch (Exception ex) {
- commandSender.sendMessage("[EliteMobs] Could not spawn mob type " + entityInput +
- " If this is incorrect, please contact the dev.");
- return null;
- }
-
- }
-
- private static Integer getLevel(CommandSender commandSender, String args[]) {
-
- int mobLevel = 0;
-
- if (commandSender instanceof Player) {
-
- try {
-
- mobLevel = Integer.valueOf(args[2]);
-
- } catch (Error error) {
-
- commandSender.sendMessage("Error assigning mob level to Elite Mob. Mob level must be above 0.");
-
- }
-
-
- } else if (commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender) {
-
- try {
-
- mobLevel = Integer.valueOf(args[6]);
-
- } catch (Error error) {
-
- commandSender.sendMessage("Error assigning mob level to Elite Mob. Mob level must be above 0.");
-
- }
-
- }
-
- if (mobLevel < 1)
- mobLevel = 1;
-
- return mobLevel;
-
- }
-
- private static HashSet getPowers(CommandSender commandSender, String args[]) {
-
- ArrayList mobPowers = new ArrayList();
-
- if (commandSender instanceof Player) {
-
- if (args.length > 3) {
-
- int index = 0;
-
- for (String arg : args) {
-
- //mob powers start after arg 2
- if (index > 2)
- mobPowers.add(arg);
-
- index++;
-
- }
-
- }
-
- } else if (commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender) {
-
- if (args.length > 6) {
-
- int index = 0;
-
- for (String arg : args) {
-
- //mob powers start after arg 6
- if (index > 6)
- mobPowers.add(arg);
-
- index++;
-
- }
-
- }
-
- }
-
- return getPowers(mobPowers, commandSender);
-
- }
-
- private static HashSet getPowers(ArrayList mobPowers, CommandSender commandSender) {
-
- HashSet elitePowers = new HashSet<>();
-
- if (mobPowers.size() > 0) {
-
- for (String string : mobPowers) {
-
- switch (string.toLowerCase()) {
- //major powers
- case "zombiefriends":
- elitePowers.add(new ZombieFriends());
- break;
- case "zombienecronomicon":
- elitePowers.add(new ZombieNecronomicon());
- break;
- case "zombieteamrocket":
- elitePowers.add(new ZombieTeamRocket());
- break;
- case "zombieparents":
- elitePowers.add(new ZombieParents());
- break;
- case "zombiebloat":
- elitePowers.add(new ZombieBloat());
- break;
- case "skeletontrackingarrow":
- elitePowers.add(new SkeletonTrackingArrow());
- break;
- case "skeletonpillar":
- elitePowers.add(new SkeletonPillar());
- break;
- //minor powers
- case "attackarrow":
- elitePowers.add(new AttackArrow());
- break;
- case "attackblinding":
- elitePowers.add(new AttackBlinding());
- break;
- case "attackconfusing":
- elitePowers.add(new AttackConfusing());
- break;
- case "attackfire":
- elitePowers.add(new AttackConfusing());
- break;
- case "attackfireball":
- elitePowers.add(new AttackFireball());
- break;
- case "attackfreeze":
- elitePowers.add(new AttackFreeze());
- break;
- case "attackgravity":
- elitePowers.add(new AttackGravity());
- break;
- case "attackpoison":
- elitePowers.add(new AttackPoison());
- break;
- case "attackpush":
- elitePowers.add(new AttackPush());
- break;
- case "attackweakness":
- elitePowers.add(new AttackWeakness());
- break;
- case "attackweb":
- elitePowers.add(new AttackWeb());
- break;
- case "attackwither":
- elitePowers.add(new AttackWither());
- break;
- case "bonusloot":
- elitePowers.add(new BonusLoot());
- break;
- case "invisibility":
- elitePowers.add(new Invisibility());
- break;
- case "invulnerabilityarrow":
- elitePowers.add(new InvulnerabilityArrow());
- break;
- case "invulnerabilityfalldamage":
- elitePowers.add(new InvulnerabilityFallDamage());
- break;
- case "invulnerabilityfire":
- elitePowers.add(new InvulnerabilityFire());
- break;
- case "invulnerabilityknockback":
- elitePowers.add(new InvulnerabilityKnockback());
- break;
- case "movementspeed":
- elitePowers.add(new MovementSpeed());
- break;
- case "taunt":
- elitePowers.add(new Taunt());
- break;
- default:
- commandSender.sendMessage(string + " is not a valid power.");
- commandSender.sendMessage("Valid powers: attackarrow, attackblinding, attackconfusing," +
- " attackfire, attackfireball, attackfreeze,attackgravity, attackpoison, attackpush, " +
- "attackweakness, attackweb, attackwither, bonusloot, invisibility, invulnerabilityarrow," +
- "invulnerabilityfalldamage, invulnerabilityfire, invulnerabilityknockback, movementspeed," +
- "taunt, zombiefriends, zombienecronomicon, zombieteamrocket, zombieteamrocket, zombieparents," +
- "zombiebloat, skeletontrackingarrow, skeletonpillar");
- break;
-
- }
-
- }
-
- }
-
- return elitePowers;
-
- }
-
- private static void spawnSuperMob(EntityType entityType, Location location) {
- SuperMobConstructor.constructSuperMob((LivingEntity) location.getWorld().spawnEntity(location, entityType));
- }
-
- public static void spawnBossMob(Player player, String[] args) {
-
- Location cursorLocation = player.getTargetBlock(null, 5).getLocation().add(new Vector(0.5, 2, 0.5));
-
- if (args[1].equalsIgnoreCase("treasuregoblin")) {
-
- TreasureGoblin.createGoblin(cursorLocation);
- player.sendMessage("Spawned treasure goblin");
-
- }
-
- if (args[1].equalsIgnoreCase("zombieking")) {
-
- ZombieKing.spawnZombieKing(cursorLocation);
- player.sendMessage("Spawned zombie king");
-
- }
-
- if (args[1].equalsIgnoreCase("kraken")) {
-
- Squid squid = (Squid) cursorLocation.getWorld().spawnEntity(cursorLocation, EntityType.SQUID);
- Kraken.spawnKraken(squid.getLocation());
- squid.remove();
- player.sendMessage("Spawned Kraken");
-
- }
-
- if (args[1].equalsIgnoreCase("balrog")) {
-
- Balrog.spawnBalrog(cursorLocation);
- player.sendMessage("Spawned Balrog");
-
- }
-
- if (args[1].equalsIgnoreCase("fae")) {
-
- Fae.spawnFae(cursorLocation);
- player.sendMessage("Spawned Fae");
-
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java
new file mode 100644
index 000000000..d0e40f1d6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/SpawnTeleportCommand.java
@@ -0,0 +1,25 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.api.PlayerPreTeleportEvent;
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class SpawnTeleportCommand extends AdvancedCommand {
+ public SpawnTeleportCommand() {
+ super(List.of("spawntp"));
+ setPermission("elitemobs.teleport.spawn");
+ setUsage("/em spawntp");
+ setDescription("Teleports players to the server spawn.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (DefaultConfig.getDefaultSpawnLocation() != null)
+ PlayerPreTeleportEvent.teleportPlayer(commandData.getPlayerSender(), DefaultConfig.getDefaultSpawnLocation());
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java
new file mode 100644
index 000000000..35f3162fe
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/StartCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.instanced.MatchInstance;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.List;
+
+public class StartCommand extends AdvancedCommand {
+ public StartCommand() {
+ super(List.of("start"));
+ setUsage("/em start");
+ setDescription("When in instanced content, makes the player start the instance.");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.instance.start");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ MatchInstance matchInstance = MatchInstance.getPlayerInstance(commandData.getPlayerSender());
+ if (matchInstance != null) {
+ matchInstance.countdownMatch();
+ } else
+ Logger.sendMessage(commandData.getCommandSender(), "You are not queued for instanced content!");
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java
new file mode 100644
index 000000000..db5660270
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommand.java
@@ -0,0 +1,22 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class StatsCommand extends AdvancedCommand {
+ public StatsCommand() {
+ super(List.of("stats"));
+ setUsage("/em stats");
+ setPermission("elitemobs.stats");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Displays EliteMobs server stats.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ com.magmaguy.elitemobs.commands.admin.StatsCommand.statsHandler(commandData.getCommandSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommandHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/StatsCommandHandler.java
deleted file mode 100644
index 639fc0d2f..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/StatsCommandHandler.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.EntityTracker;
-import com.magmaguy.elitemobs.MetadataHandler;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.DefaultConfig;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.ConsoleCommandSender;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import static com.magmaguy.elitemobs.EliteMobs.validWorldList;
-import static org.bukkit.Bukkit.getLogger;
-import static org.bukkit.Bukkit.getServer;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-public class StatsCommandHandler {
-
- public static void statsHandler(CommandSender commandSender) {
-
- int mobLevelSavingsCount = 0;
- int totalMobCount = 0;
- int aggressiveCount = 0;
- int passiveCount = 0;
- int blazeCount = 0;
- int caveSpiderCount = 0;
- int creeperCount = 0;
- int endermanCount = 0;
- int endermiteCount = 0;
- int huskCount = 0;
- int ironGolemCount = 0;
- int pigZombieCount = 0;
- int polarBearCount = 0;
- int silverfishCount = 0;
- int skeletonCount = 0;
- int spiderCount = 0;
- int strayCount = 0;
- int witchCount = 0;
- int witherSkeletonCount = 0;
- int zombieCount = 0;
- int zombieVillagerCount = 0;
-
- int chickenCount = 0;
- int cowCount = 0;
- int mushroomCowCount = 0;
- int pigCount = 0;
- int sheepCount = 0;
-
- for (World world : validWorldList) {
-
- for (LivingEntity livingEntity : world.getLivingEntities()) {
-
- if (EntityTracker.isEliteMob(livingEntity) ||
- EntityTracker.isSuperMob(livingEntity)) {
-
- totalMobCount++;
-
- if (EntityTracker.isEliteMob(livingEntity)) {
-
- mobLevelSavingsCount += EntityTracker.getEliteMobEntity(livingEntity).getLevel();
- aggressiveCount++;
-
- switch (livingEntity.getType()) {
-
- case ZOMBIE:
- zombieCount++;
- break;
- case HUSK:
- huskCount++;
- break;
- case ZOMBIE_VILLAGER:
- zombieVillagerCount++;
- break;
- case SKELETON:
- skeletonCount++;
- break;
- case WITHER_SKELETON:
- witherSkeletonCount++;
- break;
- case STRAY:
- strayCount++;
- break;
- case PIG_ZOMBIE:
- pigZombieCount++;
- break;
- case CREEPER:
- creeperCount++;
- break;
- case SPIDER:
- spiderCount++;
- break;
- case ENDERMAN:
- endermanCount++;
- break;
- case CAVE_SPIDER:
- caveSpiderCount++;
- break;
- case SILVERFISH:
- silverfishCount++;
- break;
- case BLAZE:
- blazeCount++;
- break;
- case WITCH:
- witchCount++;
- break;
- case ENDERMITE:
- endermiteCount++;
- break;
- case POLAR_BEAR:
- polarBearCount++;
- break;
- case IRON_GOLEM:
- ironGolemCount++;
- break;
- default:
- getLogger().info("Error: Couldn't assign custom mob name due to unexpected aggressive boss mob (talk to the dev!)");
- getLogger().info("Missing mob type: " + livingEntity.getType());
- break;
- }
-
-
- } else if (EntityTracker.isSuperMob(livingEntity)) {
-
- //passive EliteMobs only stack at 50 right now
- //TODO: redo this count at some other stage of this plugin's development
- mobLevelSavingsCount += ConfigValues.defaultConfig.getInt(DefaultConfig.SUPERMOB_STACK_AMOUNT);
- passiveCount++;
-
- switch (livingEntity.getType()) {
-
- case CHICKEN:
- chickenCount++;
- break;
- case COW:
- cowCount++;
- break;
- case MUSHROOM_COW:
- mushroomCowCount++;
- break;
- case PIG:
- pigCount++;
- break;
- case SHEEP:
- sheepCount++;
- break;
- default:
- getLogger().info("Error: Couldn't assign custom mob name due to unexpected passive boss mob (talk to the dev!)");
- getLogger().info("Missing mob type: " + livingEntity.getType());
- break;
-
- }
-
- }
-
- }
-
- }
-
- }
-
- if (commandSender instanceof Player) {
-
- Player player = (Player) commandSender;
-
- player.sendMessage("§5§m-----------------------------------------------------");
- player.sendMessage("§a§lEliteMobs v. " + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion() + " stats:");
- player.sendMessage("There are currently §l§6" + totalMobCount + " §f§rEliteMobs replacing §l§e" +
- mobLevelSavingsCount + " §f§rregular mobs.");
-
- if (aggressiveCount > 0) {
-
- String aggressiveCountMessage = "§c" + aggressiveCount + " §4Aggressive EliteMobs: §f";
-
- HashMap unsortedMobCount = new HashMap();
-
- unsortedMobCountFilter(unsortedMobCount, blazeCount, "blazes");
- unsortedMobCountFilter(unsortedMobCount, caveSpiderCount, "cave spiders");
- unsortedMobCountFilter(unsortedMobCount, creeperCount, "creepers");
- unsortedMobCountFilter(unsortedMobCount, endermanCount, "endermen");
- unsortedMobCountFilter(unsortedMobCount, endermiteCount, "endermites");
- unsortedMobCountFilter(unsortedMobCount, huskCount, "husks");
- unsortedMobCountFilter(unsortedMobCount, pigZombieCount, "zombiepigmen");
- unsortedMobCountFilter(unsortedMobCount, polarBearCount, "polar bears");
- unsortedMobCountFilter(unsortedMobCount, silverfishCount, "silverfish");
- unsortedMobCountFilter(unsortedMobCount, skeletonCount, "skeletons");
- unsortedMobCountFilter(unsortedMobCount, spiderCount, "spiders");
- unsortedMobCountFilter(unsortedMobCount, strayCount, "strays");
- unsortedMobCountFilter(unsortedMobCount, witchCount, "witches");
- unsortedMobCountFilter(unsortedMobCount, witherSkeletonCount, "wither skeletons");
- unsortedMobCountFilter(unsortedMobCount, zombieCount, "zombie");
- unsortedMobCountFilter(unsortedMobCount, zombieVillagerCount, "zombie villagers");
-
- player.sendMessage(messageStringAppender(aggressiveCountMessage, unsortedMobCount));
-
- }
-
- if (passiveCount > 0) {
-
- String passiveCountMessage = "§b" + passiveCount + " §3Passive EliteMobs: §f";
-
- HashMap unsortedMobCount = new HashMap();
-
- unsortedMobCountFilter(unsortedMobCount, chickenCount, "chickens");
- unsortedMobCountFilter(unsortedMobCount, cowCount, "cows");
- unsortedMobCountFilter(unsortedMobCount, ironGolemCount, "iron golems");
- unsortedMobCountFilter(unsortedMobCount, mushroomCowCount, "mushroom cows");
- unsortedMobCountFilter(unsortedMobCount, pigCount, "pigs");
- unsortedMobCountFilter(unsortedMobCount, sheepCount, "sheep");
-
- player.sendMessage(messageStringAppender(passiveCountMessage, unsortedMobCount));
-
- }
-
- player.sendMessage("§5§m-----------------------------------------------------");
-
- } else if (commandSender instanceof ConsoleCommandSender) {
-
- getServer().getConsoleSender().sendMessage("§5§m-------------------------------------------------------------");
- getServer().getConsoleSender().sendMessage("§a§lEliteMobs stats:");
- getServer().getConsoleSender().sendMessage("There are currently §l§6" + totalMobCount + " §f§rEliteMobs replacing §l§e" +
- mobLevelSavingsCount + " §f§rregular mobs.");
-
- if (aggressiveCount > 0) {
-
- String aggressiveCountMessage = "§c" + aggressiveCount + " §4Aggressive EliteMobs: §f";
-
- HashMap unsortedMobCount = new HashMap();
-
- unsortedMobCountFilter(unsortedMobCount, blazeCount, "blazes");
- unsortedMobCountFilter(unsortedMobCount, caveSpiderCount, "cave spiders");
- unsortedMobCountFilter(unsortedMobCount, creeperCount, "creepers");
- unsortedMobCountFilter(unsortedMobCount, endermanCount, "endermen");
- unsortedMobCountFilter(unsortedMobCount, endermiteCount, "endermites");
- unsortedMobCountFilter(unsortedMobCount, huskCount, "husks");
- unsortedMobCountFilter(unsortedMobCount, ironGolemCount, "iron golems");
- unsortedMobCountFilter(unsortedMobCount, pigZombieCount, "zombiepigmen");
- unsortedMobCountFilter(unsortedMobCount, polarBearCount, "polar bears");
- unsortedMobCountFilter(unsortedMobCount, silverfishCount, "silverfish");
- unsortedMobCountFilter(unsortedMobCount, skeletonCount, "skeletons");
- unsortedMobCountFilter(unsortedMobCount, spiderCount, "spiders");
- unsortedMobCountFilter(unsortedMobCount, strayCount, "strays");
- unsortedMobCountFilter(unsortedMobCount, witchCount, "witches");
- unsortedMobCountFilter(unsortedMobCount, witherSkeletonCount, "wither skeletons");
- unsortedMobCountFilter(unsortedMobCount, zombieCount, "zombie");
- unsortedMobCountFilter(unsortedMobCount, zombieVillagerCount, "zombie villagers");
-
- getServer().getConsoleSender().sendMessage(messageStringAppender(aggressiveCountMessage, unsortedMobCount));
-
- }
-
- if (passiveCount > 0) {
-
- String passiveCountMessage = "§b" + passiveCount + " §3Passive EliteMobs: §f";
-
- HashMap unsortedMobCount = new HashMap();
-
- unsortedMobCountFilter(unsortedMobCount, chickenCount, "chickens");
- unsortedMobCountFilter(unsortedMobCount, cowCount, "cows");
- unsortedMobCountFilter(unsortedMobCount, mushroomCowCount, "mushroom cows");
- unsortedMobCountFilter(unsortedMobCount, pigCount, "pigs");
- unsortedMobCountFilter(unsortedMobCount, sheepCount, "sheep");
-
- getServer().getConsoleSender().sendMessage(messageStringAppender(passiveCountMessage, unsortedMobCount));
-
- }
-
- getServer().getConsoleSender().sendMessage("§5§m-------------------------------------------------------------");
-
- }
-
- }
-
- private static void unsortedMobCountFilter(HashMap unsortedMobCount, int count, String mobTypeName) {
-
- if (count > 0) {
-
- unsortedMobCount.put(mobTypeName, count);
-
- }
-
- }
-
- private static String messageStringAppender(String countMessage, HashMap unsortedMobCount) {
-
- Iterator iterator = unsortedMobCount.entrySet().iterator();
-
- while (iterator.hasNext()) {
-
- Map.Entry pair = (Map.Entry) iterator.next();
-
- String mobCountString = "§6§l" + pair.getValue();
- String commaString = ",";
- String spacing = " ";
- String mobNameString = "§r§f" + pair.getKey();
-
- countMessage += commaString + spacing + mobCountString + spacing + mobNameString;
-
- }
-
- return countMessage;
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TierSetSpawner.java b/src/main/java/com/magmaguy/elitemobs/commands/TierSetSpawner.java
deleted file mode 100644
index f8fe78065..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/TierSetSpawner.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import org.bukkit.Material;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-
-public class TierSetSpawner {
-
- public static void spawnTierItem(int tierLevel, Player player) {
-
- ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
- ItemStack chestplate = new ItemStack(Material.DIAMOND_CHESTPLATE);
- ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
- ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
- ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
- ItemStack axe = new ItemStack(Material.DIAMOND_AXE);
- ItemStack bow = new ItemStack(Material.BOW);
-
- if (tierLevel > 1) {
-
- applyEnchantment(helmet, Enchantment.PROTECTION_ENVIRONMENTAL, tierLevel);
- applyEnchantment(chestplate, Enchantment.PROTECTION_ENVIRONMENTAL, tierLevel);
- applyEnchantment(leggings, Enchantment.PROTECTION_ENVIRONMENTAL, tierLevel);
- applyEnchantment(boots, Enchantment.PROTECTION_ENVIRONMENTAL, tierLevel);
- applyEnchantment(sword, Enchantment.DAMAGE_ALL, tierLevel);
- applyEnchantment(axe, Enchantment.DAMAGE_ALL, tierLevel);
- applyEnchantment(bow, Enchantment.ARROW_DAMAGE, tierLevel);
-
- }
-
- player.getInventory().addItem(helmet);
- player.getInventory().addItem(chestplate);
- player.getInventory().addItem(leggings);
- player.getInventory().addItem(boots);
- player.getInventory().addItem(sword);
- player.getInventory().addItem(axe);
- player.getInventory().addItem(bow);
-
- return;
-
- }
-
- private static void applyEnchantment(ItemStack itemStack, Enchantment enchantment, int tierLevel) {
-
- ItemMeta newItemMeta = itemStack.getItemMeta();
- newItemMeta.addEnchant(enchantment, tierLevel - 1, true);
- itemStack.setItemMeta(newItemMeta);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java
new file mode 100644
index 000000000..02a58b06b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/TrackBossCommand.java
@@ -0,0 +1,39 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.DefaultConfig;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import com.magmaguy.magmacore.util.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public class TrackBossCommand extends AdvancedCommand {
+ public TrackBossCommand() {
+ super(List.of("track"));
+ addLiteral("boss");
+ addArgument("id", new ArrayList<>());
+ setDescription("Tracks a Custom Boss.");
+ setUsage("/em track boss ");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.boss.track");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ try {
+ for (CustomBossEntity customBossEntity : CustomBossEntity.getTrackableCustomBosses())
+ if (customBossEntity.getEliteUUID().equals(UUID.fromString(commandData.getStringArgument("id")))) {
+ customBossEntity.getCustomBossBossBar().addTrackingPlayer(commandData.getPlayerSender());
+ return;
+ }
+ Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getBossAlreadyGoneMessage());
+ } catch (Exception ex) {
+ //happens when players try to track an entity that has despawned for any reason
+ Logger.sendMessage(commandData.getCommandSender(), DefaultConfig.getBossAlreadyGoneMessage());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java
new file mode 100644
index 000000000..5a321f703
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksCancelCommand.java
@@ -0,0 +1,24 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class TransitiveBlocksCancelCommand extends AdvancedCommand {
+ public TransitiveBlocksCancelCommand() {
+ super(List.of("transitiveBlocks"));
+ addLiteral("cancel");
+ setUsage("/em transitiveBlocks cancel");
+ setDescription("Cancels transitive block registration.");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.transitiveblocks");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ TransitiveBlockCommand.processCommand(commandData.getPlayerSender());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java
new file mode 100644
index 000000000..d1a14a2b8
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditAreaCommand.java
@@ -0,0 +1,32 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class TransitiveBlocksEditAreaCommand extends AdvancedCommand {
+ public TransitiveBlocksEditAreaCommand() {
+ super(List.of("transitiveBlocks"));
+ addLiteral("editArea");
+ addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList());
+ addArgument("type", List.of("ON_SPAWN", "ON_REMOVE"));
+ setUsage("/em transitiveBlocks editArea ");
+ setPermission("elitemobs.transitiveblocks");
+ setDescription("Edits large transitive blocks areas for use by regional bosses.");
+ setSenderType(SenderType.PLAYER);
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ TransitiveBlockCommand.processCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("type"),
+ true,
+ true);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java
new file mode 100644
index 000000000..db6a54c7f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksEditCommand.java
@@ -0,0 +1,31 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class TransitiveBlocksEditCommand extends AdvancedCommand {
+ public TransitiveBlocksEditCommand() {
+ super(List.of("transitiveBlocks"));
+ addLiteral("edit");
+ addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList());
+ addArgument("type", List.of("ON_SPAWN", "ON_REMOVE"));
+ setUsage("/em transitiveBlocks edit ");
+ setDescription("Edits transitive blocks for use by regional bosses.");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.transitiveblocks");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ TransitiveBlockCommand.processCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("type"),
+ true);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java
new file mode 100644
index 000000000..c68cb1115
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterAreaCommand.java
@@ -0,0 +1,32 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class TransitiveBlocksRegisterAreaCommand extends AdvancedCommand {
+ public TransitiveBlocksRegisterAreaCommand() {
+ super(List.of("transitiveBlocks"));
+ addLiteral("registerArea");
+ addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList());
+ addArgument("type", List.of("ON_SPAWN", "ON_REMOVE"));
+ setUsage("/em transitiveBlocks registerArea ");
+ setDescription("Registers large transitive blocks areas for use by regional bosses.");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.transitiveblocks");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ TransitiveBlockCommand.processCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("type"),
+ false,
+ true);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java
new file mode 100644
index 000000000..22504ebed
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/TransitiveBlocksRegisterCommand.java
@@ -0,0 +1,30 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.transitiveblocks.TransitiveBlockCommand;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class TransitiveBlocksRegisterCommand extends AdvancedCommand {
+ public TransitiveBlocksRegisterCommand() {
+ super(List.of("transitiveBlocks"));
+ addLiteral("register");
+ addArgument("filename", CustomBossesConfig.getCustomBosses().keySet().stream().toList());
+ addArgument("type", List.of("ON_SPAWN", "ON_REMOVE"));
+ setUsage("/em transitiveBlocks register ");
+ setDescription("Registers transitive blocks for use by regional bosses.");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.transitiveblocks");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ TransitiveBlockCommand.processCommand(
+ commandData.getPlayerSender(),
+ commandData.getStringArgument("filename"),
+ commandData.getStringArgument("type"), false);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/TriggerEventHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/TriggerEventHandler.java
deleted file mode 100644
index 53218c106..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/TriggerEventHandler.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.events.DeadMoon;
-import com.magmaguy.elitemobs.events.SmallTreasureGoblin;
-import org.bukkit.command.CommandSender;
-
-public class TriggerEventHandler {
-
- public static void triggerEventCommand(CommandSender commandSender, String[] args){
-
- if (CommandHandler.permCheck(CommandHandler.EVENT_LAUNCH_SMALLTREASUREGOBLIN, commandSender) && args[1].equalsIgnoreCase("smalltreasuregoblin")) {
- SmallTreasureGoblin.initializeEvent();
- commandSender.sendMessage("Queued small treasure goblin event for next valid zombie spawn");
- }
- if (CommandHandler.permCheck(CommandHandler.EVENT_LAUNCH_DEADMOON, commandSender) && args[1].equalsIgnoreCase("deadmoon")) {
- DeadMoon.initializeEvent();
- commandSender.sendMessage("Queued deadmoon event for next new moon");
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java
new file mode 100644
index 000000000..742eb9385
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindCommand.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.commands.guild.AdventurersGuildCommand;
+import com.magmaguy.elitemobs.menus.UnbindMenu;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+
+import java.util.List;
+
+public class UnbindCommand extends AdvancedCommand {
+ public UnbindCommand() {
+ super(List.of("unbind"));
+ setUsage("/em unbind");
+ setPermission("elitemobs.unbind.command");
+ setSenderType(SenderType.PLAYER);
+ setDescription("Opens the unbind menu or teleports the player to the Adventurer's Guild Hub.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ if (!AdventurersGuildCommand.adventurersGuildTeleport(commandData.getPlayerSender())) {
+ UnbindMenu unbindMenu = new UnbindMenu();
+ unbindMenu.constructUnbinderMenu(commandData.getPlayerSender());
+ }
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java
new file mode 100644
index 000000000..f853fa85b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/UnbindForceCommand.java
@@ -0,0 +1,28 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.items.ItemTagger;
+import com.magmaguy.elitemobs.items.customenchantments.SoulbindEnchantment;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.command.SenderType;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.List;
+
+public class UnbindForceCommand extends AdvancedCommand {
+ public UnbindForceCommand() {
+ super(List.of("unbind"));
+ addLiteral("force");
+ setUsage("/em unbind force");
+ setSenderType(SenderType.PLAYER);
+ setPermission("elitemobs.unbind.force");
+ setDescription("Forcefully unbinds a held item.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ ItemStack itemStack = commandData.getPlayerSender().getInventory().getItemInMainHand();
+ if (ItemTagger.isEliteItem(itemStack))
+ SoulbindEnchantment.removeEnchantment(itemStack);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java
new file mode 100644
index 000000000..3a7669ba6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/VersionCommand.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.commands;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.magmacore.command.AdvancedCommand;
+import com.magmaguy.magmacore.command.CommandData;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+
+import java.util.List;
+
+public class VersionCommand extends AdvancedCommand {
+ public VersionCommand() {
+ super(List.of("version"));
+ setUsage("/em version");
+ setPermission("elitemobs.version");
+ setDescription("Checks the server's EliteMobs plugin version.");
+ }
+
+ @Override
+ public void execute(CommandData commandData) {
+ Logger.sendMessage(
+ commandData.getCommandSender(),
+ ChatColor.WHITE + " version " + ChatColor.GREEN + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion());
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/VersionHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/VersionHandler.java
deleted file mode 100644
index a3962ffb4..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/VersionHandler.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.magmaguy.elitemobs.commands;
-
-import com.magmaguy.elitemobs.MetadataHandler;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-
-public class VersionHandler {
-
- public static void versionCommand(CommandSender commandSender, String[] args){
-
- commandSender.sendMessage(ChatColor.DARK_GREEN + "[EliteMobs]" + ChatColor.WHITE + " version " + ChatColor.GREEN +
- Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion());
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java
new file mode 100644
index 000000000..e39885c30
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/DebugScreen.java
@@ -0,0 +1,86 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.elitemobs.playerdata.statusscreen.PlayerStatusScreen;
+import com.magmaguy.elitemobs.utils.BookMaker;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.SpigotMessage;
+import net.md_5.bungee.api.chat.TextComponent;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
+import java.util.Locale;
+
+public class DebugScreen {
+
+ public static void open(Player player, String argument) {
+ if (Bukkit.getPlayer(argument) != null)
+ new PlayerStatusScreen(player, Bukkit.getPlayer(argument));
+ else openBossScreen(player, argument);
+ }
+
+ private static void openBossScreen(Player player, String argument) {
+
+ TextComponent[] pages = new TextComponent[100];
+
+ int counter = 0;
+ for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values())
+ if (!(eliteEntity instanceof RegionalBossEntity))
+ if (eliteEntity instanceof CustomBossEntity) {
+ TextComponent textComponent = generateEntry((CustomBossEntity) eliteEntity, argument, player);
+ if (textComponent == null) continue;
+ pages[counter] = textComponent;
+ counter++;
+ }
+
+ for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities()) {
+ TextComponent textComponent = generateEntry(regionalBossEntity, argument, player);
+ if (textComponent == null) continue;
+ pages[counter] = textComponent;
+ counter++;
+ }
+
+ BookMaker.generateBook(player, pages);
+
+ }
+
+ private static TextComponent generateEntry(CustomBossEntity customBossEntity, String argument, Player player) {
+ if (!customBossEntity.getCustomBossesConfigFields().getFilename().contains(argument) &&
+ !customBossEntity.getCustomBossesConfigFields().getName().toLowerCase(Locale.ROOT).contains(argument.toLowerCase(Locale.ROOT)))
+ return null;
+ TextComponent page = new TextComponent();
+ page.addExtra(customBossEntity.getCustomBossesConfigFields().getFilename() + "\n");
+ page.addExtra("Name: " + ChatColorConverter.convert(customBossEntity.getCustomBossesConfigFields().getName()) + ChatColor.BLACK + "\n");
+ page.addExtra("Level: " + customBossEntity.getCustomBossesConfigFields().getLevel() + "\n");
+ if (customBossEntity.getLivingEntity() != null) {
+ page.addExtra("Is Alive (MC): " + !customBossEntity.getLivingEntity().isDead() + "\n");
+ page.addExtra(SpigotMessage.commandHoverMessage(ChatColor.BLUE + "XYZ: " + "\n",
+ customBossEntity.getLocation().getBlockX() + ", " +
+ customBossEntity.getLocation().getBlockY() + ", " +
+ customBossEntity.getLocation().getBlockZ() + "\n" +
+ ChatColor.BLUE + "Click to teleport! (if alive)",
+ "/em debugtp " + customBossEntity.getEliteUUID().toString()));
+ page.addExtra("Has AI: " + !customBossEntity.getLivingEntity().hasAI() + "\n");
+ } else
+ page.addExtra("Is Alive (MC): false\n");
+ if (customBossEntity.getLocation() != null && player.getWorld().equals(customBossEntity.getLocation().getWorld()))
+ page.addExtra(SpigotMessage.hoverMessage(ChatColor.BLUE + "Spawn distance",
+ "Spawn distance: X=" + (int) (player.getLocation().getX() - customBossEntity.getSpawnLocation().getX())
+ + " | Y=" + (int) (player.getLocation().getY() - customBossEntity.getSpawnLocation().getY()) +
+ " | Z=" + (int) (player.getLocation().getZ() - customBossEntity.getSpawnLocation().getZ()) + "\n"));
+ page.addExtra("Is Persistent: " + customBossEntity.getCustomBossesConfigFields().isPersistent() + "\n");
+ if (customBossEntity instanceof RegionalBossEntity) {
+ page.addExtra("Is Respawning: " + ((RegionalBossEntity) customBossEntity).isRespawning() + "\n");
+ }
+
+ page.addExtra(SpigotMessage.commandHoverMessage(ChatColor.BLUE + "Boss trace!",
+ "Remember, it requires debug mode to be on! This is used for advanced debugging, ask on discord if you want to know more about it.",
+ "/elitemobs trace " + customBossEntity.getEliteUUID().toString()));
+ return page;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java
new file mode 100644
index 000000000..4c0f6bafb
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/EventCommand.java
@@ -0,0 +1,20 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.events.TimedEvent;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.command.CommandSender;
+
+public class EventCommand {
+ private EventCommand() {
+ }
+
+ public static void trigger(CommandSender commandSender, String eventName) {
+ for (TimedEvent timedEvent : TimedEvent.getBlueprintEvents())
+ if (timedEvent.getCustomEventsConfigFields().getFilename().equals(eventName)) {
+ timedEvent.instantiateEvent();
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] Queued event " + eventName + " for the next valid time it can spawn. &cThis might take a while depending on the start conditions of the event."));
+ return;
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java
new file mode 100644
index 000000000..8cbeb76d8
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/GetTierCommand.java
@@ -0,0 +1,79 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.api.utils.EliteItemManager;
+import com.magmaguy.elitemobs.items.EliteItemLore;
+import com.magmaguy.elitemobs.items.ItemTagger;
+import org.bukkit.Material;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+public class GetTierCommand {
+ private GetTierCommand() {
+ }
+
+ public static void get(Player player, int tierLevel) {
+
+ ItemStack helmet = new ItemStack(Material.IRON_HELMET);
+ addDurability(helmet);
+ ItemStack chestplate = new ItemStack(Material.IRON_CHESTPLATE);
+ addDurability(chestplate);
+ ItemStack leggings = new ItemStack(Material.IRON_LEGGINGS);
+ addDurability(leggings);
+ ItemStack boots = new ItemStack(Material.IRON_BOOTS);
+ addDurability(boots);
+ ItemStack sword = new ItemStack(Material.IRON_SWORD);
+ addDurability(sword);
+ ItemStack axe = new ItemStack(Material.IRON_AXE);
+ addDurability(axe);
+ ItemStack bow = new ItemStack(Material.BOW);
+ addDurability(boots);
+ ItemStack cheatSword = new ItemStack(Material.NETHERITE_SWORD);
+ addDurability(cheatSword);
+
+ EliteItemManager.setEliteLevel(helmet, tierLevel);
+ EliteItemManager.setEliteLevel(chestplate, tierLevel);
+ EliteItemManager.setEliteLevel(leggings, tierLevel);
+ EliteItemManager.setEliteLevel(boots, tierLevel);
+ EliteItemManager.setEliteLevel(sword, tierLevel);
+ EliteItemManager.setEliteLevel(axe, tierLevel);
+ EliteItemManager.setEliteLevel(bow, tierLevel);
+ EliteItemManager.setEliteLevel(cheatSword, tierLevel);
+ ItemMeta cheatItemMeta = cheatSword.getItemMeta();
+ cheatItemMeta.setDisplayName("CHEAT SWORD");
+ ItemTagger.registerEnchantment(cheatItemMeta, Enchantment.SHARPNESS.getKey(), 100);
+ cheatSword.setItemMeta(cheatItemMeta);
+
+ new EliteItemLore(helmet, false);
+ new EliteItemLore(leggings, false);
+ new EliteItemLore(boots, false);
+ new EliteItemLore(sword, false);
+ new EliteItemLore(axe, false);
+ new EliteItemLore(cheatSword, false);
+ new EliteItemLore(chestplate, false);
+ new EliteItemLore(bow, false);
+
+
+ player.getInventory().setHelmet(helmet);
+ player.getInventory().setChestplate(chestplate);
+ player.getInventory().setLeggings(leggings);
+ player.getInventory().setBoots(boots);
+ player.getInventory().addItem(sword);
+ player.getInventory().addItem(axe);
+ player.getInventory().addItem(bow);
+ player.getInventory().addItem(cheatSword);
+ player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 64));
+ player.getInventory().addItem(new ItemStack(Material.ARROW, 64));
+ player.getInventory().addItem(new ItemStack(Material.ARROW, 64));
+ player.getInventory().addItem(new ItemStack(Material.SHIELD));
+
+ }
+
+ private static void addDurability(ItemStack itemStack) {
+ ItemMeta itemMeta = itemStack.getItemMeta();
+ itemMeta.addEnchant(Enchantment.UNBREAKING, 5, true);
+ itemStack.setItemMeta(itemMeta);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java
new file mode 100644
index 000000000..fa37074fe
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/KillHandler.java
@@ -0,0 +1,64 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.api.internal.RemovalReason;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+
+public class KillHandler {
+
+ //TODO: FIX NPE ISSUE YOU FUCKING MORON
+
+ public static void killAggressiveMobs(CommandSender commandSender) {
+ int counter = 0;
+ for (EliteEntity eliteEntity : new ArrayList<>(EntityTracker.getEliteMobEntities().values())) {
+ eliteEntity.remove(RemovalReason.OTHER);
+ counter++;
+ }
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs."));
+ }
+
+ public static void killEntityType(CommandSender commandSender, EntityType entityType) {
+ if (EliteMobProperties.getValidMobTypes().contains(entityType)) {
+ int counter = 0;
+ for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) {
+ if (!eliteEntity.getLivingEntity().getType().equals(entityType)) continue;
+ eliteEntity.remove(RemovalReason.OTHER);
+ counter++;
+ }
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite " + entityType.toString() + "."));
+ } else
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cNot a valid entity type for EliteMobs!"));
+ }
+
+ public static void radiusKillAggressiveMobs(Player player, int radius) {
+ int counter = 0;
+ for (Entity entity : player.getNearbyEntities(radius, radius, radius)) {
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity);
+ if (eliteEntity != null)
+ eliteEntity.remove(RemovalReason.OTHER);
+ }
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs."));
+ }
+
+ public static void radiusKillSpecificMobs(Player player, EntityType entityType, int radius) {
+ int counter = 0;
+ for (Entity entity : player.getNearbyEntities(radius, radius, radius)) {
+ if (!entity.getType().equals(entityType)) continue;
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity);
+ if (eliteEntity != null) {
+ ((EliteEntity) entity).remove(RemovalReason.OTHER);
+ counter++;
+ }
+ }
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs."));
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java
new file mode 100644
index 000000000..77871fb0e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/LootCommand.java
@@ -0,0 +1,38 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.items.customitems.CustomItem;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+/**
+ * Created by MagmaGuy on 01/05/2017.
+ */
+public class LootCommand {
+
+ public static void get(Player player, String args1) {
+ CustomItem customItem = CustomItem.getCustomItem(args1);
+ if (customItem == null) {
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cFile name " + args1 + " &cis not a valid custom item file name!"));
+ return;
+ }
+ player.getInventory().addItem(customItem.generateDefaultsItemStack(player, false, null, true));
+ }
+
+ public static void give(CommandSender commandSender, String playerString, String args1) {
+ CustomItem customItem = CustomItem.getCustomItem(args1);
+ if (customItem == null) {
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cFile name " + args1 + " &cis not a valid custom item file name!"));
+ return;
+ }
+ Player player = Bukkit.getPlayer(playerString);
+ if (player == null)
+ commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cTried to give item to invalid player!"));
+ else {
+ player.getInventory().addItem(customItem.generateDefaultsItemStack(player, false, null));
+ commandSender.sendMessage("[EliteMobs] Successfully gave " + player.getName() + " item " + customItem.getCustomItemsConfigFields().getName());
+ }
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java
new file mode 100644
index 000000000..d9bcc72f0
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/NPCCommands.java
@@ -0,0 +1,35 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.config.npcs.NPCsConfig;
+import com.magmaguy.elitemobs.config.npcs.NPCsConfigFields;
+import com.magmaguy.elitemobs.npcs.NPCEntity;
+import com.magmaguy.magmacore.util.Round;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+public class NPCCommands {
+
+ public static void set(Player player, String npcFileName) {
+
+ NPCsConfigFields npCsConfigFields = NPCsConfig.getNpcEntities().get(npcFileName);
+ if (npCsConfigFields == null) {
+ player.sendMessage("[EliteMobs] Invalid NPC filename.");
+ return;
+ }
+
+ Location playerLocation = player.getLocation();
+
+ String location = playerLocation.getWorld().getName() + ","
+ + Round.twoDecimalPlaces(playerLocation.getX()) + ","
+ + Round.twoDecimalPlaces(playerLocation.getY()) + ","
+ + Round.twoDecimalPlaces(playerLocation.getZ()) + ","
+ + Round.twoDecimalPlaces(playerLocation.getYaw()) + ","
+ + Round.twoDecimalPlaces(playerLocation.getPitch());
+
+ npCsConfigFields.setEnabled(true);
+ npCsConfigFields.setSpawnLocation(location);
+ new NPCEntity(npCsConfigFields, location);
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java
new file mode 100644
index 000000000..ebbf4f598
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RelativeCoordinatesCommand.java
@@ -0,0 +1,44 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+public class RelativeCoordinatesCommand {
+ public static void get(Player player, String minidungeonString) {
+
+ EMPackage emPackage = EMPackage.getEmPackages().get(minidungeonString);
+ if (emPackage == null) {
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Minidungeons name " + minidungeonString + " &4isn't valid!"));
+ return;
+ }
+
+ if (!emPackage.isInstalled()) {
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Minidungeon isn't installed! Can't get the relative location for uninstalled Minidungeons!"));
+ return;
+ }
+
+ Location anchorpoint = emPackage.getDungeonPackagerConfigFields().getAnchorPoint();
+
+ if (anchorpoint == null) {
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Something went wrong and made the anchor point not valid!"));
+ return;
+ }
+
+ Vector relativeVector = player.getLocation().clone().subtract(anchorpoint).toVector();
+ if (emPackage.getDungeonPackagerConfigFields().getCalculatedRotation() != 0)
+ GenericRotationMatrixMath.rotateVectorYAxis(emPackage.getDungeonPackagerConfigFields().getCalculatedRotation(), anchorpoint, relativeVector);
+
+ String relativePosition = relativeVector.getBlockX() + ", "
+ + relativeVector.getBlockY() + ", "
+ + relativeVector.getBlockZ();
+
+ player.sendMessage(ChatColorConverter.convert(
+ "[EliteMobs] Relative position to anchor point of " + emPackage.getDungeonPackagerConfigFields().getName() + ": " + relativePosition));
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java
new file mode 100644
index 000000000..e752f0de5
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/RemoveCommand.java
@@ -0,0 +1,86 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.api.internal.RemovalReason;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.EliteEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.elitemobs.npcs.NPCEntity;
+import com.magmaguy.elitemobs.treasurechest.TreasureChest;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+public class RemoveCommand {
+ private static final Set removingPlayers = new HashSet<>();
+
+ private RemoveCommand() {
+ }
+
+ public static void remove(Player player) {
+ if (removingPlayers.contains(player.getUniqueId())) {
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &aYou are no longer removing elites!"));
+ removingPlayers.remove(player.getUniqueId());
+ } else {
+ removingPlayers.add(player.getUniqueId());
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cYou are now removing elites when you punch them! Run &a/em remove &cagain to stop removing elites!"));
+ }
+ }
+
+ public static class RemoveCommandEvents implements Listener {
+ @EventHandler(ignoreCancelled = true)
+ public void quitEvent(PlayerQuitEvent event) {
+ removingPlayers.remove(event.getPlayer().getUniqueId());
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void removeEliteEntity(EntityDamageByEntityEvent event) {
+ if (!removingPlayers.contains(event.getDamager().getUniqueId())) return;
+ EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
+ if (eliteEntity == null) {
+ event.getDamager().sendMessage(ChatColorConverter.convert("&8[EliteMobs] The entity you just removed was not an EliteMobs entity. EliteMobs will still attempt to remove it though."));
+ event.getDamager().sendMessage(ChatColorConverter.convert("&8[EliteMobs] If the entity is supposed to be an EliteMobs entity, it is highly likely some other plugin hijacked the entity and changed it in a way that made EliteMobs unable to recognize it anymore."));
+ event.getEntity().remove();
+ return;
+ }
+ if (eliteEntity instanceof RegionalBossEntity)
+ event.getDamager().sendMessage(ChatColorConverter.convert(
+ "&8[EliteMobs] &cRemoved a spawn location for boss " +
+ ((RegionalBossEntity) eliteEntity).getCustomBossesConfigFields().getFilename()));
+ eliteEntity.remove(RemovalReason.REMOVE_COMMAND);
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void removeNPC(EntityDamageByEntityEvent event) {
+ if (!removingPlayers.contains(event.getDamager().getUniqueId())) return;
+ NPCEntity npcEntity = EntityTracker.getNPCEntity(event.getEntity());
+ if (npcEntity == null) return;
+ npcEntity.remove(RemovalReason.REMOVE_COMMAND);
+ event.setCancelled(true);
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void removeTreasureChest(PlayerInteractEvent event) {
+ if (!removingPlayers.contains(event.getPlayer().getUniqueId())) return;
+ if (event.getClickedBlock() == null) return;
+ TreasureChest treasureChest = TreasureChest.getTreasureChest(event.getClickedBlock().getLocation());
+ if (treasureChest == null) return;
+ treasureChest.removeTreasureChest();
+ event.getPlayer().sendMessage("[EliteMobs] Removed treasure chest!");
+ event.setCancelled(true);
+ event.getClickedBlock().setType(Material.AIR);
+ }
+ }
+
+}
+
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java
new file mode 100644
index 000000000..19552c6e6
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/SimLootCommand.java
@@ -0,0 +1,86 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.config.ItemSettingsConfig;
+import com.magmaguy.elitemobs.items.EliteItemLore;
+import com.magmaguy.elitemobs.items.LootTables;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+/**
+ * Created by MagmaGuy on 08/06/2017.
+ */
+public class SimLootCommand {
+
+ public static void forcePositiveLoot(CommandSender commandSender, String playerName, int level) {
+ Player player = Bukkit.getPlayer(playerName);
+ if (player == null) {
+ commandSender.sendMessage("[EliteMobs] Failed to get a player named \"" + playerName + "\"!");
+ return;
+ }
+ int counter = 0;
+ while (true) {
+ counter++;
+ if (run(player, level, false)) break;
+ if (counter > 1000) {
+ Logger.info("Failed to generate loot within 1000 attempts! This is almost certainly an issue with the way the loot is configured in your server.");
+ break;
+ }
+ }
+ }
+
+ public static void runMultipleTimes(Player player, int level, int timesToRun) {
+ for (int i = 0; i < timesToRun; i++)
+ run(player, level, true);
+ }
+
+ public static void runMultipleTimes(CommandSender player, int level, int timesToRun, String playerName) {
+ Player targetPlayer = Bukkit.getPlayer(playerName);
+ if (targetPlayer == null) {
+ player.sendMessage(ChatColor.RED + "[EliteMobs] Could not send item to player " + playerName + " - player with this name was not found!");
+ return;
+ }
+ for (int i = 0; i < timesToRun; i++)
+ run(targetPlayer, level, true);
+ player.sendMessage("[EliteMobs] Finished running simulation command for player " + playerName + " " + timesToRun + " times at level " + level + " .");
+ }
+
+ public static boolean run(Player player, int level, boolean message) {
+ try {
+ ItemStack itemStack = LootTables.generateLoot(level, player.getLocation(), player);
+ if (itemStack == null) {
+ if (message)
+ player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageFailure()));
+ return false;
+ } else {
+ EliteItemLore eliteItemLore = new EliteItemLore(itemStack, false);
+ if (message)
+ player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageSuccess().replace("$itemName", eliteItemLore.getItemStack().getItemMeta().getDisplayName())));
+ return true;
+ }
+ } catch (Exception ex) {
+ if (message)
+ player.sendMessage(ChatColorConverter.convert(ItemSettingsConfig.getSimlootMessageFailure()));
+ return false;
+ }
+ }
+
+ public static void run(CommandSender player, int level, String playerName) {
+ Player targetPlayer = Bukkit.getPlayer(playerName);
+ if (targetPlayer == null) {
+ player.sendMessage(ChatColor.RED + "[EliteMobs] Could not send item to player " + playerName + " - player with this name was not found!");
+ return;
+ }
+ run(targetPlayer, level, true);
+ player.sendMessage("[EliteMobs] Finished running simulation command for player " + playerName + " at level " + level + " .");
+ }
+
+ public static void simulateSpecialLoot(Player player, int timesToRun) {
+ for (int i = 0; i < timesToRun; i++)
+ LootTables.generateSpecialLoot(player, 0, null);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java
new file mode 100644
index 000000000..d3c5bd302
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/admin/StatsCommand.java
@@ -0,0 +1,101 @@
+package com.magmaguy.elitemobs.commands.admin;
+
+import com.magmaguy.elitemobs.EliteMobs;
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.adventurersguild.GuildRank;
+import com.magmaguy.elitemobs.entitytracker.EntityTracker;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.elitemobs.playerdata.ElitePlayerInventory;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Round;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+
+import java.util.HashMap;
+
+/**
+ * Created by MagmaGuy on 01/05/2017.
+ */
+public class StatsCommand {
+
+ public static void statsHandler(CommandSender commandSender) {
+
+ int aggressiveCount = 0;
+ int passiveCount = 0;
+
+ HashMap entitiesCounted = new HashMap<>();
+
+ for (World world : EliteMobs.validWorldList)
+ for (LivingEntity livingEntity : world.getLivingEntities())
+ if (EntityTracker.isEliteMob(livingEntity)) {
+ aggressiveCount++;
+ if (!entitiesCounted.containsKey(livingEntity.getType()))
+ entitiesCounted.put(livingEntity.getType(), 1);
+ else
+ entitiesCounted.put(livingEntity.getType(), entitiesCounted.get(livingEntity.getType()) + 1);
+ }
+
+ StringBuilder breakdownString = new StringBuilder("&2Breakdown: &a");
+
+ for (EntityType entityType : entitiesCounted.keySet()) {
+ breakdownString.append(entitiesCounted.get(entityType)).append(" ").append(entityType).append("&2, &a");
+ }
+
+ double highestThreat = 0;
+ String highestThreatUser = "";
+ double threatAverage = 0;
+ int highestGuildRank = 0;
+ String highestGuildUser = "";
+ double guildRankAverage = 0;
+ Player highestGuildRankPlayer = null;
+ for (Player player : Bukkit.getOnlinePlayers()) {
+ double currentTier = ElitePlayerInventory.playerInventories.get(player.getUniqueId()).getFullPlayerTier(true);
+ threatAverage += currentTier;
+ int currentGuildRank = GuildRank.getActiveGuildRank(player);
+ guildRankAverage += currentGuildRank;
+ if (currentTier > highestThreat) {
+ highestThreat = currentTier;
+ highestThreatUser = player.getDisplayName();
+ }
+ if (currentGuildRank > highestGuildRank) {
+ highestGuildRankPlayer = player;
+ highestGuildRank = currentGuildRank;
+ highestGuildUser = player.getDisplayName();
+ }
+ }
+ threatAverage /= Bukkit.getOnlinePlayers().size();
+ guildRankAverage /= Bukkit.getOnlinePlayers().size();
+
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "§5§m-----------------------------------------------------"));
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "&7[EM] §a§lEliteMobs v. " + Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDescription().getVersion() + " stats:"));
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "&7[EM] &2There are currently §l§6" + (aggressiveCount + passiveCount) + " §f§2EliteMobs mobs entities in the world, of which &a"
+ + aggressiveCount + " &2are Elite Mobs and &a" + passiveCount + " &2are Super Mobs."));
+ commandSender.sendMessage(ChatColorConverter.convert(breakdownString.toString()));
+ if (highestGuildRankPlayer == null) return;
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "&7[EM] &2Highest online threat tier: &a" + highestThreatUser + " &2at total threat tier &a" + highestThreat));
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "&7[EM] &2Average threat tier: &a" + Round.twoDecimalPlaces(threatAverage)));
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "&7[EM] &2Highest adventurer's guild tier: &a" + highestGuildUser + " &2at guild rank &a" + GuildRank.getRankName(GuildRank.getGuildPrestigeRank(highestGuildRankPlayer), highestGuildRank) + " &2(&a" + highestGuildRank + "&2)"));
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "&7[EM] &2Average guild rank: &a" + Round.twoDecimalPlaces(guildRankAverage)));
+ commandSender.sendMessage(ChatColorConverter.convert(
+ "§5§m-----------------------------------------------------"));
+ commandSender.sendMessage("Tracked boss count: " + EntityTracker.getEliteMobEntities().size());
+ commandSender.sendMessage("Tracked NPC count: " + EntityTracker.getNpcEntities().size());
+ int loadedCounter = 0;
+ for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities())
+ if (regionalBossEntity.isValid())
+ loadedCounter++;
+ commandSender.sendMessage(ChatColorConverter.convert("&7[EM] &2There are &c" + RegionalBossEntity.getRegionalBossEntities().size() + " &2Regional Bosses installed, of which &c" + loadedCounter + " &2are currently loaded."));
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/guiconfig/SignatureItem.java b/src/main/java/com/magmaguy/elitemobs/commands/guiconfig/SignatureItem.java
deleted file mode 100644
index 2707d80ca..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/guiconfig/SignatureItem.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands.guiconfig;
-
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.SkullMeta;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by MagmaGuy on 12/11/2017.
- */
-public class SignatureItem {
-
- public static final ItemStack SIGNATURE_ITEMSTACK = setSignatureItem();
-
- private static ItemStack setSignatureItem() {
-
- ItemStack signature = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta signatureSkullMeta = (SkullMeta) signature.getItemMeta();
- signatureSkullMeta.setOwner("magmaguy");
- signatureSkullMeta.setDisplayName("EliteMobs by MagmaGuy");
- List signatureList = new ArrayList<>();
- signatureList.add("Support the plugins you enjoy!");
- signatureSkullMeta.setLore(signatureList);
- signature.setItemMeta(signatureSkullMeta);
-
- return signature;
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java
new file mode 100644
index 000000000..2c0be348f
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/guild/AdventurersGuildCommand.java
@@ -0,0 +1,37 @@
+package com.magmaguy.elitemobs.commands.guild;
+
+import com.magmaguy.elitemobs.adventurersguild.GuildRankMenuHandler;
+import com.magmaguy.elitemobs.api.PlayerPreTeleportEvent;
+import com.magmaguy.elitemobs.api.PlayerTeleportEvent;
+import com.magmaguy.elitemobs.config.AdventurersGuildConfig;
+import com.magmaguy.elitemobs.config.CombatTagConfig;
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.elitemobs.utils.EventCaller;
+import org.bukkit.entity.Player;
+
+public class AdventurersGuildCommand {
+
+ public static void adventurersGuildCommand(Player player) {
+ if (adventurersGuildTeleport(player)) return;
+ if (player.hasPermission("elitemobs.adventurersguild.command"))
+ GuildRankMenuHandler.initializeGuildRankMenu(player);
+ else
+ player.sendMessage("Missing permission: elitemobs.adventurersguild.command / elitemobs.adventurersguild.teleport");
+ }
+
+ public static boolean adventurersGuildTeleport(Player player) {
+ if (!player.hasPermission("elitemobs.adventurersguild.teleport")) return false;
+ if (!AdventurersGuildConfig.isAgTeleport()) return false;
+
+ EMPackage emPackage = EMPackage.getEmPackages().get("adventurers_guild_hub.yml");
+ if (!emPackage.isInstalled()) return false;
+
+ if (CombatTagConfig.isEnableCombatTag())
+ new EventCaller(new PlayerPreTeleportEvent(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation()));
+ else
+ new EventCaller(new PlayerTeleportEvent(player, emPackage.getDungeonPackagerConfigFields().getTeleportLocation()));
+
+ return true;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/quests/QuestCommand.java b/src/main/java/com/magmaguy/elitemobs/commands/quests/QuestCommand.java
new file mode 100644
index 000000000..c1fa39f9b
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/quests/QuestCommand.java
@@ -0,0 +1,81 @@
+package com.magmaguy.elitemobs.commands.quests;
+
+import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfig;
+import com.magmaguy.elitemobs.config.customquests.CustomQuestsConfigFields;
+import com.magmaguy.elitemobs.playerdata.database.PlayerData;
+import com.magmaguy.elitemobs.quests.CustomQuest;
+import com.magmaguy.elitemobs.quests.Quest;
+import com.magmaguy.elitemobs.quests.QuestTracking;
+import com.magmaguy.elitemobs.quests.playercooldowns.PlayerQuestCooldowns;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+public class QuestCommand {
+
+ private QuestCommand() {
+ }
+
+ public static void completeQuest(String questID, Player player) {
+ try {
+ Quest.completeQuest(UUID.fromString(questID), player);
+ } catch (Exception ex) {
+ player.sendMessage(ChatColor.RED + "[EliteMobs] Invalid quest ID!");
+ }
+ }
+
+ // /em quest join questFilename
+ public static void joinQuest(String questID, Player player) {
+ CustomQuest.startQuest(questID, player);
+ }
+
+ public static void trackQuest(String questID, Player player) {
+ QuestTracking.toggleTracking(player, questID);
+ }
+
+ // /em quest leave questFilename
+ public static void leaveQuest(Player player, String questID) {
+ Quest.stopPlayerQuest(player, questID);
+ }
+
+ public static void resetQuests(CommandSender commandSender, String playerString) {
+ Player player = Bukkit.getPlayer(playerString);
+ if (player == null) {
+ commandSender.sendMessage("[EliteMobs] Error - player name not valid!");
+ return;
+ }
+ PlayerQuestCooldowns.resetPlayerQuests(player);
+ commandSender.sendMessage("[EliteMobs] Successfully reset quests for player " + playerString);
+ }
+
+ public static void resetQuest(CommandSender commandSender, String playerString, String questName) {
+ Player player = Bukkit.getPlayer(playerString);
+ if (player == null) {
+ commandSender.sendMessage("[EliteMobs] Error - player name is not valid!");
+ return;
+ }
+ CustomQuestsConfigFields customQuestsConfigFields = CustomQuestsConfig.getCustomQuests().get(questName);
+ if (customQuestsConfigFields == null) {
+ commandSender.sendMessage("[EliteMobs] Error - quest filename " + questName + " is not valid!");
+ return;
+ }
+ PlayerQuestCooldowns.resetPlayerQuestCooldown(player, customQuestsConfigFields);
+ commandSender.sendMessage("[EliteMobs] Successfully quest " + questName + " for player " + playerString);
+ }
+
+ public static void completeQuest(Player player) {
+ for (Quest quest : new ArrayList(PlayerData.getQuests(player.getUniqueId()))) {
+ quest.getQuestObjectives().setForceOver(true);
+ Quest.completeQuest(quest.getQuestID(), player);
+ }
+ }
+
+ public static void bypassQuestRequirements(Player player) {
+ PlayerQuestCooldowns.toggleBypass(player);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/setup/ResourcePackConfigurer.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/ResourcePackConfigurer.java
new file mode 100644
index 000000000..b364279c7
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/ResourcePackConfigurer.java
@@ -0,0 +1,7 @@
+package com.magmaguy.elitemobs.commands.setup;
+
+public class ResourcePackConfigurer {
+ public static void setup() {
+
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java
new file mode 100644
index 000000000..459eaa264
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/commands/setup/SetupMenu.java
@@ -0,0 +1,278 @@
+package com.magmaguy.elitemobs.commands.setup;
+
+import com.magmaguy.elitemobs.config.menus.premade.GetLootMenuConfig;
+import com.magmaguy.elitemobs.dungeons.EMPackage;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.ItemStackGenerator;
+import com.magmaguy.magmacore.util.Logger;
+import lombok.Getter;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.inventory.InventoryCloseEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.*;
+
+public class SetupMenu {
+
+ private static final int nextIcon = 35;
+ private static final int infoIcon = 4;
+ public static Map setupMenus = new HashMap<>();
+ private static List emPackages = new ArrayList<>();
+ private final int previousIcon = 27;
+ Inventory inventory;
+ Player player;
+ ArrayList validSlots = new ArrayList<>(new ArrayList<>(List.of(10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23,
+ 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43, 46, 47, 48, 49, 50, 51, 52)));
+ HashMap minidungeonHashMap = new HashMap<>();
+ @Getter
+ private int currentPage = 1;
+
+ public SetupMenu(Player player) {
+ this.inventory = Bukkit.createInventory(player, 54, "Setup menu");
+ this.player = player;
+ redrawMenu(1, inventory);
+ }
+
+ private static void resourcePackButtonInteraction(Player player, SetupMenu setupMenu) {
+ player.closeInventory();
+ player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &2Processing your request, please wait...\n"));
+ if (!player.hasPermission("elitemobs.*")) {
+ player.sendMessage("[EliteMobs] You do not have the required permission (elitemobs.*) to do that!");
+ return;
+ }
+
+ Logger.sendMessage(player, "This setting is now no longer in use! Use my ResourcePackManager plugin to easily and automatically merge & host the EliteMobs resource pack, and much more!");
+ return;
+//
+// if (ResourcePackDataConfig.isEliteMobsResourcePackEnabled()) {
+// //Case for if it is downloaded
+// ResourcePackDataConfig.toggleEliteMobsResourcePackStatus(false);
+// } else {
+// ResourcePackDataConfig.toggleEliteMobsResourcePackStatus(true);
+// player.spigot().sendMessage(SpigotMessage.simpleMessage("&8[EliteMobs] &2The EliteMobs resource pack has been installed!"));
+// player.spigot().sendMessage(SpigotMessage.commandHoverMessage("&eBefore you go! &fDo you want to force players to use the resource pack? This is necessary if you plan to use &cModelEngine for the custom boss models. &aClick here if you want to force resource packs. &eIgnore this message if you don't!", "Click to force resource packs!", "/elitemobs forceresourcepack"));
+// }
+ }
+
+// public static void forceResourcePack(Player player) {
+// ResourcePackDataConfig.toggleForceResourcePack(true);
+// player.sendMessage("[EliteMobs] Using the resource pack is now mandatory!");
+// }
+
+ private static void dungeonButtonInteraction(Player player, SetupMenu setupMenu, InventoryClickEvent event) {
+ //for minidungeons
+ EMPackage emPackage = setupMenu.minidungeonHashMap.get(event.getSlot());
+ if (emPackage != null) {
+ if (!emPackage.isDownloaded()) {
+ player.sendMessage("----------------------------------------------------");
+ player.sendMessage(ChatColorConverter.convert("&4Download this at &9" + emPackage.getDungeonPackagerConfigFields().getDownloadLink() + " &4!"));
+ player.sendMessage("----------------------------------------------------");
+ player.closeInventory();
+ setupMenus.remove(event.getInventory());
+ return;
+ }
+ if (!emPackage.isInstalled())
+ emPackage.install(player);
+ else if (!emPackage.uninstall(player)) {
+ player.sendMessage("[EliteMobs] Failed to unload package because players were present in the worlds you were trying to unload! Remove the players from the dungeon before uninstalling it!");
+ }
+ setupMenus.remove(event.getInventory());
+ player.closeInventory();
+ }
+ }
+
+ private void redrawMenu(int page, Inventory inventory) {
+ currentPage = page;
+ setupMenus.remove(inventory);
+ this.inventory = inventory;
+ inventory.clear();
+ //reserve resource pack status
+ customResourcePackStatus();
+ //iterate through dungeons
+ dungeonStatuses();
+ //Set icons
+ addNavigationElements();
+ player.openInventory(inventory);
+ setupMenus.put(inventory, this);
+ }
+
+ private void addNavigationElements() {
+ ItemStack infoButton = GetLootMenuConfig.infoItem;
+ List lore = ChatColorConverter.convert(List.of("&2To setup optional/recommended content for EliteMobs:",
+ "&61) &fDownload content from &9magmaguy.itch.io &for &9patreon.com/magmaguy",
+ "&62) &fPut content in the &2imports &ffolder of EliteMobs",
+ "&63) &fDo &2/em reload",
+ "&64) &fDo &2/em setup",
+ "&65) &fClick on &eyellow &ficons to install!",
+ "Click to get more info!"));
+ ItemMeta itemMeta = infoButton.getItemMeta();
+ itemMeta.setLore(lore);
+ infoButton.setItemMeta(itemMeta);
+ inventory.setItem(infoIcon, infoButton);
+
+ ItemStack previousButton = GetLootMenuConfig.previousLootItem;
+ ItemMeta previousButtonMeta = previousButton.getItemMeta();
+ previousButtonMeta.setDisplayName("Previous page");
+ previousButton.setItemMeta(previousButtonMeta);
+ if (currentPage > 1)
+ inventory.setItem(previousIcon, previousButton);
+
+ ItemStack nextButton = GetLootMenuConfig.nextLootItem;
+ ItemMeta nextButtonMeta = nextButton.getItemMeta();
+ nextButtonMeta.setDisplayName("Next page");
+ nextButton.setItemMeta(nextButtonMeta);
+ int totalPages = (int) Math.ceil(emPackages.size() / 28d);
+ if (totalPages > 1 && currentPage < totalPages)
+ inventory.setItem(nextIcon, nextButton);
+ }
+
+ private void dungeonStatuses() {
+ //Counter has to account for pages
+ int dungeonCounter = 0;
+ int inventoryLocationCounter = 0;
+ if (currentPage != 1)
+ dungeonCounter = validSlots.size() * (currentPage - 1) - 2;
+ else
+ inventoryLocationCounter = 1;
+ List rawEmPackages = EMPackage.getEmPackages().values().stream().toList();
+ List alphabeticalSort = new ArrayList<>();
+ rawEmPackages.forEach(iteratedPackage -> alphabeticalSort.add(ChatColor.stripColor(ChatColorConverter.convert(iteratedPackage.getDungeonPackagerConfigFields().getName()))));
+ Collections.sort(alphabeticalSort);
+ emPackages = new ArrayList<>();
+ alphabeticalSort.forEach(entry -> rawEmPackages.forEach(iteratedPackage -> {
+ if (ChatColor.stripColor(ChatColorConverter.convert(iteratedPackage.getDungeonPackagerConfigFields().getName())).equals(entry))
+ emPackages.add(iteratedPackage);
+ }));
+ minidungeonHashMap.clear();
+ for (int i = dungeonCounter; i < emPackages.size(); i++) {
+ if (currentPage == 1 && minidungeonHashMap.size() > validSlots.size() - 2) break;
+ if (inventoryLocationCounter >= validSlots.size()) break;
+ EMPackage emPackage = emPackages.get(i);
+
+ addDungeonPackagerContent(emPackage, inventoryLocationCounter);
+
+ minidungeonHashMap.put(validSlots.get(inventoryLocationCounter), emPackage);
+ dungeonCounter++;
+ inventoryLocationCounter++;
+ }
+ }
+
+ private void addDungeonPackagerContent(EMPackage emPackage, int counter) {
+ String itemName = emPackage.getDungeonPackagerConfigFields().getName();
+ List lore = new ArrayList<>();
+
+ addSize(lore, emPackage);
+ //boss count can't be calculated ahead of time here, unfortunately
+ addInstallationString(lore, emPackage);
+
+ lore = ChatColorConverter.convert(lore);
+ inventory.setItem(validSlots.get(counter), ItemStackGenerator.generateItemStack(getMaterial(emPackage), itemName, lore));
+ }
+
+ private Material getMaterial(EMPackage emPackage) {
+ if (emPackage.isOutOfDate())
+ return Material.ORANGE_STAINED_GLASS_PANE;
+ if (emPackage.isInstalled())
+ return Material.GREEN_STAINED_GLASS_PANE;
+ if (emPackage.isDownloaded())
+ return Material.YELLOW_STAINED_GLASS_PANE;
+ return Material.RED_STAINED_GLASS_PANE;
+ }
+
+ private void addSize(List lore, EMPackage emPackage) {
+ lore.add("&fSize: " + emPackage.getDungeonPackagerConfigFields().getDungeonSizeCategory().toString());
+ }
+
+ private void addInstallationString(List lore, EMPackage emPackage) {
+ String status = "&fStatus: ";
+ if (emPackage.isOutOfDate()) {
+ lore.add(status + "&4outdated!");
+ lore.add("&4Download the update at");
+ lore.add("&9" + emPackage.getDungeonPackagerConfigFields().getDownloadLink() + " &f!");
+ lore.add("&cClick to uninstall!");
+ return;
+ }
+ if (emPackage.isInstalled()) {
+ lore.add(status + "&2already installed!");
+ lore.add("&cClick to uninstall!");
+ return;
+ }
+ if (!emPackage.isDownloaded()) {
+ lore.add(status + "&4not downloaded!");
+ lore.add("&4Download this at");
+ lore.add("&9" + emPackage.getDungeonPackagerConfigFields().getDownloadLink() + " &f!");
+ return;
+ }
+ lore.add(status + "&aready to install!");
+ lore.add("&2Click to install!");
+ }
+
+ private void customResourcePackStatus() {
+ if (currentPage != 1) return;
+ String state = "Custom resource pack is";
+ String lore;
+ Material material;
+ boolean resourceState = Bukkit.getPluginManager().isPluginEnabled("ResourcePackManager");
+
+ if (!resourceState) {
+ material = Material.YELLOW_STAINED_GLASS_PANE;
+ lore = ChatColor.RED + "Not enabled! Click to enable!";
+ } else {
+ material = Material.GREEN_STAINED_GLASS_PANE;
+ lore = ChatColor.GREEN + "Working correctly! Click to disable!";
+ }
+
+ inventory.setItem(validSlots.get(0), ItemStackGenerator.generateItemStack(material, state, new ArrayList<>(List.of(lore))));
+ }
+
+ public static class SetupMenuListeners implements Listener {
+ @EventHandler(ignoreCancelled = true)
+ public void onInventoryInteraction(InventoryClickEvent event) {
+ SetupMenu setupMenu = setupMenus.get(event.getInventory());
+ if (setupMenu == null) return;
+ event.setCancelled(true);
+ Player player = (Player) event.getWhoClicked();
+ //for resource pack
+ if (event.getSlot() == 10 && setupMenu.getCurrentPage() == 1) {
+ resourcePackButtonInteraction(player, setupMenu);
+ return;
+ }
+ //for permissions mode
+ if (event.getSlot() == infoIcon) {
+ player.sendMessage(
+ "EliteMobs installation process:",
+ "Wiki page: https://github.com/MagmaGuy/EliteMobs/wiki/%5BGuide%5D-Quick-Setup",
+ "Video version: https://youtu.be/boRg2X4qhw4",
+ "Download links: free & premium https://magmaguy.itch.io/ | premium-only https://www.patreon.com/magmaguy",
+ "Discord support: https://discord.gg/9f5QSka");
+ player.closeInventory();
+ return;
+ }
+ if (event.getSlot() == setupMenu.previousIcon && event.getCurrentItem() != null) {
+ setupMenu.redrawMenu(setupMenu.getCurrentPage() - 1, event.getInventory());
+ return;
+ }
+ if (event.getSlot() == nextIcon && event.getCurrentItem() != null) {
+ setupMenu.redrawMenu(setupMenu.getCurrentPage() + 1, event.getInventory());
+ return;
+ }
+
+ dungeonButtonInteraction(player, setupMenu, event);
+ }
+
+ @EventHandler
+ public void onClose(InventoryCloseEvent event) {
+ setupMenus.remove(event.getInventory());
+ }
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/shops/CustomShopHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/shops/CustomShopHandler.java
deleted file mode 100644
index 2a34f505f..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/shops/CustomShopHandler.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands.shops;
-
-import com.magmaguy.elitemobs.commands.guiconfig.SignatureItem;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.EconomySettingsConfig;
-import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.economy.UUIDFilter;
-import com.magmaguy.elitemobs.items.CustomItemConstructor;
-import com.magmaguy.elitemobs.items.ItemWorthCalculator;
-import com.magmaguy.elitemobs.items.ObfuscatedSignatureLoreData;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.List;
-import java.util.Random;
-
-/**
- * Created by MagmaGuy on 20/06/2017.
- */
-public class CustomShopHandler implements Listener {
-
- public static final String SHOP_NAME = ConfigValues.economyConfig.getString(EconomySettingsConfig.CUSTOM_SHOP_NAME);
-
- public void initializeShop(Player player) {
-
- Inventory shopInventory = Bukkit.createInventory(player, 54, SHOP_NAME);
-
- populateShop(shopInventory);
-
- player.openInventory(shopInventory);
-
- }
-
- private void populateShop(Inventory shopInventory) {
-
- SharedShopElements.shopHeader(shopInventory);
- shopContents(shopInventory);
-
- }
-
- private static List validSlots = (List) ConfigValues.economyConfig.getList(EconomySettingsConfig.CUSTOM_SHOP_VALID_SLOTS);
-
- private void shopContents(Inventory shopInventory) {
-
- //Anything after 8 is populated
- Random random = new Random();
-
- for (int i : validSlots) {
-
- int itemEntryIndex = random.nextInt(CustomItemConstructor.customItemList.size());
-
- shopInventory.setItem(i, CustomItemConstructor.customItemList.get(itemEntryIndex));
-
- }
-
- }
-
- @EventHandler
- public void onClick(InventoryClickEvent event) {
-
- if (!SharedShopElements.inventoryNullPointerPreventer(event)) {
-
- return;
-
- }
-
- if (!event.getInventory().getName().equals(SHOP_NAME)) return;
-
- //reroll loot button
- if (event.getCurrentItem().getItemMeta().getDisplayName().equals(SignatureItem.SIGNATURE_ITEMSTACK.getItemMeta().getDisplayName())) {
-
- populateShop(event.getInventory());
- event.setCancelled(true);
- return;
-
- }
-
- if (!ObfuscatedSignatureLoreData.obfuscatedSignatureDetector(event.getCurrentItem())) {
-
- event.setCancelled(true);
- return;
-
- }
-
- Player player = (Player) event.getWhoClicked();
- ItemStack itemStack = event.getCurrentItem();
- String itemDisplayName = event.getCurrentItem().getItemMeta().getDisplayName();
-
- double itemValue = ItemWorthCalculator.determineItemWorth(itemStack);
-
- //These slots are for buying items
- if (validSlots.contains(event.getSlot()) && event.getClickedInventory().getName().equalsIgnoreCase(SHOP_NAME)) {
-
- boolean inventoryHasFreeSlots = false;
- for (ItemStack iteratedStack : player.getInventory()) {
-
- if (iteratedStack == null) {
-
- inventoryHasFreeSlots = true;
- break;
-
- }
-
- }
-
- if (!inventoryHasFreeSlots) {
-
- player.sendMessage("Your inventory is full! You can't buy items until you get some free space.");
- player.closeInventory();
-
- } else if (EconomyHandler.checkCurrency(UUIDFilter.guessUUI(player.getName())) >= itemValue) {
- //player has enough money
- EconomyHandler.subtractCurrency(UUIDFilter.guessUUI(player.getName()), itemValue);
- player.getInventory().addItem(itemStack);
- populateShop(event.getInventory());
-
- SharedShopElements.buyMessage(player, itemDisplayName, itemValue);
-
- } else {
-
- player.closeInventory();
- SharedShopElements.insufficientFundsMessage(player, itemValue);
-
- }
-
- }
-
- event.setCancelled(true);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/shops/ItemSaleEvent.java b/src/main/java/com/magmaguy/elitemobs/commands/shops/ItemSaleEvent.java
deleted file mode 100644
index 8d3845a43..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/shops/ItemSaleEvent.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands.shops;
-
-import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.economy.UUIDFilter;
-import com.magmaguy.elitemobs.items.ItemWorthCalculator;
-import com.magmaguy.elitemobs.items.ObfuscatedSignatureLoreData;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.ItemStack;
-
-public class ItemSaleEvent implements Listener {
-
- @EventHandler
- public void playerSellEvent(InventoryClickEvent event) {
-
- if (!SharedShopElements.sellInventoryNullPointerPreventer(event)) {
-
- return;
-
- }
-
- if (!event.getInventory().getName().equals(ShopHandler.SHOP_NAME) &&
- !event.getInventory().getName().equals(CustomShopHandler.SHOP_NAME)) {
-
- return;
-
- }
-
- if (event.getClickedInventory().getName().equals(ShopHandler.SHOP_NAME) ||
- event.getClickedInventory().getName().equals(CustomShopHandler.SHOP_NAME)) {
-
- return;
-
- }
-
- if (!ObfuscatedSignatureLoreData.obfuscatedSignatureDetector(event.getCurrentItem())) {
-
- event.setCancelled(true);
- return;
-
- }
-
- Player player = (Player) event.getWhoClicked();
- ItemStack itemStack = event.getCurrentItem();
- String itemDisplayName = itemStack.getItemMeta().getDisplayName();
-
- double amountDeduced = ItemWorthCalculator.determineResaleWorth(itemStack);
-
- EconomyHandler.addCurrency(UUIDFilter.guessUUI(player.getName()), amountDeduced);
-
- if (event.getCurrentItem().getAmount() == 1) {
-
- event.setCurrentItem(new ItemStack(Material.AIR));
-
- } else if (event.getCurrentItem().getAmount() > 1) {
-
- int newAmount = event.getCurrentItem().getAmount() - 1;
-
- event.getCurrentItem().setAmount(newAmount);
-
- }
-
- SharedShopElements.sellMessage(player, itemDisplayName, amountDeduced);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/shops/SharedShopElements.java b/src/main/java/com/magmaguy/elitemobs/commands/shops/SharedShopElements.java
deleted file mode 100644
index 9d9e7a128..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/shops/SharedShopElements.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands.shops;
-
-import com.magmaguy.elitemobs.MetadataHandler;
-import com.magmaguy.elitemobs.commands.guiconfig.SignatureItem;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.EconomySettingsConfig;
-import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.economy.UUIDFilter;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
-public class SharedShopElements {
-
- public static void shopHeader(Inventory shopInventory) {
-
- ItemStack signature = SignatureItem.SIGNATURE_ITEMSTACK;
-
- shopInventory.setItem(ConfigValues.economyConfig.getInt(EconomySettingsConfig.SIGNATURE_ITEM_LOCATION_SHOPS), signature);
-
- }
-
- public static boolean inventoryNullPointerPreventer(InventoryClickEvent event) {
-
- //Check if economy is enabled
- if (!ConfigValues.economyConfig.getBoolean(EconomySettingsConfig.ENABLE_ECONOMY)) return false;
- //Check if current item is valid
- if (event.getCurrentItem() == null) return false;
- if (event.getCurrentItem().getType().equals(Material.AIR)) return false;
- if (event.getCurrentItem().getItemMeta() == null) return false;
- return event.getCurrentItem().getItemMeta().hasLore();
-
- }
-
- public static boolean sellInventoryNullPointerPreventer(InventoryClickEvent event) {
-
- //Check if economy is enabled
- if (!ConfigValues.economyConfig.getBoolean(EconomySettingsConfig.ENABLE_ECONOMY)) return false;
- //Check if current item is valid
- if (event.getCurrentItem() == null) return false;
- return !event.getCurrentItem().getType().equals(Material.AIR);
- }
-
- public static void buyMessage(Player player, String itemDisplayName, double itemValue) {
-
- new BukkitRunnable() {
-
- @Override
- public void run() {
-
- player.sendMessage(ChatColor.GREEN + "You have bought " + itemDisplayName + " for " + ChatColor.DARK_GREEN + itemValue + " " + ChatColor.GREEN + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME));
- player.sendMessage(ChatColor.GREEN + "You have " + ChatColor.DARK_GREEN + EconomyHandler.checkCurrency(UUIDFilter.guessUUI(player.getName())) + " " + ChatColor.GREEN + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME));
-
- }
-
-
- }.runTaskLater(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS), 2);
-
- }
-
- public static void insufficientFundsMessage(Player player, double itemValue) {
-
- new BukkitRunnable() {
-
- @Override
- public void run() {
-
- player.sendMessage(ChatColor.RED + "You don't have enough " + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME) + "!");
- player.sendMessage(ChatColor.GREEN + "You have " + ChatColor.DARK_GREEN + EconomyHandler.checkCurrency(UUIDFilter.guessUUI(player.getName())) + " " + ChatColor.GREEN + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME));
- player.sendMessage(ChatColor.GREEN + "That item cost " + ChatColor.DARK_GREEN + itemValue + " " + ChatColor.GREEN + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME) + ".");
-
- }
-
-
- }.runTaskLater(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS), 2);
-
- player.closeInventory();
-
- }
-
- public static void sellMessage(Player player, String itemDisplayName, double amountDeduced) {
-
- player.sendMessage("You have sold " + itemDisplayName + " for " + amountDeduced + " " + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME));
-
- new BukkitRunnable() {
-
- @Override
- public void run() {
-
- player.sendMessage("You have " + EconomyHandler.checkCurrency(UUIDFilter.guessUUI(player.getName())) + " " + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME));
-
- }
-
-
- }.runTaskLater(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS), 2);
-
- }
-
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/commands/shops/ShopHandler.java b/src/main/java/com/magmaguy/elitemobs/commands/shops/ShopHandler.java
deleted file mode 100644
index 10b24e2e3..000000000
--- a/src/main/java/com/magmaguy/elitemobs/commands/shops/ShopHandler.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.commands.shops;
-
-import com.magmaguy.elitemobs.commands.guiconfig.SignatureItem;
-import com.magmaguy.elitemobs.config.ConfigValues;
-import com.magmaguy.elitemobs.config.EconomySettingsConfig;
-import com.magmaguy.elitemobs.economy.EconomyHandler;
-import com.magmaguy.elitemobs.economy.UUIDFilter;
-import com.magmaguy.elitemobs.items.ItemWorthCalculator;
-import com.magmaguy.elitemobs.items.ObfuscatedSignatureLoreData;
-import com.magmaguy.elitemobs.items.itemconstructor.ItemConstructor;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.List;
-import java.util.Random;
-
-/**
- * Created by MagmaGuy on 17/06/2017.
- */
-public class ShopHandler implements Listener {
-
- public static final String SHOP_NAME = ConfigValues.economyConfig.getString(EconomySettingsConfig.SHOP_NAME);
-
- public void initializeShop(Player player) {
-
- Inventory shopInventory = Bukkit.createInventory(player, 54, SHOP_NAME);
-
- populateShop(shopInventory);
-
- player.openInventory(shopInventory);
-
- }
-
- private void populateShop(Inventory shopInventory) {
-
- SharedShopElements.shopHeader(shopInventory);
- shopContents(shopInventory);
-
- }
-
- private static List validSlots = (List) ConfigValues.economyConfig.getList(EconomySettingsConfig.SHOP_VALID_SLOTS);
-
- private void shopContents(Inventory shopInventory) {
-
- Random random = new Random();
-
- for (int i : validSlots) {
-
- int balancedMax = ConfigValues.economyConfig.getInt(EconomySettingsConfig.HIGHEST_PROCEDURALLY_SIMULATED_LOOT)
- - ConfigValues.economyConfig.getInt(EconomySettingsConfig.LOWEST_PROCEDURALLY_SIMULATED_LOOT);
- int balancedMin = ConfigValues.economyConfig.getInt(EconomySettingsConfig.LOWEST_PROCEDURALLY_SIMULATED_LOOT);
-
- int randomTier = random.nextInt(balancedMax) + balancedMin;
-
- shopInventory.setItem(i, ItemConstructor.constructItem(randomTier, null));
-
- }
-
- }
-
- @EventHandler
- public void onClick(InventoryClickEvent event) {
-
- if (!SharedShopElements.inventoryNullPointerPreventer(event))
- return;
-
- if (!event.getInventory().getName().equals(SHOP_NAME)) return;
-
- //reroll loot button
- if (event.getCurrentItem().getItemMeta().getDisplayName().equals(SignatureItem.SIGNATURE_ITEMSTACK.getItemMeta().getDisplayName())) {
-
- populateShop(event.getInventory());
- event.setCancelled(true);
- return;
-
- }
-
- if (!ObfuscatedSignatureLoreData.obfuscatedSignatureDetector(event.getCurrentItem())) {
-
- event.setCancelled(true);
- return;
-
- }
-
- Player player = (Player) event.getWhoClicked();
- ItemStack itemStack = event.getCurrentItem();
- String itemDisplayName = itemStack.getItemMeta().getDisplayName();
-
- double itemValue = ItemWorthCalculator.determineItemWorth(itemStack);
-
- boolean inventoryHasFreeSlots = false;
- for (ItemStack iteratedStack : player.getInventory().getStorageContents()) {
-
- if (iteratedStack == null) {
-
- inventoryHasFreeSlots = true;
- break;
-
- }
-
- }
-
- //These slots are for buying items
- if (event.getClickedInventory().getName().equalsIgnoreCase(SHOP_NAME) && validSlots.contains(event.getSlot())) {
-
- if (!inventoryHasFreeSlots) {
-
- player.sendMessage("Your inventory is full! You can't buy items until you get some free space.");
- player.closeInventory();
-
- } else if (EconomyHandler.checkCurrency(UUIDFilter.guessUUI(player.getName())) >= itemValue) {
- //player has enough money
- EconomyHandler.subtractCurrency(UUIDFilter.guessUUI(player.getName()), itemValue);
- player.getInventory().addItem(itemStack);
- populateShop(event.getInventory());
-
- SharedShopElements.buyMessage(player, itemDisplayName, itemValue);
-
- } else {
-
- player.closeInventory();
- SharedShopElements.insufficientFundsMessage(player, itemValue);
-
- }
-
- }
-
- event.setCancelled(true);
-
- }
-
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java
index 919bf63f8..e29f97515 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/AdventurersGuildConfig.java
@@ -1,25 +1,505 @@
package com.magmaguy.elitemobs.config;
-import org.bukkit.configuration.Configuration;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import lombok.Getter;
-public class AdventurersGuildConfig {
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
- public static final String CONFIG_NAME = "AdventurersGuild.yml";
+public class AdventurersGuildConfig extends ConfigurationFile {
+ @Getter
+ private static final String[][] rankNames = new String[11][21];
+ @Getter
+ private static final String[][] shortRankNames = new String[11][21];
+ @Getter
+ private static boolean addMaxHealth;
+ @Getter
+ private static boolean addCrit;
+ @Getter
+ private static boolean addDodge;
+ @Getter
+ private static boolean agTeleport;
+ @Getter
+ private static boolean guildLootLimiter;
+ @Getter
+ private static String lootLimiterMessage;
+ @Getter
+ private static List onRankUpCommand;
+ @Getter
+ private static List onPrestigeUpCommand;
+ @Getter
+ private static double dodge1;
+ @Getter
+ private static double dodge2;
+ @Getter
+ private static double dodge3;
+ @Getter
+ private static double crit1;
+ @Getter
+ private static double crit2;
+ @Getter
+ private static double crit3;
+ @Getter
+ private static double health1;
+ @Getter
+ private static double health2;
+ @Getter
+ private static double health3;
+ @Getter
+ private static double health4;
+ @Getter
+ private static String adventurersGuildMenuName;
+ @Getter
+ private static int baseKillsForRankUp;
+ @Getter
+ private static int additionalKillsForRankUpPerTier;
+ @Getter
+ private static String prestigeUnlockMessageTitle;
+ @Getter
+ private static String prestigeUnlockMessageSubtitle;
+ @Getter
+ private static List worldsWithoutAGBonuses;
+ @Getter
+ private static double peacefulModeEliteChanceDecrease;
+ @Getter
+ private static boolean disableCommonerRank;
- public static final String ENABLE_ADVENTURERS_GUILD = "Enable adventurer's guild";
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
+ public AdventurersGuildConfig() {
+ super("AdventurersGuild.yml");
+ }
- public void initializeConfig(){
+ public static String getRankName(int prestigeTier, int rankTier) {
+ return ChatColorConverter.convert(rankNames[prestigeTier][rankTier]);
+ }
- configuration.addDefault(ENABLE_ADVENTURERS_GUILD, true);
+ public static String getShortenedRankName(int prestigeTier, int rankTier) {
+ return ChatColorConverter.convert(shortRankNames[prestigeTier][rankTier]);
+ }
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
+ private static String prestigeColors(int prestigeTier) {
+ switch (prestigeTier) {
+ case 1:
+ return "&e";
+ case 2:
+ return "&2";
+ case 3:
+ return "&a";
+ case 4:
+ return "&3";
+ case 5:
+ return "&b";
+ case 6:
+ return "&4";
+ case 7:
+ return "&c";
+ case 8:
+ return "&9";
+ case 9:
+ return "&d";
+ case 10:
+ return "&5";
+ default:
+ return "error";
+ }
+ }
+ private static String romanNumerals(int prestigeTier) {
+ switch (prestigeTier) {
+ case 1:
+ return "Ⅰ";
+ case 2:
+ return "ⅠⅠ";
+ case 3:
+ return "ⅠⅠⅠ";
+ case 4:
+ return "ⅠⅤ";
+ case 5:
+ return "Ⅴ";
+ case 6:
+ return "ⅤⅠ";
+ case 7:
+ return "ⅤⅠⅠ";
+ case 8:
+ return "ⅤⅠⅠⅠ";
+ case 9:
+ return "ⅠⅩ";
+ case 10:
+ return "Ⅹ";
+ case 11:
+ return "ⅩⅠ";
+ case 12:
+ return "ⅩⅠⅠ";
+ case 13:
+ return "ⅩⅠⅠⅠ";
+ case 14:
+ return "ⅩⅠⅤ";
+ case 15:
+ return "ⅩⅤ";
+ case 16:
+ return "ⅩⅤⅠ";
+ case 17:
+ return "ⅩⅤⅠⅠ";
+ case 18:
+ return "ⅩⅤⅠⅠⅠ";
+ case 19:
+ return "ⅩⅠⅩ";
+ case 20:
+ return "ⅩⅩ";
+ case 0:
+ return "0";
+ default:
+ return "error";
+ }
}
+ @Override
+ public void initializeValues() {
+ addMaxHealth = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will add max health when unlocking guild ranks as a prestige reward"),
+ fileConfiguration, "Add max health when unlocking higher guild ranks", true);
+ addCrit = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will add a critical strike chance when unlocking guild ranks as a prestige reward"),
+ fileConfiguration, "Add critical chance when unlocking higher guild ranks", true);
+ addDodge = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will add dodge chance when unlocking guild ranks as a prestige reward"),
+ fileConfiguration, "Add dodge chance when unlocking higher guild ranks", true);
+ agTeleport = ConfigurationEngine.setBoolean(
+ List.of("Sets if user commands get rerouted to the adventurer's guild hub. This is highly recommended for gameplay immersion and tutorial purposes."),
+ fileConfiguration, "userCommandsTeleportToAdventurersGuild", true);
+ adventurersGuildMenuName = ConfigurationEngine.setString(
+ List.of("Sets the in-game display name of the adventurer's guild"),
+ file, fileConfiguration, "adventurersGuildMenuName", "&6&lAdventurer's Hub", true);
+
+ //iterate through all prestige tiers
+ for (int prestigeRank = 0; prestigeRank < 11; prestigeRank++)
+ for (int normalRank = 0; normalRank < 11 + prestigeRank; normalRank++) {
+ String rankName = "";
+ String shortRankName = "";
+ switch (normalRank) {
+ case 0:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&8Commoner - disables elites!", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &8Commoner", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 1:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&fRookie", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &fRookie", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 2:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&fNovice", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &fNovice", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 3:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&fApprentice", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &fApprentice", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 4:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&2Adventurer", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &2Adventurer", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 5:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&2Journeyman", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &2Journeyman", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 6:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&2Adept", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &2Adept", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 7:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&1Veteran", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &1Veteran", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 8:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&1Elite", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &1Elite", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 9:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&lMaster", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Master", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 10:
+ if (prestigeRank == 0) {
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, "&5Hero", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", "&6&l✧&e" + romanNumerals(normalRank), true);
+ } else {
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Hero", true);
+ }
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 11:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Legend", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 12:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Myth", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 13:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Immortal", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 14:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Chosen", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 15:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Ascendant", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 16:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Titan", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 17:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Demigod", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 18:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Deity", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 19:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Godhunter", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ case 20:
+ rankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank, prestigeColors(prestigeRank) + "Prestige " + prestigeRank + " &5Godslayer", true);
+ shortRankName = ConfigurationEngine.setString(file, fileConfiguration,
+ "Prestige " + prestigeRank + " rank " + normalRank + " short placeholder", prestigeColors(prestigeRank) + "⚜" + romanNumerals(prestigeRank) + "&6&l✧&e" + romanNumerals(normalRank), true);
+ rankNames[prestigeRank][normalRank] = rankName;
+ shortRankNames[prestigeRank][normalRank] = shortRankName;
+ break;
+ default:
+ throw new IllegalStateException("Unexpected value: " + normalRank);
+ }
+
+ }
+
+ guildLootLimiter = ConfigurationEngine.setBoolean(
+ List.of("Sets if player loot is limited by their guild level.",
+ " This is an incredibly important part of EliteMobs and extremely highly recommended."),
+ fileConfiguration, "limitLootBasedOnGuildTier", true);
+ lootLimiterMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players if their loot gets nerfed due to their low guild level."),
+ file, fileConfiguration, "lootLimiterMessage", "&7[EM] &cYou must unlock the next guild rank through /ag to loot better items!", true);
+ onRankUpCommand = ConfigurationEngine.setList(
+ List.of("Sets the commands that run on guild rank up. Placeholders are:", "$prestigerank - outputs the prestige rank", "$activerank - outputs the currently active rank", "$player - outputs the player name"),
+ file, fileConfiguration, "onRankUpCommand", Collections.emptyList(), false);
+ onPrestigeUpCommand = ConfigurationEngine.setList(
+ List.of("Sets the commands that run on prestige rank up.", "$prestigerank - outputs the prestige rank", "$activerank - outputs the currently active rank", "$player - outputs the player name"),
+ file, fileConfiguration, "onPrestigeUpCommand", Collections.emptyList(), false);
+ dodge1 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the first dodge bonus."),
+ fileConfiguration, "dodgePrestige3Bonus", 3);
+ dodge2 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the second dodge bonus."),
+ fileConfiguration, "dodgePrestige6Bonus", 6);
+ dodge3 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the third dodge bonus."),
+ fileConfiguration, "dodgePrestige9Bonus", 10);
+ crit1 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the first critical hit bonus."),
+ fileConfiguration, "critPrestige2Bonus", 3);
+ crit2 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the second critical hit bonus."),
+ fileConfiguration, "critPrestige5Bonus", 6);
+ crit3 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the third critical hit bonus."),
+ fileConfiguration, "critPrestige8Bonus", 10);
+ health1 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the first max health bonus."),
+ fileConfiguration, "healthPrestige1Bonus", 2);
+ health2 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the second max health bonus."),
+ fileConfiguration, "healthPrestige4Bonus", 2.5);
+ health3 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the third max health bonus."),
+ fileConfiguration, "healthPrestige7Bonus", 3);
+ health4 = ConfigurationEngine.setDouble(
+ List.of("Sets the prestige level for the third max health bonus."),
+ fileConfiguration, "healthPrestige10Bonus", 4);
+
+ baseKillsForRankUp = ConfigurationEngine.setInt(
+ List.of("Sets the estimated base amount of bosses that must be killed to be able to afford a rank up."),
+ fileConfiguration, "baseKillsForRankUpV2", 100);
+ additionalKillsForRankUpPerTier = ConfigurationEngine.setInt(
+ List.of("Sets the estimated additional amount of bosses that must be killed to be able to rank up, per level.",
+ "The formula is this amount x the level the player is currently at."),
+ fileConfiguration, "additionalKillsForRankUpPerTierV2", 50);
+
+ prestigeUnlockMessageTitle = ConfigurationEngine.setString(
+ List.of("Sets title sent to players when someone unlocks a prestige rank.",
+ "$player is a placeholder that gets replaced with the player's display name."),
+ file, fileConfiguration, "prestigeUnlockMessageTitle", "$player", true);
+ prestigeUnlockMessageSubtitle = ConfigurationEngine.setString(
+ List.of("Sets subtitle sent to players when someone unlocks a prestige rank.",
+ "$tier is a placeholder that gets replaced with the player's prestige level."),
+ file, fileConfiguration, "prestigeUnlockMessageSubtitle", "&2has unlocked $tier&2!", true);
+
+ peacefulModeEliteChanceDecrease = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier that will be applied to the spawn chance when players are using the peaceful (commoner) rank."),
+ fileConfiguration, "peacefulModeEliteChanceDecrease", 0.2);
+
+ worldsWithoutAGBonuses = ConfigurationEngine.setList(
+ List.of("Sets the list of worlds to which guild rank bonuses will not be applied"),
+ file, fileConfiguration, "worldsWithoutAGBonuses", new ArrayList(), false);
+
+ disableCommonerRank = ConfigurationEngine.setBoolean(
+ List.of("Disables users' ability to switch to peaceful mode for EliteMobs. Peaceful mode lowers level and spawn rates of mobs around that player specifically"),
+ fileConfiguration, "disableCommonerRank", false);
+ }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java
new file mode 100644
index 000000000..62988c78e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/AntiExploitConfig.java
@@ -0,0 +1,79 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class AntiExploitConfig extends ConfigurationFile {
+ private static final String ANTI_EXPLOIT_LABEL = "Specific antiexploit features are not documented intentionally. Server operators can see what antiexploit type got triggered, but further information as to how it specifically works is not made available.";
+ @Getter
+ private static String antiExploitMessage;
+ @Getter
+ private static boolean darkroomAntiExploit1;
+ @Getter
+ private static boolean darkroomAntiExploit2;
+ @Getter
+ private static boolean darkroomAntiExploit3;
+ @Getter
+ private static boolean largeDarkroomAntiExploit1;
+ @Getter
+ private static boolean endermanHeightAntiExploit;
+ @Getter
+ private static boolean mountAntiExploit;
+ @Getter
+ private static boolean ambientDamageExploit;
+ @Getter
+ private static boolean honeyBlockExploit;
+ @Getter
+ private static boolean noItemPickup;
+ @Getter
+ private static boolean noPathExploit;
+ @Getter
+ private static int antiExploitThreshold;
+
+ public AntiExploitConfig() {
+ super("AntiExploit.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ antiExploitMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that shows up when the antiexploit is triggered."),
+ file, fileConfiguration, "AntiExploit message",
+ "&c[EM AntiExploit] &7Nearby elite won't drop special loot.", true);
+ darkroomAntiExploit1 = ConfigurationEngine.setBoolean(
+ List.of("Sets if the darkroom antiexploit 1 is enabled.", ANTI_EXPLOIT_LABEL),
+ fileConfiguration, "Enable darkroom antiexploit 1", true);
+ darkroomAntiExploit2 = ConfigurationEngine.setBoolean(
+ List.of("Sets if the darkroom antiexploit 2 is enabled.", ANTI_EXPLOIT_LABEL),
+ fileConfiguration, "Enable darkroom antiexploit 2", true);
+ darkroomAntiExploit3 = ConfigurationEngine.setBoolean(
+ List.of("Sets if the darkroom antiexploit 3 is enabled.", ANTI_EXPLOIT_LABEL),
+ fileConfiguration, "Enable darkroom antiexploit 3", true);
+ largeDarkroomAntiExploit1 = ConfigurationEngine.setBoolean(
+ List.of("Sets if the large darkroom antiexploit 1 is enabled.", ANTI_EXPLOIT_LABEL),
+ fileConfiguration, "Enable large darkroom antiexploit 1", true);
+ endermanHeightAntiExploit = ConfigurationEngine.setBoolean(
+ List.of("Sets if the enderman height antiexploit is enabled.", ANTI_EXPLOIT_LABEL),
+ fileConfiguration, "Enable enderman height antiexploit", true);
+ mountAntiExploit = ConfigurationEngine.setBoolean(
+ List.of("Sets if the mount antiexploit is enabled.", ANTI_EXPLOIT_LABEL),
+ fileConfiguration, "Enable mount antiexploit", true);
+ noItemPickup = ConfigurationEngine.setBoolean(
+ List.of("Sets if elite mobs can pick items up"),
+ fileConfiguration, "preventItemPickupByMobs", true);
+ ambientDamageExploit = ConfigurationEngine.setBoolean(
+ List.of("Sets if the ambient damage antiexploit is enabled.",
+ ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable ambient damage antiexploit", true);
+ honeyBlockExploit = ConfigurationEngine.setBoolean(
+ List.of("Sets if the honey block antiexploit is enabled.",
+ ANTI_EXPLOIT_LABEL), fileConfiguration, "Enable honey block antiexploit", true);
+ antiExploitThreshold = ConfigurationEngine.setInt(
+ List.of("Sets the threshold for antiexploit activation. Higher values make it more tolerant. Modifying this is not recommended."),
+ fileConfiguration, "antiExploitThreshold", 10);
+ noPathExploit = ConfigurationEngine.setBoolean(
+ List.of("Sets if the no path antiexploit is enabled"),
+ fileConfiguration, "nPathExploit", true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java
new file mode 100644
index 000000000..76a140724
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/ArenasConfig.java
@@ -0,0 +1,122 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class ArenasConfig extends ConfigurationFile {
+ @Getter
+ private static String notEnoughPlayersMessage;
+ @Getter
+ private static String startingTitle;
+ @Getter
+ private static String startingSubtitle;
+ @Getter
+ private static String arenaFullMessage;
+ @Getter
+ private static String arenasOngoingMessage;
+ @Getter
+ private static String arenaStartHintMessage;
+ @Getter
+ private static String arenaQuitHintMessage;
+ @Getter
+ private static String arenaJoinPlayerMessage;
+ @Getter
+ private static String arenaJoinSpectatorMessage;
+ @Getter
+ private static String waveTitle;
+ @Getter
+ private static String waveSubtitle;
+ @Getter
+ private static String victoryTitle;
+ @Getter
+ private static String victorySubtitle;
+ @Getter
+ private static String defeatTitle;
+ @Getter
+ private static String defeatSubtitle;
+ @Getter
+ private static String victoryBroadcast;
+ @Getter
+ private static String joinPlayerTitle;
+ @Getter
+ private static String joinPlayerSubtitle;
+ @Getter
+ private static String joinSpectatorTitle;
+ @Getter
+ private static String joinSpectatorSubtitle;
+ @Getter
+ private static String noArenaPermissionMessage;
+
+ public ArenasConfig() {
+ super("Arenas.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ notEnoughPlayersMessage = ConfigurationEngine.setString(
+ List.of("Message that appears when not enough players are present to start an arena."),
+ file, fileConfiguration, "notEnoughPlayersMessage", "&8[EliteMobs] &cYou need at least $amount to start the match!", true);
+ startingTitle = ConfigurationEngine.setString(
+ List.of("Title that appears when an arena is starting."),
+ file, fileConfiguration, "startingMessage", "&2Starting!", true);
+ startingSubtitle = ConfigurationEngine.setString(
+ List.of("Subtitle that appears when an arena is starting."),
+ file, fileConfiguration, "startingSubtitle", "&2in $count...", true);
+ arenaFullMessage = ConfigurationEngine.setString(
+ List.of("Message that appears when an arena is full."),
+ file, fileConfiguration, "arenaFullMessage", "&4[EliteMobs] &cArena is full! You can spectate instead while you wait for it to finish!", true);
+ arenasOngoingMessage = ConfigurationEngine.setString(
+ List.of("Message that appears when a player attempts to join an active arena."),
+ file, fileConfiguration, "arenasOngoingMessage", "&4[EliteMobs] &cCan't join the arena now - a match is currently happening! You can spectate instead while you wait for it to finish!", true);
+ arenaStartHintMessage = ConfigurationEngine.setString(
+ List.of("Message that appears to remind players how to start an arena after joining as a player."),
+ file, fileConfiguration, "instanceStartHintMessage", "&2[EliteMobs] &aYou can start the instance by doing &2/em start", true);
+ arenaQuitHintMessage = ConfigurationEngine.setString(
+ List.of("Message that appears to remind players how to leave an arena."),
+ file, fileConfiguration, "instanceQuitHintMessage", "&4[EliteMobs] &cYou can leave the instance by doing &4/em quit", true);
+ arenaJoinPlayerMessage = ConfigurationEngine.setString(
+ List.of("Message that appears when players join an arena."),
+ file, fileConfiguration, "arenaJoinPlayerMessage", "&2[EliteMobs] &aYou can start the arena by doing &2/em start &aif there are at least &2$count &aplayers in it! \nYou can leave the arena by doing &c/em quit", true);
+ arenaJoinSpectatorMessage = ConfigurationEngine.setString(
+ List.of("Message that appears to remind players how to leave an arena after joining as a spectator."),
+ file, fileConfiguration, "arenaJoinSpectatorMessage", "&2[EliteMobs] &aYou can leave the arena at any time using &2/em quit", true);
+ waveTitle = ConfigurationEngine.setString(
+ List.of("Title message that appears when a wave is starting."),
+ file, fileConfiguration, "waveTitle", "&aWave &2$wave", true);
+ waveSubtitle = ConfigurationEngine.setString(
+ List.of("Subtitle message that appears when a wave is starting."),
+ file, fileConfiguration, "waveSubtitle", "", true);
+ victoryTitle = ConfigurationEngine.setString(
+ List.of("Title that appears when an arena is completed."),
+ file, fileConfiguration, "victoryTitle", "&2Victory!", true);
+ victorySubtitle = ConfigurationEngine.setString(
+ List.of("Subtitle that appears when an arena is completed."),
+ file, fileConfiguration, "victorySubtitle", "&aCompleted &2$wave &awaves!", true);
+ defeatTitle = ConfigurationEngine.setString(
+ List.of("Title that appears when players fail an arena."),
+ file, fileConfiguration, "defeatTitle", "&4Defeat!", true);
+ defeatSubtitle = ConfigurationEngine.setString(
+ List.of("Subitle that appears when players fail an arena."),
+ file, fileConfiguration, "defeatSubtitle", "&cReached wave &4$wave&c!", true);
+ victoryBroadcast = ConfigurationEngine.setString(
+ List.of("Message broadcasted when players beat an arena."),
+ file, fileConfiguration, "victoryBroadcast", "Arena $arenaName was conquered by $players!", true);
+ joinPlayerTitle = ConfigurationEngine.setString(
+ List.of("Title that appears when a player joins an arena."),
+ file, fileConfiguration, "joinPlayerTitle", "&aStart with &2/em start &a!", true);
+ joinPlayerSubtitle = ConfigurationEngine.setString(
+ List.of("Subtitle that appears when a player joins an arena."),
+ file, fileConfiguration, "joinPlayerSubtitle", "&cLeave with &4/em quit &c!", true);
+ joinSpectatorTitle = ConfigurationEngine.setString(
+ List.of("Title that appears when a spectator joins an arena."),
+ file, fileConfiguration, "joinSpectatorTitle", "&aNow spectating!", true);
+ joinSpectatorSubtitle = ConfigurationEngine.setString(
+ List.of("Subtitle that appears when a spectator joins an arena."),
+ file, fileConfiguration, "joinSpectatorSubtitle", "&cLeave with &4/em quit &c!", true);
+ noArenaPermissionMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players if they do not have permission to enter an arena."),
+ file, fileConfiguration, "noArenaPermissionMessage", "[EliteMobs] You don't have the permission to enter this arena!", true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java
index dc84f734c..f5d60687b 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/CombatTagConfig.java
@@ -1,27 +1,42 @@
package com.magmaguy.elitemobs.config;
-import org.bukkit.configuration.Configuration;
-
-public class CombatTagConfig {
-
- public static final String CONFIG_NAME = "CombatTag.yml";
-
- public static final String ENABLE_COMBAT_TAG = "Enable combat tag";
- public static final String COMBAT_TAG_MESSAGE = "Combat tag message";
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void initializeConfig(){
-
- configuration.addDefault(ENABLE_COMBAT_TAG, true);
- configuration.addDefault(COMBAT_TAG_MESSAGE, "&c[EliteMobs] Combat tag activated!");
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class CombatTagConfig extends ConfigurationFile {
+ @Getter
+ private static boolean enableCombatTag;
+ @Getter
+ private static String combatTagMessage;
+ @Getter
+ private static boolean enableTeleportTimer;
+ @Getter
+ private static String teleportTimeLeft;
+ @Getter
+ private static String teleportCancelled;
+
+ public CombatTagConfig() {
+ super("CombatTag.yml");
}
+ @Override
+ public void initializeValues() {
+ enableCombatTag = ConfigurationEngine.setBoolean(
+ List.of("Sets if the combat tag is enabled.", "When enabled, flying players that engage in combat are set to stop flying."),
+ fileConfiguration, "Enable combat tag", true);
+ combatTagMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent when the combat tag is activated."),
+ file, fileConfiguration, "Combat tag message", "&c[EliteMobs] Combat tag activated!", true);
+ enableTeleportTimer = ConfigurationEngine.setBoolean(
+ List.of("Sets if the /ag command will have a timer before teleportation"),
+ fileConfiguration, "Enable adventurers guild teleport timer", true);
+ teleportTimeLeft = ConfigurationEngine.setString(
+ List.of("Sets the action message set while waiting for the teleport timer."),
+ file, fileConfiguration, "Teleport time left", "&7[EM] Teleporting in &a$time &7seconds...", true);
+ teleportCancelled = ConfigurationEngine.setString(
+ List.of("Sets the message sent when players move while waiting for teleportation."),
+ file, fileConfiguration, "Teleport cancelled", "&7[EM] &cTeleport interrupted!", true);
+ }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigValues.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigValues.java
deleted file mode 100644
index 68a35cd75..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ConfigValues.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.MetadataHandler;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.Configuration;
-
-/**
- * Created by MagmaGuy on 05/05/2017.
- */
-public class ConfigValues {
-
- public static Configuration defaultConfig, itemsCustomLootListConfig, mobPowerConfig, translationConfig,
- itemsProceduralSettingsConfig, economyConfig, playerCacheConfig, eventsConfig, itemsCustomLootSettingsConfig,
- validMobsConfig, validWorldsConfig, itemsUniqueConfig, mobCombatSettingsConfig, itemsDropSettingsConfig,
- playerMoneyData, playerRankData, playerMaxRankData, combatTagConfig, adventurersGuildConfig,
- customEnchantmentsConfig;
-
- public static void initializeCachedConfigurations() {
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
-
- defaultConfig = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getConfig();
-
- customConfigLoader = new CustomConfigLoader();
- itemsCustomLootListConfig = customConfigLoader.getCustomConfig(ItemsCustomLootListConfig.CONFIG_NAME, true);
-
- customConfigLoader = new CustomConfigLoader();
- mobPowerConfig = customConfigLoader.getCustomConfig(MobPowersConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- itemsCustomLootSettingsConfig = customConfigLoader.getCustomConfig(ItemsCustomLootSettingsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- translationConfig = customConfigLoader.getCustomConfig(TranslationConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- itemsProceduralSettingsConfig = customConfigLoader.getCustomConfig(ItemsProceduralSettingsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- economyConfig = customConfigLoader.getCustomConfig(EconomySettingsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- playerCacheConfig = customConfigLoader.getCustomConfig(PlayerCacheData.CONFIG_NAME, true);
-
- customConfigLoader = new CustomConfigLoader();
- playerMoneyData = customConfigLoader.getCustomConfig(PlayerMoneyData.CONFIG_NAME, true);
-
- customConfigLoader = new CustomConfigLoader();
- playerRankData = customConfigLoader.getCustomConfig(PlayerGuildRank.CONFIG_NAME, true);
-
- customConfigLoader = new CustomConfigLoader();
- playerMaxRankData = customConfigLoader.getCustomConfig(PlayerMaxGuildRank.CONFIG_NAME, true);
-
- customConfigLoader = new CustomConfigLoader();
- eventsConfig = customConfigLoader.getCustomConfig(EventsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- validMobsConfig = customConfigLoader.getCustomConfig(ValidMobsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- validWorldsConfig = customConfigLoader.getCustomConfig(ValidWorldsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- itemsUniqueConfig = customConfigLoader.getCustomConfig(ItemsUniqueConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- mobCombatSettingsConfig = customConfigLoader.getCustomConfig(MobCombatSettingsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- itemsDropSettingsConfig = customConfigLoader.getCustomConfig(ItemsDropSettingsConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- combatTagConfig = customConfigLoader.getCustomConfig(CombatTagConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- adventurersGuildConfig = customConfigLoader.getCustomConfig(AdventurersGuildConfig.CONFIG_NAME);
-
- customConfigLoader = new CustomConfigLoader();
- customEnchantmentsConfig = customConfigLoader.getCustomConfig(CustomEnchantmentsConfig.CONFIG_NAME);
-
- }
-
- public static void intializeConfigurations() {
-
- DefaultConfig defaultConfig = new DefaultConfig();
- defaultConfig.loadConfiguration();
-
- MobPowersConfig mobPowersConfig = new MobPowersConfig();
- mobPowersConfig.initializeConfig();
-
- ItemsCustomLootListConfig itemsCustomLootListConfig = new ItemsCustomLootListConfig();
- itemsCustomLootListConfig.intializeConfig();
-
- ItemsCustomLootSettingsConfig itemsCustomLootSettingsConfig = new ItemsCustomLootSettingsConfig();
- itemsCustomLootSettingsConfig.initializeConfig();
-
- TranslationConfig translationConfig = new TranslationConfig();
- translationConfig.initializeConfig();
-
- ItemsProceduralSettingsConfig itemsProceduralSettingsConfig = new ItemsProceduralSettingsConfig();
- itemsProceduralSettingsConfig.intializeConfig();
-
- EconomySettingsConfig economySettingsConfig = new EconomySettingsConfig();
- economySettingsConfig.initializeConfig();
-
- PlayerMoneyData playerMoneyData = new PlayerMoneyData();
- playerMoneyData.intializeConfig();
-
- PlayerCacheData playerCacheData = new PlayerCacheData();
- playerCacheData.initializeConfig();
-
- EventsConfig eventsConfig = new EventsConfig();
- eventsConfig.initializeConfig();
-
- ValidWorldsConfig validWorldsConfig = new ValidWorldsConfig();
- validWorldsConfig.initializeConfig();
-
- ValidMobsConfig validMobsConfig = new ValidMobsConfig();
- validMobsConfig.initializeConfig();
-
- ItemsUniqueConfig itemsUniqueConfig = new ItemsUniqueConfig();
- itemsUniqueConfig.initializeConfig();
-
- MobCombatSettingsConfig mobCombatSettingsConfig = new MobCombatSettingsConfig();
- mobCombatSettingsConfig.initializeConfig();
-
- ItemsDropSettingsConfig itemsDropSettingsConfig = new ItemsDropSettingsConfig();
- itemsDropSettingsConfig.initializeConfig();
-
- PlayerGuildRank playerGuildRank = new PlayerGuildRank();
- playerGuildRank.intializeConfig();
-
- PlayerMaxGuildRank playerMaxGuildRank = new PlayerMaxGuildRank();
- playerMaxGuildRank.intializeConfig();
-
- CombatTagConfig combatTagConfig = new CombatTagConfig();
- combatTagConfig.initializeConfig();
-
- AdventurersGuildConfig adventurersGuildConfig = new AdventurersGuildConfig();
- adventurersGuildConfig.initializeConfig();
-
- CustomEnchantmentsConfig customEnchantmentsConfig = new CustomEnchantmentsConfig();
- customEnchantmentsConfig.initializeConfig();
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java
new file mode 100644
index 000000000..c47c3692e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationEngine.java
@@ -0,0 +1,80 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.elitemobs.config.translations.TranslationsConfig;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.ItemStackGenerator;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.SkullMeta;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ConfigurationEngine extends com.magmaguy.magmacore.config.ConfigurationEngine {
+
+ public static String setString(File file, FileConfiguration fileConfiguration, String key, String defaultValue, boolean translatable) {
+ fileConfiguration.addDefault(key, defaultValue);
+ if (translatable)
+ return TranslationsConfig.add(file.getName(), key, ChatColorConverter.convert(fileConfiguration.getString(key)));
+ else
+ return ChatColorConverter.convert(fileConfiguration.getString(key));
+ }
+
+ public static String setString(List comments, File file, FileConfiguration fileConfiguration, String key, String defaultValue, boolean translatable) {
+ String value = setString(file, fileConfiguration, key, defaultValue, translatable);
+ setComments(fileConfiguration, key, comments);
+ return value;
+ }
+
+ public static List setList(File file, FileConfiguration fileConfiguration, String key, List defaultValue, boolean translatable) {
+ fileConfiguration.addDefault(key, defaultValue);
+ if (translatable)
+ return TranslationsConfig.add(file.getName(), key, (List) fileConfiguration.getList(key));
+ else
+ return fileConfiguration.getList(key);
+ }
+
+ public static List setList(List comment, File file, FileConfiguration fileConfiguration, String key, List defaultValue, boolean translatable) {
+ List value = setList(file, fileConfiguration, key, defaultValue, translatable);
+ setComments(fileConfiguration, key, comment);
+ return value;
+ }
+
+ public static ItemStack setItemStack(File file, FileConfiguration fileConfiguration, String key, ItemStack itemStack, boolean translatable) {
+ fileConfiguration.addDefault(key + ".material", itemStack.getType().toString());
+ if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName())
+ fileConfiguration.addDefault(key + ".name", itemStack.getItemMeta().getDisplayName());
+ if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasLore())
+ fileConfiguration.addDefault(key + ".lore", itemStack.getItemMeta().getLore());
+ if (itemStack.getType().equals(Material.PLAYER_HEAD))
+ fileConfiguration.addDefault(key + ".owner", ((SkullMeta) itemStack.getItemMeta()).getOwner());
+ Material material;
+ try {
+ material = Material.valueOf(fileConfiguration.getString(key + ".material"));
+ } catch (Exception ex) {
+ Logger.warn("Material type " + fileConfiguration.getString(key + ".material") + " is not valid! Correct it to make a valid item.");
+ return null;
+ }
+ String name = "";
+ try {
+ name = setString(file, fileConfiguration, key + ".name", itemStack.getItemMeta().getDisplayName(), true);
+ } catch (Exception ex) {
+ Logger.warn("Item name " + fileConfiguration.getString(key + ".name") + " is not valid! Correct it to make a valid item.");
+ }
+ List lore = new ArrayList<>();
+ try {
+ lore = setList(file, fileConfiguration, key + ".lore", null, true);
+ } catch (Exception ex) {
+ Logger.warn("Item lore " + fileConfiguration.getString(key + ".lore") + " is not valid! Correct it to make a valid item.");
+ }
+ ItemStack fileItemStack = ItemStackGenerator.generateItemStack(material, name, lore);
+ if (material == Material.PLAYER_HEAD)
+ ((SkullMeta) itemStack.getItemMeta()).setOwningPlayer(Bukkit.getOfflinePlayer(fileConfiguration.getString(key + ".owner")));
+ return fileItemStack;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java
new file mode 100644
index 000000000..d0fbb9990
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/ConfigurationExporter.java
@@ -0,0 +1,98 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.magmacore.util.Logger;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class ConfigurationExporter {
+ private ConfigurationExporter() {
+ }
+
+ public static void initializeConfigs() {
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ Path configurationsPath = Paths.get(MetadataHandler.PLUGIN.getDataFolder().getAbsolutePath());
+ if (!Files.isDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports"))) {
+ try {
+ Files.createDirectory(Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports"));
+ } catch (Exception exception) {
+ Logger.warn("Failed to create exports directory! Tell the dev!");
+ exception.printStackTrace();
+ }
+ }
+ try {
+ File rspFile = Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports" + File.separatorChar + "elitemobs_resource_pack.zip").toFile();
+ if (rspFile.exists()) rspFile.delete();
+ downloadFile("https://magmaguy.com/downloads/elitemobs_resource_pack.zip", Paths.get(configurationsPath.normalize() + "" + File.separatorChar + "exports").toAbsolutePath().toString());
+ } catch (Exception e) {
+ Logger.warn("Failed to download official resource pack! Tell the dev!");
+ e.printStackTrace();
+ }
+ }
+ }.runTaskAsynchronously(MetadataHandler.PLUGIN);
+ }
+
+ public static void downloadFile(String fileURL, String saveFilePath) throws IOException {
+ URL url = new URL(fileURL);
+ HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
+ int responseCode = httpConn.getResponseCode();
+
+ // Check HTTP response code first
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ String fileName = "";
+ String disposition = httpConn.getHeaderField("Content-Disposition");
+
+ if (disposition != null) {
+ // Extracts file name from header field
+ int index = disposition.indexOf("filename=");
+ if (index > 0) {
+ fileName = disposition.substring(index + 10, disposition.length() - 1);
+ }
+ } else {
+ // Extracts file name from URL
+ fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1);
+ }
+
+ // Opens input stream from the HTTP connection
+ InputStream inputStream = httpConn.getInputStream();
+ String saveFilePathWithName = saveFilePath + File.separatorChar + fileName;
+
+ // Opens an output stream to save into file
+ FileOutputStream outputStream = new FileOutputStream(saveFilePathWithName);
+
+ int bytesRead = -1;
+ byte[] buffer = new byte[4096];
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+
+ outputStream.close();
+ inputStream.close();
+
+ } else {
+ Logger.warn("No file to download. Server replied HTTP code: " + responseCode);
+ }
+ httpConn.disconnect();
+ }
+
+ public static byte[] sha1CodeByteArray(File file) throws IOException, NoSuchAlgorithmException {
+ FileInputStream fileInputStream = new FileInputStream(file);
+ MessageDigest digest = MessageDigest.getInstance("SHA-1");
+ DigestInputStream digestInputStream = new DigestInputStream(fileInputStream, digest);
+ byte[] bytes = new byte[1024];
+ // read all file content
+ while (digestInputStream.read(bytes) > 0) digest = digestInputStream.getMessageDigest();
+ return digest.digest();
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigConstructor.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfigConstructor.java
deleted file mode 100644
index 10f18ba99..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigConstructor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-
-import com.magmaguy.elitemobs.MetadataHandler;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.InvalidConfigurationException;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.Plugin;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-public class CustomConfigConstructor extends YamlConfiguration {
-
- Plugin plugin = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS);
- private File file;
- private String defaults;
-
- /**
- * Creates new PluginFile, without defaults
- *
- * @param fileName - Name of the file
- */
- public CustomConfigConstructor(String fileName) {
- this(fileName, null);
- }
-
- /**
- * Creates new PluginFile, with defaults
- *
- * @param fileName - Name of the file
- * @param defaultsName - Name of the defaults
- */
- public CustomConfigConstructor(String fileName, String defaultsName) {
- this.defaults = defaultsName;
- File newFile = new File(plugin.getDataFolder().getPath()+"/data");
- Bukkit.getLogger().info("ATTENTION: " + newFile.toString());
- this.file = new File(newFile, fileName);
- reload();
- }
-
- /**
- * Reload configuration
- */
- public void reload() {
-
- if (!file.exists()) {
-
- try {
- file.getParentFile().mkdirs();
- file.createNewFile();
-
- } catch (IOException exception) {
- exception.printStackTrace();
- plugin.getLogger().severe("Error while creating file " + file.getName());
- }
-
- }
-
- try {
- load(file);
-
- if (defaults != null) {
- InputStreamReader reader = new InputStreamReader(plugin.getResource(defaults));
- FileConfiguration defaultsConfig = YamlConfiguration.loadConfiguration(reader);
-
- setDefaults(defaultsConfig);
- options().copyDefaults(true);
-
- reader.close();
- save();
- }
-
- } catch (IOException exception) {
- exception.printStackTrace();
- plugin.getLogger().severe("Error while loading file " + file.getName());
-
- } catch (InvalidConfigurationException exception) {
- exception.printStackTrace();
- plugin.getLogger().severe("Error while loading file " + file.getName());
-
- }
-
- }
-
- /**
- * Save configuration
- */
- public void save() {
-
- try {
- options().indent(2);
- save(file);
-
- } catch (IOException exception) {
- exception.printStackTrace();
- plugin.getLogger().severe("Error while saving file " + file.getName());
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java
new file mode 100644
index 000000000..3e22bd9a9
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/CustomConfigFields.java
@@ -0,0 +1,50 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.elitemobs.config.translations.TranslationsConfig;
+import org.bukkit.configuration.ConfigurationSection;
+
+import java.util.List;
+import java.util.Map;
+
+public class CustomConfigFields extends com.magmaguy.magmacore.config.CustomConfigFields {
+
+ /**
+ * Used by plugin-generated files (defaults)
+ *
+ * @param filename
+ * @param isEnabled
+ */
+ public CustomConfigFields(String filename, boolean isEnabled) {
+ super(filename, isEnabled);
+ }
+
+ @Override
+ public void processConfigFields() {
+
+ }
+
+ @Override
+ public String getFilename() {
+ return super.getFilename();
+ }
+
+ protected String translatable(String filename, String key, String value) {
+ return TranslationsConfig.add(filename, key, value);
+ }
+
+ protected List translatable(String filename, String key, List value) {
+ return TranslationsConfig.add(filename, key, value);
+ }
+
+ public ConfigurationSection processConfigurationSection(String path, Map value) {
+ if (!configHas(path) && value != null)
+ fileConfiguration.addDefaults(value);
+ ConfigurationSection newValue = fileConfiguration.getConfigurationSection(path);
+ if (newValue == null) return null;
+
+ for (String key : newValue.getKeys(true))
+ if (key.equalsIgnoreCase("message"))
+ newValue.set(key, translatable(filename, key, (String) newValue.get(key)));
+ return newValue;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigLoader.java b/src/main/java/com/magmaguy/elitemobs/config/CustomConfigLoader.java
deleted file mode 100644
index 0c3c6e048..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/CustomConfigLoader.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.MetadataHandler;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.Plugin;
-
-import java.io.*;
-import java.util.logging.Level;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-public class CustomConfigLoader {
-
- Plugin plugin = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS);
- private FileConfiguration customConfig = null;
- private File customConfigFile = null;
-
- public FileConfiguration getCustomConfig(String configName) {
-
- return getCustomConfig(configName, false);
-
- }
-
- public FileConfiguration getCustomConfig(String configName, boolean isDataFile) {
-
- if (customConfig == null) {
-
- reloadCustomConfig(configName, isDataFile);
-
- }
-
- return customConfig;
- }
-
- public void reloadCustomConfig(String configName, boolean isDataFile) {
-
- if (customConfigFile == null && !isDataFile) {
-
- customConfigFile = new File(plugin.getDataFolder(), configName);
-
- }
-
- if (customConfigFile == null && isDataFile) {
-
- customConfigFile = new File(plugin.getDataFolder(), "data/" + configName);
-
- if (!customConfigFile.exists()) customConfigFile.getParentFile().mkdirs();
-
- }
-
- customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
-
- // Look for defaults in the jar
- Reader defConfigStream = null;
-
- try {
-
- defConfigStream = new InputStreamReader(plugin.getResource(configName), "UTF8");
-
- } catch (UnsupportedEncodingException e) {
-
- e.printStackTrace();
- }
-
- if (defConfigStream != null) {
-
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(customConfigFile);
-
- customConfig = defConfig;
-
- }
-
- }
-
- public void saveCustomConfig(String configName) {
-
- if (customConfig == null || customConfigFile == null) {
-
- return;
-
- }
-
- try {
-
- getCustomConfig(configName).save(customConfigFile);
-
- } catch (IOException ex) {
-
- Bukkit.getLogger().log(Level.SEVERE, "Could not save config to " + customConfigFile, ex);
-
- }
-
- }
-
- public void saveCustomConfig(String configName, boolean isDataFile) {
-
- if (customConfig == null || customConfigFile == null) {
-
- return;
-
- }
-
- if (!isDataFile) return;
-
- try {
-
- getCustomConfig(configName).save(customConfigFile);
-
- } catch (IOException ex) {
-
- Bukkit.getLogger().log(Level.SEVERE, "Could not save config to " + customConfigFile, ex);
-
- }
-
- }
-
- public void saveDefaultCustomConfig(String configName) {
-
- if (customConfigFile == null) {
-
- customConfigFile = new File(plugin.getDataFolder(), configName);
-
- }
-
- if (!customConfigFile.exists()) {
-
- plugin.saveResource(configName, false);
-
- }
-
- }
-
- public void saveDefaultCustomConfig(String configName, boolean isDataFile) {
-
- if (customConfigFile == null && isDataFile) {
-
- customConfigFile = new File(plugin.getDataFolder(), "data/" + configName);
-
- }
-
- if (!customConfigFile.exists()) {
-
- plugin.saveResource(configName, false);
-
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/CustomEnchantmentsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/CustomEnchantmentsConfig.java
deleted file mode 100644
index 67e54c361..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/CustomEnchantmentsConfig.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-public class CustomEnchantmentsConfig{
-
- public static final String CONFIG_NAME = "CustomEnchantments.yml";
- private CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public static String HUNTER_NAME = "HunterEnchantment enchantment name";
- public static String HUNTER_SPAWN_BONUS = "Percentual elite mob increase in spawn rate around the player per hunter enchantment level";
- public static String FLAMETHROWER_NAME = "FlamethrowerEnchantment enchantment name";
-
- public void initializeConfig() {
-
- configuration.addDefault(HUNTER_NAME, "HunterEnchantment");
- configuration.addDefault(HUNTER_SPAWN_BONUS, 2);
- configuration.addDefault(FLAMETHROWER_NAME, "FlamethrowerEnchantment");
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/DatabaseConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DatabaseConfig.java
new file mode 100644
index 000000000..1650f8522
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/DatabaseConfig.java
@@ -0,0 +1,38 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class DatabaseConfig extends ConfigurationFile {
+ @Getter
+ public static boolean useMySQL;
+ @Getter
+ public static String mysqlHost;
+ @Getter
+ public static String mysqlPort;
+ @Getter
+ public static String mysqlDatabaseName;
+ @Getter
+ public static String mysqlUsername;
+ @Getter
+ public static String mysqlPassword;
+ @Getter
+ public static boolean useSSL;
+
+ public DatabaseConfig() {
+ super("Database.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ useMySQL = ConfigurationEngine.setBoolean(List.of("Sets whether MySQL will be used. By default EliteMobs uses SQLite. If you wish to use MySQL you will need a valid MySQL configuration."), fileConfiguration, "useMySQL", false);
+ mysqlHost = ConfigurationEngine.setString(List.of("The host of your MySQL database"), file, fileConfiguration, "mysqlHost", "localhost", false);
+ mysqlPort = ConfigurationEngine.setString(List.of("The port of your MySQL database"), file, fileConfiguration, "mysqlPort", "3306", false);
+ mysqlDatabaseName = ConfigurationEngine.setString(List.of("The name of the database"), file, fileConfiguration, "mysqlDatabaseName", "elitemobs", false);
+ mysqlUsername = ConfigurationEngine.setString(List.of("The username for MySQl"), file, fileConfiguration, "mysqlUsername", "your_username_mysql_here", false);
+ mysqlPassword = ConfigurationEngine.setString(List.of("The password for your MysSQL database"), file, fileConfiguration, "mysqlPassword", "your_mysql_password_here", false);
+ useSSL = ConfigurationEngine.setBoolean(List.of("Whether to use SSL"), fileConfiguration, "useSSL", true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java
index 81b45ffeb..6972a4ecf 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/DefaultConfig.java
@@ -1,77 +1,209 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-import com.magmaguy.elitemobs.MetadataHandler;
+import com.magmaguy.elitemobs.commands.ReloadCommand;
+import com.magmaguy.elitemobs.config.translations.TranslationsConfig;
+import com.magmaguy.elitemobs.utils.ConfigurationLocation;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import com.magmaguy.magmacore.util.Logger;
+import lombok.Getter;
import org.bukkit.Bukkit;
-import org.bukkit.configuration.Configuration;
+import org.bukkit.Location;
+import org.bukkit.command.CommandSender;
+
+import java.util.List;
/**
* Created by MagmaGuy on 08/06/2017.
*/
-public class DefaultConfig {
-
- public static final String ALWAYS_SHOW_NAMETAGS = "Always show Elite Mob nametags";
- public static final String SUPERMOB_STACK_AMOUNT = "SuperMob (passive EliteMobs) stack amount";
- public static final String MMORPG_COLORS = "Use MMORPG colors for item ranks";
- public static final String CREEPER_PASSIVE_DAMAGE_PREVENTER = "Prevent creepers from killing passive mobs";
- public static final String ENABLE_PERMISSION_TITLES = "Use titles to warn players they are missing a permission";
- public static final String ENABLE_POWER_SCOREBOARDS = "Use scoreboards to display mob powers using permissions";
- public static final String HIDE_ENCHANTMENTS_ATTRIBUTE = "Hide enchantment attributes on plugin-generated items";
- public static final String PREVENT_ITEM_PICKUP = "Prevent item pickup from all aggressive mobs";
- public static final String PREVENT_ELITE_MOB_CONVERSION_OF_NAMED_MOBS = "Make aggressive named mobs unable to become Elite Mobs";
- public static final String PREVENT_MOUNT_EXPLOIT = "Prevent Minecraft living entity mount exploit for Elite Mobs";
- public static final String STRICT_SPAWNING_RULES = "Strict spawning rules mode for better compatibility with other plugins";
- public static final String PREVENT_TOWER_EXPLOIT = "Prevent tower exploit";
- public static final String PREVENT_DARKROOM_EXPLOIT = "Prevent dark room spawner exploit";
-
- public static void reloadConfig() {
-
- Bukkit.getPluginManager().getPlugin("EliteMobs").reloadConfig();
-
+public class DefaultConfig extends ConfigurationFile {
+ @Getter
+ public static DefaultConfig instance;
+ @Getter
+ private static boolean alwaysShowNametags;
+ @Getter
+ private static int superMobStackAmount;
+ @Getter
+ private static boolean preventCreeperDamageToPassiveMobs;
+ @Getter
+ private static boolean doPermissionTitles;
+ @Getter
+ private static boolean preventEliteMobConversionOfNamedMobs;
+ @Getter
+ private static boolean doStrictSpawningRules;
+ @Getter
+ private static double nightmareWorldSpawnBonus;
+ @Getter
+ private static boolean emLeadsToStatusMenu;
+ @Getter
+ private static boolean otherCommandsLeadToEMStatusMenu;
+ @Getter
+ private static boolean setupDone;
+ @Getter
+ private static Location defaultSpawnLocation;
+ @Getter
+ private static boolean doExplosionRegen;
+ @Getter
+ private static boolean preventVanillaReinforcementsForEliteEntities;
+ @Getter
+ private static boolean doRegenerateContainers;
+ @Getter
+ private static int defaultTransitiveBlockLimiter;
+ @Getter
+ private static boolean onlyUseBedrockMenus;
+ @Getter
+ private static int characterLimitForBookMenuPages;
+ @Getter
+ private static boolean useGlassToFillMenuEmptySpace;
+ @Getter
+ private static boolean menuUnicodeFormatting;
+ @Getter
+ private static String language;
+ @Getter
+ private static String noPendingCommands;
+ @Getter
+ private static String trackMessage;
+ @Getter
+ private static String chestLowRankMessage;
+ @Getter
+ private static String chestCooldownMessage;
+ @Getter
+ private static String dismissEMMessage;
+ @Getter
+ private static String switchEMStyleMessage;
+ @Getter
+ private static String treasureChestNoDropMessage;
+ @Getter
+ private static String bossAlreadyGoneMessage;
+ @Getter
+ private static boolean resetPlayerScaleOnLogin;
+ @Getter
+ private static boolean forceMenuUnicode;
+
+ public DefaultConfig() {
+ super("config.yml");
+ instance = this;
}
- public void loadConfiguration() {
-
- Configuration configuration = Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getConfig();
-
- configuration.addDefault(SUPERMOB_STACK_AMOUNT, 50);
- configuration.addDefault(MMORPG_COLORS, true);
- configuration.addDefault(CREEPER_PASSIVE_DAMAGE_PREVENTER, true);
- configuration.addDefault(ENABLE_PERMISSION_TITLES, true);
- configuration.addDefault(ENABLE_POWER_SCOREBOARDS, false);
- configuration.addDefault(ALWAYS_SHOW_NAMETAGS, true);
- configuration.addDefault(HIDE_ENCHANTMENTS_ATTRIBUTE, false);
- configuration.addDefault(PREVENT_ITEM_PICKUP, false);
- configuration.addDefault(PREVENT_ELITE_MOB_CONVERSION_OF_NAMED_MOBS, true);
- configuration.addDefault(STRICT_SPAWNING_RULES, false);
- configuration.addDefault(PREVENT_MOUNT_EXPLOIT, true);
- configuration.addDefault(PREVENT_TOWER_EXPLOIT, true);
- configuration.addDefault(PREVENT_DARKROOM_EXPLOIT, true);
-
- configuration.options().copyDefaults(true);
-
- UnusedNodeHandler.clearNodes(configuration);
-
- //save the config when changed
- Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).saveConfig();
- Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).saveDefaultConfig();
+ public static void toggleSetupDone() {
+ setupDone = !setupDone;
+ instance.fileConfiguration.set("setupDoneV3", setupDone);
+ save();
+ }
- Bukkit.getLogger().info("EliteMobs config loaded!");
+ public static void save() {
+ ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file);
+ }
+ public static void setLanguage(CommandSender commandSender, String filename) {
+ language = filename;
+ instance.fileConfiguration.set("language", filename);
+ ConfigurationEngine.fileSaverCustomValues(instance.fileConfiguration, instance.file);
+ ReloadCommand.reload(commandSender);
}
+ @Override
+ public void initializeValues() {
+ //The language changes what data is loaded downstream
+ language = ConfigurationEngine.setString(
+ List.of("Sets the language file used by EliteMobs", "Do NOT change this manually! It is meant to be installed with the command '/em language '"),
+ file, fileConfiguration, "language", "english", false);
+ //This needs to be initialized as soon as the language is figured out
+ new TranslationsConfig();
+
+ alwaysShowNametags = ConfigurationEngine.setBoolean(
+ List.of("Sets whether elites and bosses spawned by elitemobs will always show their nametags.", "Not recommended!"),
+ fileConfiguration, "alwaysShowEliteMobNameTags", false);
+ superMobStackAmount = Math.max(ConfigurationEngine.setInt(
+ List.of("Sets the amount of passive mobs that have to be in close proximity before they can be merged.", "Don't set this to 0!"),
+ fileConfiguration, "superMobStackAmount", 50), 1);
+ preventCreeperDamageToPassiveMobs = ConfigurationEngine.setBoolean(
+ List.of("Makes elites not damage passive mobs with explosions."),
+ fileConfiguration, "preventEliteCreeperDamageToPassiveMobs", true);
+ doPermissionTitles = ConfigurationEngine.setBoolean(
+ List.of("Sets whether EliteMobs will use titles to warn players about missing permissions"),
+ fileConfiguration, "useTitlesForMissingPermissionMessages", true);
+ preventEliteMobConversionOfNamedMobs = ConfigurationEngine.setBoolean(
+ List.of("Sets whether EliteMobs will prevent converting named mobs to elites.", "Especially important for compatibility with other plugins."),
+ fileConfiguration, "preventEliteMobConversionOfNamedMobs", true);
+ doStrictSpawningRules = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will convert mobs with custom spawn reasons.", "Running certain boss plugins will automatically set this to true, no matter what the value in the config is."),
+ fileConfiguration, "enableHighCompatibilityMode", false);
+ if (Bukkit.getPluginManager().isPluginEnabled("MythicMobs") ||
+ Bukkit.getPluginManager().isPluginEnabled("LevelledMobs")) {
+ Logger.info("Other boss mob plugins have been detected, high compatibility mode will be used!");
+ doStrictSpawningRules = true;
+ }
+ nightmareWorldSpawnBonus = ConfigurationEngine.setDouble(
+ List.of("Sets the elite spawn bonus for the nightmare gamemode"),
+ fileConfiguration, "nightmareWorldSpawnBonus", 0.5);
+ emLeadsToStatusMenu = ConfigurationEngine.setBoolean(
+ List.of("Sets if the centralized /em command opens the main status page of the plugin.", "Highly recommended!"),
+ fileConfiguration, "emLeadsToStatusMenu", true);
+ otherCommandsLeadToEMStatusMenu = ConfigurationEngine.setBoolean(
+ List.of("Sets if running specific commands like /em wallet will lead to the /em menu where that information is centralized."),
+ fileConfiguration, "otherCommandsLeadToEMStatusMenu", true);
+ setupDone = ConfigurationEngine.setBoolean(
+ List.of("Sets if the setup is complete.", "Do not set this value manually, it is meant to be modified through in-game commands."),
+ fileConfiguration, "setupDoneV3", false);
+ preventVanillaReinforcementsForEliteEntities = ConfigurationEngine.setBoolean(
+ List.of("Sets if elites will prevent spawning vanilla reinforcements, such as for the Zombie reinforcement feature."),
+ fileConfiguration, "preventVanillaReinforcementsForEliteEntities", true);
+ try {
+ defaultSpawnLocation = ConfigurationLocation.serialize(
+ ConfigurationEngine.setString(
+ List.of("Sets the default spawn location of the server for EliteMobs. /em spawntp will lead to this location."),
+ file, fileConfiguration, "defaultSpawnLocation",
+ ConfigurationLocation.deserialize(Bukkit.getWorlds().get(0).getSpawnLocation()), false));
+ } catch (Exception ex) {
+ Logger.warn("There is an issue with your defaultSpawnLocation in the config.yml configuration file! Fix it!");
+ }
+
+ doExplosionRegen = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will regenerate blocks blown up by elites."),
+ fileConfiguration, "doExplosionRegen", true);
+ doRegenerateContainers = ConfigurationEngine.setBoolean(
+ List.of("Sets if the explosion regen will also regenerate the contents of containers such as chests.", "Turning it to false will make elite explosions not blow up containers."),
+ fileConfiguration, "doRegenerateContainers", true);
+ defaultTransitiveBlockLimiter = ConfigurationEngine.setInt(fileConfiguration, "defaultTransitiveBlockLimiter", 500);
+ onlyUseBedrockMenus = ConfigurationEngine.setBoolean(
+ List.of("Sets whether the /em menu will only use the inventory-based menu style which is compatible with bedrock.", "As a reminder, players can otherwise do the command /em alt to switch between /em menu styles"),
+ fileConfiguration, "onlyUseBedrockMenus", false);
+ characterLimitForBookMenuPages = ConfigurationEngine.setInt(
+ List.of("Sets the character limit per line for book menu pages.", "Lower this amount if text is getting cut off in book menus such as for quests"),
+ fileConfiguration, "characterLimitForBookMenuPagesV2", 170);
+ useGlassToFillMenuEmptySpace = ConfigurationEngine.setBoolean(
+ List.of("Sets if empty menu space will be filled with glass panes.", "Not recommended if you are using the EliteMobs resource pack."),
+ fileConfiguration, "useGlassToFillMenuEmptySpace", false);
+ menuUnicodeFormatting = ConfigurationEngine.setBoolean(
+ List.of("Sets if unicode will be used to format the EliteMobs resource pack.",
+ "Do not set this manually, it is set automatically upon installation of the resource pack.",
+ "Only set it manually if you had to merge the EliteMobs resource pack, and expect that the spacing might not work if you do that."),
+ fileConfiguration, "menuUnicodeFormatting", false);
+ noPendingCommands = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players if they run '/em confirm' with no pending commands."),
+ file, fileConfiguration, "noPendingCommands", "&cYou don't currently have any pending commands!", true);
+ trackMessage = ConfigurationEngine.setString(
+ List.of("Sets the tracking message for bosses that send tracking messages."),
+ file, fileConfiguration, "trackMessage", "Track the $name", true);
+ chestLowRankMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players that open treasure chests with level requirements above their guild rank."),
+ file, fileConfiguration, "chestLowRankMessage", "&7[EM] &cYour guild rank needs to be at least $rank &cin order to open this chest!", true);
+ chestCooldownMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players that try to reopen a treasure chest they have already opened."),
+ file, fileConfiguration, "chestCooldownMessage", "&7[EM] &cYou've already opened this chest recently! Wait $time!", true);
+ dismissEMMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears recommending the /em alt command for players having issues with the /em command"),
+ file, fileConfiguration, "dismissEMMessage", "&8[EliteMobs] &2/elitemobs &fmenu not working for you? Try &2/elitemobs alt &fto see an alternative version of the menu! &cDon't want to see this message again? &4/em dismiss", true);
+ switchEMStyleMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when players run the /em alt command."),
+ file, fileConfiguration, "switchEMStyleMessage", "&8[EliteMobs] &2/elitemobs &fmenu style changed! Check it out!", true);
+ treasureChestNoDropMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when a player opens a treasure chest but gets nothing"),
+ file, fileConfiguration, "treasureChestNoDropMessage", "&8[EliteMobs] &cYou didn't get anything! Better luck next time!", true);
+ bossAlreadyGoneMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when a player tries to track a boss that is no longer valid"),
+ file, fileConfiguration, "bossAlreadyGoneMessage", "&c[EliteMobs] Sorry, this boss is already gone!", true);
+ resetPlayerScaleOnLogin = ConfigurationEngine.setBoolean(List.of("Sets whether to reset player scale (literally, the player size on login).", "This is important because some elite powers can modify it and if the server crashes players will be stuck to whatever scale was set when the server crashed, unless this option is set to true."), fileConfiguration, "resetPlayerScale", true);
+ forceMenuUnicode = ConfigurationEngine.setBoolean(List.of("Sets whether the menu unicodes for the resource pack should be forced even if the pack is not being hosted through the recommended methods (which is using ResourcePackManager)"), fileConfiguration, "forceMenuUnicode", false);
+ }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java
new file mode 100644
index 000000000..8afc3545e
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/DiscordSRVConfig.java
@@ -0,0 +1,27 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class DiscordSRVConfig extends ConfigurationFile {
+
+ @Getter
+ private static String announcementRoomName;
+
+ public DiscordSRVConfig() {
+ super("DiscordSRV.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ announcementRoomName = ConfigurationEngine.setString(
+ List.of("Documentation can be found here: https://github.com/MagmaGuy/EliteMobs/wiki/DiscordSRV---Discord-broadcasts"),
+ file, fileConfiguration, "announcementRoomName",
+ "YOU_NEED_TO_PUT_THE_NAME_OF_THE_DISCORD_ROOM_YOU_WANT_ELITEMOBS" +
+ "_ANNOUNCEMENTS_TO_BE_BROADCASTED_IN_AS_YOU_HAVE_IN_YOUR_DISCORDSRV_" +
+ "CONFIGURATION_FILE_CHECK_ELITEMOBS_WIKI_FOR_DETAILS", false);
+
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java
new file mode 100644
index 000000000..12944c718
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/DungeonsConfig.java
@@ -0,0 +1,97 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class DungeonsConfig extends ConfigurationFile {
+
+ @Getter
+ private static String instancedDungeonTitle;
+ @Getter
+ private static List instancedDungeonDescription;
+ @Getter
+ private static String dungeonRezInstructions;
+ @Getter
+ private static String dungeonLivesLeftText;
+ @Getter
+ private static String dungeonJoinAsPlayerText;
+ @Getter
+ private static String dungeonJoinAsSpectatorText;
+ @Getter
+ private static boolean allowSpectatorsInInstancedContent;
+ @Getter
+ private static String instancedDungeonCompleteMessage;
+ @Getter
+ private static String instancedDungeonClosingInstanceMessage;
+ @Getter
+ private static boolean friendlyFireInDungeons;
+ @Getter
+ private static double fireDamageMultiplier;
+ @Getter
+ private static double poisonDamageMultiplier;
+ @Getter
+ private static double witherDamageMultiplier;
+
+ public DungeonsConfig() {
+ super("dungeons.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+
+ dungeonRezInstructions = ConfigurationEngine.setString(
+ List.of("Sets the text that appears over resurrection banners in dungeons"),
+ file, fileConfiguration, "dungeonRezInstructions", "&aPunch to rez!", true);
+ dungeonLivesLeftText = ConfigurationEngine.setString(
+ List.of("Sets the text that shows how many lives players have left in a dungeon! Placeholders:", "$amount - the amount of lives left"),
+ file, fileConfiguration, "dungeonLivesLeftText", "&c$amount lives left!", true);
+ dungeonJoinAsPlayerText = ConfigurationEngine.setString(
+ List.of("Sets the text for joining a dungeon as a player! Placeholders:", "$dungeonName - the name of the dungeon"),
+ file, fileConfiguration, "joinDungeonAsPlayerText", "&fJoin $dungeonName as a player!", true);
+ dungeonJoinAsSpectatorText = ConfigurationEngine.setString(
+ List.of("Sets the text for joining a dungeon as a spectator! Placeholders:", "$dungeonName - the name of the dungeon"),
+ file, fileConfiguration, "joinDungeonAsSpectatorText", "&fJoin $dungeonName as a spectator!", true);
+ instancedDungeonTitle = ConfigurationEngine.setString(
+ List.of(
+ "Sets the title that will show up in the item description of instanced dungeon menus",
+ "$difficulty is the placeholder for the difficulty name in the configuration file of the dungeon"),
+ file, fileConfiguration, "instancedDungeonTitle", "Start $difficulty difficulty dungeon!",
+ true);
+ instancedDungeonDescription = ConfigurationEngine.setList(
+ List.of("Sets the description that will show up in the item description of instanced dungeon menus",
+ "$dungeonName is the placeholder for the dungeon name in the configuration file of the dungeon"),
+ file,
+ fileConfiguration,
+ "instancedDungeonDescription",
+ List.of("&fCreate a new instance of the dungeon", "$dungeonName &ffor yourself and maybe", "&fsome friends!"),
+ true);
+ allowSpectatorsInInstancedContent = ConfigurationEngine.setBoolean(
+ List.of("Sets is spectating instanced content will be available."),
+ fileConfiguration, "allowSpectatorsInInstancedContent", true);
+ instancedDungeonCompleteMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when an instanced dungeon is completed"),
+ file, fileConfiguration, "instancedDungeonCompleteMessage", "[EliteMobs] Dungeon completed! It will self-destruct in 2 minutes!",
+ true);
+ instancedDungeonClosingInstanceMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when an instanced dungeon closing"),
+ file, fileConfiguration, "instancedDungeonClosingInstanceMessage", "[EliteMobs] Closing instance!",
+ true);
+ friendlyFireInDungeons = ConfigurationEngine.setBoolean(
+ List.of("Sets if PvP will be allowed in dungeons"),
+ fileConfiguration, "friendlyFireInDungeons", false);
+ fireDamageMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the damage multiplier for fire damage in dungeons",
+ "This is important for balance as by default the damage is a bit too high for the dungeons as we design them"),
+ fileConfiguration, "fireDamageMultiplier", 0.5);
+ witherDamageMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the damage multiplier for wither damage in dungeons",
+ "This is important for balance as by default the damage is a bit too high for the dungeons as we design them"),
+ fileConfiguration, "witherDamageMultiplier", 0.5);
+ poisonDamageMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the damage multiplier for fire damage in dungeons",
+ "This is important for balance as by default the damage is a bit too high for the dungeons as we design them"),
+ fileConfiguration, "poisonDamageMultiplier", 0.5);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java
index 6863efb39..20a73bea6 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/EconomySettingsConfig.java
@@ -1,317 +1,280 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-import com.magmaguy.elitemobs.mobconstructor.CombatSystem;
-import org.bukkit.configuration.Configuration;
+import com.magmaguy.elitemobs.combatsystem.CombatSystem;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+import org.bukkit.Material;
+import org.bukkit.configuration.file.FileConfiguration;
-import java.util.Arrays;
+import java.util.List;
/**
* Created by MagmaGuy on 17/06/2017.
*/
-public class EconomySettingsConfig {
+public class EconomySettingsConfig extends ConfigurationFile {
+ @Getter
+ private static boolean enableEconomy;
+ @Getter
+ private static double resaleValue;
+ @Getter
+ private static String currencyName;
+ @Getter
+ private static boolean useVault;
+ @Getter
+ private static boolean enableCurrencyShower;
+ @Getter
+ private static double currencyShowerMultiplier;
+ @Getter
+ private static String chatCurrencyShowerMessage;
+ @Getter
+ private static String actionBarCurrencyShowerMessage;
+ @Getter
+ private static String lootShowerMaterial1;
+ @Getter
+ private static String lootShowerMaterial5;
+ @Getter
+ private static String lootShowerMaterial10;
+ @Getter
+ private static String lootShowerMaterial20;
+ @Getter
+ private static String lootShowerMaterial50;
+ @Getter
+ private static String lootShowerMaterial100;
+ @Getter
+ private static String lootShowerMaterial500;
+ @Getter
+ private static String lootShowerMaterial1000;
+ @Getter
+ private static String adventurersGuildNotificationMessage;
+ @Getter
+ private static double defaultMaterialWorth;
+ @Getter
+ private static FileConfiguration thisConfiguration;
+ @Getter
+ private static double playerToPlayerTaxes;
+ @Getter
+ private static String economyPayMessage;
+ @Getter
+ private static String economyCurrencyLeftMessage;
+ @Getter
+ private static String economyPaymentReceivedMessage;
+ @Getter
+ private static String economyPaymentInsufficientCurrency;
+ @Getter
+ private static String economyWalletCommand;
+ @Getter
+ private static String economyTaxMessage;
+ @Getter
+ private static String shopBuyMessage;
+ @Getter
+ private static String shopSellMessage;
+ @Getter
+ private static String shopInsufficientFundsMessage;
+ @Getter
+ private static String shopSaleInstructions;
+ @Getter
+ private static String shopSaleOthersItems;
+ @Getter
+ private static String shopCurrentBalance;
+ @Getter
+ private static String shopItemPrice;
+ @Getter
+ private static String shopBatchSellMessage;
- public static final String CONFIG_NAME = "EconomySettings.yml";
- public static final String ENABLE_ECONOMY = "Enable economy";
- public static final String RESALE_VALUE = "Item resale value (percentage)";
- public static final String LOWEST_PROCEDURALLY_SIMULATED_LOOT = "Procedurally Generated Loot.Lowest shop item tier";
- public static final String HIGHEST_PROCEDURALLY_SIMULATED_LOOT = "Procedurally Generated Loot.Highest shop item tier";
- public static final String CURRENCY_NAME = "Currency name";
- public static final String SHOP_NAME = "Shop name";
- public static final String CUSTOM_SHOP_NAME = "Custom shop name";
- public static final String SIGNATURE_ITEM_LOCATION_SHOPS = "Reroll button location for EliteMobs Shops";
- public static final String SHOP_VALID_SLOTS = "Valid chest slots for EliteMobs Shop";
- public static final String CUSTOM_SHOP_VALID_SLOTS = "Valid chest slots for EliteMobs Custom Shop";
- private static final String MATERIAL_WORTH = "Material worth.";
- public static final String DIAMOND_AXE = MATERIAL_WORTH + "DIAMOND_AXE";
- public static final String DIAMOND_BARDING = MATERIAL_WORTH + "DIAMOND_BARDING";
- public static final String DIAMOND_BLOCK = MATERIAL_WORTH + "DIAMOND_BLOCK";
- public static final String DIAMOND_BOOTS = MATERIAL_WORTH + "DIAMOND_BOOTS";
- public static final String DIAMOND_CHESTPLATE = MATERIAL_WORTH + "DIAMOND_CHESTPLATE";
- public static final String DIAMOND_HELMET = MATERIAL_WORTH + "DIAMOND_HELMET";
- public static final String DIAMOND_HOE = MATERIAL_WORTH + "DIAMOND_HOE";
- public static final String DIAMOND_LEGGINGS = MATERIAL_WORTH + "DIAMOND_LEGGINGS";
- public static final String DIAMOND_ORE = MATERIAL_WORTH + "DIAMOND_ORE";
- public static final String DIAMOND_PICKAXE = MATERIAL_WORTH + "DIAMOND_PICKAXE";
- public static final String DIAMOND_SPADE = MATERIAL_WORTH + "DIAMOND_SPADE";
- public static final String DIAMOND_SWORD = MATERIAL_WORTH + "DIAMOND_SWORD";
- public static final String IRON_AXE = MATERIAL_WORTH + "IRON_AXE";
- public static final String IRON_BARDING = MATERIAL_WORTH + "IRON_BARDING";
- public static final String IRON_BLOCK = MATERIAL_WORTH + "IRON_BLOCK";
- public static final String IRON_BOOTS = MATERIAL_WORTH + "IRON_BOOTS";
- public static final String IRON_CHESTPLATE = MATERIAL_WORTH + "IRON_CHESTPLATE";
- public static final String IRON_HELMET = MATERIAL_WORTH + "IRON_HELMET";
- public static final String IRON_HOE = MATERIAL_WORTH + "IRON_HOE";
- public static final String IRON_INGOT = MATERIAL_WORTH + "IRON_INGOT";
- public static final String IRON_LEGGINGS = MATERIAL_WORTH + "IRON_LEGGINGS";
- public static final String IRON_NUGGET = MATERIAL_WORTH + "IRON_NUGGET";
- public static final String IRON_ORE = MATERIAL_WORTH + "IRON_ORE";
- public static final String IRON_PICKAXE = MATERIAL_WORTH + "IRON_PICKAXE";
- public static final String IRON_SPADE = MATERIAL_WORTH + "IRON_SPADE";
- public static final String IRON_SWORD = MATERIAL_WORTH + "IRON_SWORD";
- public static final String SHIELD = MATERIAL_WORTH + "SHIELD";
- public static final String BOW = MATERIAL_WORTH + "BOW";
- public static final String CHAINMAIL_BOOTS = MATERIAL_WORTH + "CHAINMAIL_BOOTS";
- public static final String CHAINMAIL_CHESTPLATE = MATERIAL_WORTH + "CHAINMAIL_CHESTPLATE";
- public static final String CHAINMAIL_HELMET = MATERIAL_WORTH + "CHAINMAIL_HELMET";
- public static final String CHAINMAIL_LEGGINGS = MATERIAL_WORTH + "CHAINMAIL_LEGGINGS";
- public static final String STONE_SWORD = MATERIAL_WORTH + "STONE_SWORD";
- public static final String STONE_SPADE = MATERIAL_WORTH + "STONE_SPADE";
- public static final String STONE_PICKAXE = MATERIAL_WORTH + "STONE_PICKAXE";
- public static final String STONE_AXE = MATERIAL_WORTH + "STONE_AXE";
- public static final String GOLD_AXE = MATERIAL_WORTH + "GOLD_AXE";
- public static final String GOLD_BARDING = MATERIAL_WORTH + "GOLD_BARDING";
- public static final String GOLD_BLOCK = MATERIAL_WORTH + "GOLD_BLOCK";
- public static final String GOLD_BOOTS = MATERIAL_WORTH + "GOLD_BOOTS";
- public static final String GOLD_CHESTPLATE = MATERIAL_WORTH + "GOLD_CHESTPLATE";
- public static final String GOLD_HELMET = MATERIAL_WORTH + "GOLD_HELMET";
- public static final String GOLD_HOE = MATERIAL_WORTH + "GOLD_HOE";
- public static final String GOLD_INGOT = MATERIAL_WORTH + "GOLD_INGOT";
- public static final String GOLD_LEGGINGS = MATERIAL_WORTH + "GOLD_LEGGINGS";
- public static final String GOLD_NUGGET = MATERIAL_WORTH + "GOLD_NUGGET";
- public static final String GOLD_ORE = MATERIAL_WORTH + "GOLD_ORE";
- public static final String GOLD_PICKAXE = MATERIAL_WORTH + "GOLD_PICKAXE";
- public static final String GOLD_SPADE = MATERIAL_WORTH + "GOLD_SPADE";
- public static final String GOLD_SWORD = MATERIAL_WORTH + "GOLD_SWORD";
- public static final String GOLDEN_APPLE = MATERIAL_WORTH + "GOLDEN_APPLE";
- public static final String GOLDEN_CARROT = MATERIAL_WORTH + "GOLDEN_CARROT";
- public static final String LEATHER_BOOTS = MATERIAL_WORTH + "LEATHER_BOOTS";
- public static final String LEATHER_CHESTPLATE = MATERIAL_WORTH + "LEATHER_CHESTPLATE";
- public static final String LEATHER_HELMET = MATERIAL_WORTH + "LEATHER_HELMET";
- public static final String LEATHER_LEGGINGS = MATERIAL_WORTH + "LEATHER_LEGGINGS";
- public static final String WOOD_SWORD = MATERIAL_WORTH + "WOOD_SWORD";
- public static final String WOOD_AXE = MATERIAL_WORTH + "WOOD_AXE";
- public static final String WOOD_PICKAXE = MATERIAL_WORTH + "WOOD_PICKAXE";
- public static final String WOOD_HOE = MATERIAL_WORTH + "WOOD_HOE";
- public static final String OTHER = MATERIAL_WORTH + "OTHER";
+ public EconomySettingsConfig() {
+ super("EconomySettings.yml");
+ }
- private static final String ENCHANTMENT_WORTH = "Enchantment worth.";
- public static final String ARROW_DAMAGE = ENCHANTMENT_WORTH + "ARROW_DAMAGE";
- public static final String ARROW_FIRE = ENCHANTMENT_WORTH + "ARROW_FIRE";
- public static final String ARROW_INFINITE = ENCHANTMENT_WORTH + "ARROW_INFINITE";
- public static final String ARROW_KNOCKBACK = ENCHANTMENT_WORTH + "ARROW_KNOCKBACK";
- public static final String BINDING_CURSE = ENCHANTMENT_WORTH + "BINDING_CURSE";
- public static final String DAMAGE_ALL = ENCHANTMENT_WORTH + "DAMAGE_ALL";
- public static final String DAMAGE_ARTHROPODS = ENCHANTMENT_WORTH + "DAMAGE_ARTHROPODS";
- public static final String DAMAGE_UNDEAD = ENCHANTMENT_WORTH + "DAMAGE_UNDEAD";
- public static final String DEPTH_STRIDER = ENCHANTMENT_WORTH + "DEPTH_STRIDER";
- public static final String DIG_SPEED = ENCHANTMENT_WORTH + "DIG_SPEED";
- public static final String DURABILITY = ENCHANTMENT_WORTH + "DURABILITY";
- public static final String FIRE_ASPECT = ENCHANTMENT_WORTH + "FIRE_ASPECT";
- public static final String FROST_WALKER = ENCHANTMENT_WORTH + "FROST_WALKER";
- public static final String KNOCKBACK = ENCHANTMENT_WORTH + "KNOCKBACK";
- public static final String LOOT_BONUS_BLOCKS = ENCHANTMENT_WORTH + "LOOT_BONUS_BLOCKS";
- public static final String LOOT_BONUS_MOBS = ENCHANTMENT_WORTH + "LOOT_BONUS_MOBS";
- public static final String LUCK_ENCHANTMENT = ENCHANTMENT_WORTH + "LUCK";
- public static final String LURE = ENCHANTMENT_WORTH + "LURE";
- public static final String MENDING = ENCHANTMENT_WORTH + "MENDING";
- public static final String OXYGEN = ENCHANTMENT_WORTH + "OXYGEN";
- public static final String PROTECTION_ENVIRONMENTAL = ENCHANTMENT_WORTH + "PROTECTION_ENVIRONMENTAL";
- public static final String PROTECTION_EXPLOSIONS = ENCHANTMENT_WORTH + "PROTECTION_EXPLOSIONS";
- public static final String PROTECTION_FALL = ENCHANTMENT_WORTH + "PROTECTION_FALL";
- public static final String PROTECTION_PROJECTILE = ENCHANTMENT_WORTH + "PROTECTION_PROJECTILE";
- public static final String PROTECTION_FIRE = ENCHANTMENT_WORTH + "PROTECTION_FIRE";
- public static final String SILK_TOUCH = ENCHANTMENT_WORTH + "SILK_TOUCH";
- public static final String SWEEPING_EDGE = ENCHANTMENT_WORTH + "SWEEPING_EDGE";
- public static final String THORNS = ENCHANTMENT_WORTH + "THORNS";
- public static final String VANISHING_CURSE = ENCHANTMENT_WORTH + "VANISHING_CURSE";
- public static final String WATER_WORKER = ENCHANTMENT_WORTH + "WATER_WORKER";
+ private static void addMaterial(FileConfiguration fileConfiguration, Material material, double value) {
+ ConfigurationEngine.setDouble(
+ List.of("Sets the worth of this material for the elitemobs currency system."),
+ fileConfiguration, "materialWorth." + material.name(), value);
+ }
- private static final String POTION_EFFECT_WORTH = "Potion effect worth.";
- public static final String ABSORPTION = POTION_EFFECT_WORTH + "ABSORPTION";
- public static final String BLINDNESS = POTION_EFFECT_WORTH + "BLINDNESS";
- public static final String CONFUSION = POTION_EFFECT_WORTH + "CONFUSION";
- public static final String DAMAGE_RESISTANCE = POTION_EFFECT_WORTH + "DAMAGE_RESISTANCE";
- public static final String FAST_DIGGING = POTION_EFFECT_WORTH + "FAST_DIGGING";
- public static final String FIRE_RESISTANCE = POTION_EFFECT_WORTH + "FIRE_RESISTANCE";
- public static final String GLOWING = POTION_EFFECT_WORTH + "GLOWING";
- public static final String HARM = POTION_EFFECT_WORTH + "HARM";
- public static final String HEAL = POTION_EFFECT_WORTH + "HEAL";
- public static final String HEALTH_BOOST = POTION_EFFECT_WORTH + "HEALTH_BOOST";
- public static final String HUNGER = POTION_EFFECT_WORTH + "HUNGER";
- public static final String INCREASE_DAMAGE = POTION_EFFECT_WORTH + "INCREASE_DAMAGE";
- public static final String INVISIBILITY = POTION_EFFECT_WORTH + "INVISIBILITY";
- public static final String JUMP = POTION_EFFECT_WORTH + "JUMP";
- public static final String LEVITATION = POTION_EFFECT_WORTH + "LEVITATION";
- public static final String LUCK_POTION = POTION_EFFECT_WORTH + "LUCK";
- public static final String NIGHT_VISION = POTION_EFFECT_WORTH + "NIGHT_VISION";
- public static final String POISON = POTION_EFFECT_WORTH + "POISON";
- public static final String REGENERATION = POTION_EFFECT_WORTH + "REGENERATION";
- public static final String SATURATION = POTION_EFFECT_WORTH + "SATURATION_NAME";
- public static final String SLOW = POTION_EFFECT_WORTH + "SLOW";
- public static final String SLOW_DIGGING = POTION_EFFECT_WORTH + "SLOW_DIGGING";
- public static final String SPEED = POTION_EFFECT_WORTH + "SPEED";
- public static final String UNLUCK = POTION_EFFECT_WORTH + "UNLUCK";
- public static final String WATER_BREATHING = POTION_EFFECT_WORTH + "WATER_BREATHING";
- public static final String WEAKNESS = POTION_EFFECT_WORTH + "WEAKNESS";
- public static final String WITHER = POTION_EFFECT_WORTH + "WITHER";
+ public static double getMaterialWorth(Material material) {
+ try {
+ return thisConfiguration.getDouble("materialWorth." + material.name());
+ } catch (Exception ex) {
+ return defaultMaterialWorth;
+ }
+ }
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
+ @Override
+ public void initializeValues() {
+ double netheriteLevel = CombatSystem.NETHERITE_TIER_LEVEL + 10D;
+ double tridentLevel = CombatSystem.DIAMOND_TIER_LEVEL + 10D;
+ double diamondLevel = CombatSystem.DIAMOND_TIER_LEVEL + 10D;
+ double ironLevel = CombatSystem.IRON_TIER_LEVEL + 10D;
+ double stoneChainLevel = CombatSystem.STONE_CHAIN_TIER_LEVEL + 10D;
+ double goldWoodLeatherLevel = CombatSystem.GOLD_WOOD_LEATHER_TIER_LEVEL + 10D;
- public void initializeConfig() {
+ enableEconomy = ConfigurationEngine.setBoolean(
+ List.of("Sets if the EliteMobs economy is enabled. This means elite coins, the ability to buy and sell gear and the ability to upgrade guild ranks", "If disabled, players will not be able to progress in the plugin!"),
+ fileConfiguration, "enableEconomy", true);
+ resaleValue = ConfigurationEngine.setDouble(
+ List.of("Sets the resale item of items, as a % of the original price. 5 is 5%"),
+ fileConfiguration, "itemResaleValue", 5);
+ currencyName = ConfigurationEngine.setString(
+ List.of("Sets the in-game name of the currency used."),
+ file, fileConfiguration, "currencyName", "Elite Coins", true);
+ useVault = ConfigurationEngine.setBoolean(
+ List.of("Sets the plugin to use Vault. THIS IS NOT RECOMMENDED! Read why here: https://github.com/MagmaGuy/EliteMobs/wiki/%5BThird-party-support%5D-Vault"),
+ fileConfiguration, "useVault - not recommended", false);
+ enableCurrencyShower = ConfigurationEngine.setBoolean(
+ List.of("Sets if elites will drop coins based on their level."),
+ fileConfiguration, "enableCurrencyShower", true);
+ currencyShowerMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier for the currency dropped by elites."),
+ fileConfiguration, "currencyShowerTierMultiplier", 1D);
+ chatCurrencyShowerMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent when players pick up elite currency."),
+ file, fileConfiguration, "chatCurrencyShowerMessage", "&7[EM] You've picked up &a$amount $currency_name!", true);
+ actionBarCurrencyShowerMessage = ConfigurationEngine.setString(
+ List.of("Sets the action bar message sent when players pick up elite currency."),
+ file, fileConfiguration, "actionbarCurrencyShowerMessage", "&7[EM] You've picked up &a$amount $currency_name!", true);
+ lootShowerMaterial1 = ConfigurationEngine.setString(
+ List.of("Sets the material type of 1 dropped elite coin."),
+ file, fileConfiguration, "lootShowerMaterial.1", Material.GOLD_NUGGET.name(), false);
+ ConfigurationEngine.setInt(
+ List.of("Sets the custom model ID for 1 dropped elite coin. Used by the resource pack."),
+ fileConfiguration, "lootShowerData.1", 1);
+ lootShowerMaterial5 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.5", Material.GOLD_INGOT.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.5", 1);
+ lootShowerMaterial10 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.10", Material.GOLD_BLOCK.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.10", 1);
+ lootShowerMaterial20 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.20", Material.EMERALD.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.20", 1);
+ lootShowerMaterial50 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.50", Material.EMERALD_BLOCK.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.50", 1);
+ lootShowerMaterial100 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.100", Material.DIAMOND.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.100", 1);
+ lootShowerMaterial500 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.500", Material.DIAMOND_BLOCK.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.500", 1);
+ lootShowerMaterial1000 = ConfigurationEngine.setString(file, fileConfiguration, "lootShowerMaterial.1000", Material.NETHER_STAR.name(), false);
+ ConfigurationEngine.setInt(fileConfiguration, "lootShowerData.1000", 1);
+ adventurersGuildNotificationMessage = ConfigurationEngine.setString(
+ List.of("Send the message players get after looting currency. Useful for tutorial purposes."),
+ file, fileConfiguration, "adventurersGuildNotificationMessages", "&7[EM] Extra spending money? Try &a/ag !", true);
- double diamondLevel = CombatSystem.DIAMOND_TIER_LEVEL + 10;
- double ironLevel = CombatSystem.IRON_TIER_LEVEL + 10;
- double stoneChainLevel = CombatSystem.STONE_CHAIN_TIER_LEVEL + 10;
- double goldWoodLeatherLevel = CombatSystem.GOLD_WOOD_LEATHER_TIER_LEVEL + 10;
+ addMaterial(fileConfiguration, Material.DIAMOND_AXE, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_BOOTS, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_CHESTPLATE, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_LEGGINGS, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_HELMET, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_PICKAXE, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_SHOVEL, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_SWORD, diamondLevel);
+ addMaterial(fileConfiguration, Material.DIAMOND_HOE, diamondLevel);
- configuration.addDefault(ENABLE_ECONOMY, true);
- configuration.addDefault(RESALE_VALUE, 5);
- configuration.addDefault(LOWEST_PROCEDURALLY_SIMULATED_LOOT, 1);
- configuration.addDefault(HIGHEST_PROCEDURALLY_SIMULATED_LOOT, 5);
- configuration.addDefault(CURRENCY_NAME, "Elite Coins");
- configuration.addDefault(SHOP_NAME, "EliteMobs Shop");
- configuration.addDefault(CUSTOM_SHOP_NAME, "EliteMobs Custom Shop");
- configuration.addDefault(SIGNATURE_ITEM_LOCATION_SHOPS, 4);
- configuration.addDefault(SHOP_VALID_SLOTS, Arrays.asList(9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53));
- configuration.addDefault(CUSTOM_SHOP_VALID_SLOTS, Arrays.asList(9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53));
+ addMaterial(fileConfiguration, Material.IRON_AXE, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_BOOTS, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_LEGGINGS, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_CHESTPLATE, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_HELMET, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_PICKAXE, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_SHOVEL, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_HOE, ironLevel);
+ addMaterial(fileConfiguration, Material.IRON_SWORD, ironLevel);
+ addMaterial(fileConfiguration, Material.SHIELD, ironLevel);
+ addMaterial(fileConfiguration, Material.BOW, ironLevel);
- configuration.addDefault(DIAMOND_AXE, diamondLevel);
- configuration.addDefault(DIAMOND_BARDING, diamondLevel);
- configuration.addDefault(DIAMOND_BLOCK, diamondLevel);
- configuration.addDefault(DIAMOND_BOOTS, diamondLevel);
- configuration.addDefault(DIAMOND_CHESTPLATE, diamondLevel);
- configuration.addDefault(DIAMOND_HELMET, diamondLevel);
- configuration.addDefault(DIAMOND_HOE, diamondLevel);
- configuration.addDefault(DIAMOND_LEGGINGS, diamondLevel);
- configuration.addDefault(DIAMOND_ORE, diamondLevel);
- configuration.addDefault(DIAMOND_PICKAXE, diamondLevel);
- configuration.addDefault(DIAMOND_SPADE, diamondLevel);
- configuration.addDefault(DIAMOND_SWORD, diamondLevel);
- configuration.addDefault(IRON_AXE, ironLevel);
- configuration.addDefault(IRON_BARDING, ironLevel);
- configuration.addDefault(IRON_BLOCK, ironLevel);
- configuration.addDefault(IRON_BOOTS, ironLevel);
- configuration.addDefault(IRON_CHESTPLATE, ironLevel);
- configuration.addDefault(IRON_HELMET, ironLevel);
- configuration.addDefault(IRON_HOE, ironLevel);
- configuration.addDefault(IRON_INGOT, ironLevel);
- configuration.addDefault(IRON_LEGGINGS, ironLevel);
- configuration.addDefault(IRON_NUGGET, ironLevel);
- configuration.addDefault(IRON_ORE, ironLevel);
- configuration.addDefault(IRON_PICKAXE, ironLevel);
- configuration.addDefault(IRON_SPADE, ironLevel);
- configuration.addDefault(IRON_SWORD, ironLevel);
- configuration.addDefault(SHIELD, ironLevel);
- configuration.addDefault(BOW, ironLevel);
- configuration.addDefault(CHAINMAIL_BOOTS, stoneChainLevel);
- configuration.addDefault(CHAINMAIL_CHESTPLATE, stoneChainLevel);
- configuration.addDefault(CHAINMAIL_HELMET, stoneChainLevel);
- configuration.addDefault(CHAINMAIL_LEGGINGS, stoneChainLevel);
- configuration.addDefault(STONE_SWORD, stoneChainLevel);
- configuration.addDefault(STONE_AXE, stoneChainLevel);
- configuration.addDefault(STONE_PICKAXE, stoneChainLevel);
- configuration.addDefault(STONE_SPADE, stoneChainLevel);
- configuration.addDefault(GOLD_AXE, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_BARDING, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_BLOCK, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_BOOTS, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_CHESTPLATE, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_HELMET, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_HOE, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_INGOT, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_LEGGINGS, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_NUGGET, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_ORE, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_PICKAXE, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_SPADE, goldWoodLeatherLevel);
- configuration.addDefault(GOLD_SWORD, goldWoodLeatherLevel);
- configuration.addDefault(GOLDEN_APPLE, goldWoodLeatherLevel);
- configuration.addDefault(GOLDEN_CARROT, goldWoodLeatherLevel);
- configuration.addDefault(LEATHER_BOOTS, goldWoodLeatherLevel);
- configuration.addDefault(LEATHER_CHESTPLATE, goldWoodLeatherLevel);
- configuration.addDefault(LEATHER_HELMET, goldWoodLeatherLevel);
- configuration.addDefault(LEATHER_LEGGINGS, goldWoodLeatherLevel);
- configuration.addDefault(WOOD_SWORD, goldWoodLeatherLevel);
- configuration.addDefault(WOOD_AXE, goldWoodLeatherLevel);
- configuration.addDefault(WOOD_PICKAXE, goldWoodLeatherLevel);
- configuration.addDefault(WOOD_HOE, goldWoodLeatherLevel);
- configuration.addDefault(OTHER, 1);
+ addMaterial(fileConfiguration, Material.CHAINMAIL_BOOTS, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.CHAINMAIL_LEGGINGS, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.CHAINMAIL_CHESTPLATE, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.CHAINMAIL_HELMET, stoneChainLevel);
- configuration.addDefault(ARROW_DAMAGE, diamondLevel);
- configuration.addDefault(ARROW_FIRE, diamondLevel / 2);
- configuration.addDefault(ARROW_INFINITE, diamondLevel / 2);
- configuration.addDefault(ARROW_KNOCKBACK, diamondLevel / 2);
- configuration.addDefault(BINDING_CURSE, -1);
- configuration.addDefault(DAMAGE_ALL, diamondLevel);
- configuration.addDefault(DAMAGE_ARTHROPODS, diamondLevel / 2);
- configuration.addDefault(DAMAGE_UNDEAD, diamondLevel / 2);
- configuration.addDefault(DEPTH_STRIDER, 1);
- configuration.addDefault(DIG_SPEED, diamondLevel);
- configuration.addDefault(DURABILITY, diamondLevel);
- configuration.addDefault(FIRE_ASPECT, diamondLevel / 2);
- configuration.addDefault(FROST_WALKER, 1);
- configuration.addDefault(KNOCKBACK, diamondLevel / 2);
- configuration.addDefault(LOOT_BONUS_BLOCKS, diamondLevel);
- configuration.addDefault(LOOT_BONUS_MOBS, diamondLevel / 2);
- configuration.addDefault(LUCK_ENCHANTMENT, 1);
- configuration.addDefault(LURE, 1);
- configuration.addDefault(MENDING, diamondLevel * 2);
- configuration.addDefault(OXYGEN, 1);
- configuration.addDefault(PROTECTION_ENVIRONMENTAL, diamondLevel);
- configuration.addDefault(PROTECTION_EXPLOSIONS, diamondLevel / 2);
- configuration.addDefault(PROTECTION_FALL, diamondLevel / 2);
- configuration.addDefault(PROTECTION_FIRE, diamondLevel / 2);
- configuration.addDefault(PROTECTION_PROJECTILE, diamondLevel);
- configuration.addDefault(SILK_TOUCH, diamondLevel);
- configuration.addDefault(SWEEPING_EDGE, diamondLevel);
- configuration.addDefault(THORNS, diamondLevel);
- configuration.addDefault(VANISHING_CURSE, -1);
- configuration.addDefault(WATER_WORKER, 1);
+ addMaterial(fileConfiguration, Material.STONE_SWORD, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.STONE_AXE, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.STONE_PICKAXE, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.STONE_SHOVEL, stoneChainLevel);
+ addMaterial(fileConfiguration, Material.STONE_HOE, stoneChainLevel);
- configuration.addDefault(ABSORPTION, (diamondLevel) * 10);
- configuration.addDefault(BLINDNESS, (diamondLevel / 2) * 10);
- configuration.addDefault(CONFUSION, (diamondLevel / 2) * 10);
- configuration.addDefault(DAMAGE_RESISTANCE, (diamondLevel) * 10);
- configuration.addDefault(FAST_DIGGING, (diamondLevel) * 10);
- configuration.addDefault(FIRE_RESISTANCE, (diamondLevel / 2) * 10);
- configuration.addDefault(GLOWING, (1) * 10);
- configuration.addDefault(HARM, (diamondLevel) * 10);
- configuration.addDefault(HEAL, (diamondLevel) * 10);
- configuration.addDefault(HEALTH_BOOST, (diamondLevel) * 10);
- configuration.addDefault(HUNGER, (1) * 10);
- configuration.addDefault(INCREASE_DAMAGE, (diamondLevel) * 10);
- configuration.addDefault(INVISIBILITY, (diamondLevel / 2) * 10);
- configuration.addDefault(JUMP, (diamondLevel / 2) * 10);
- configuration.addDefault(LEVITATION, (diamondLevel / 2) * 10);
- configuration.addDefault(LUCK_POTION, (1) * 10);
- configuration.addDefault(NIGHT_VISION, (1) * 10);
- configuration.addDefault(POISON, (diamondLevel / 2) * 10);
- configuration.addDefault(REGENERATION, (diamondLevel) * 10);
- configuration.addDefault(SATURATION, (diamondLevel / 2) * 10);
- configuration.addDefault(SLOW, (diamondLevel / 2) * 10);
- configuration.addDefault(SLOW_DIGGING, (1) * 10);
- configuration.addDefault(SPEED, (diamondLevel / 2) * 10);
- configuration.addDefault(UNLUCK, (1) * 10);
- configuration.addDefault(WATER_BREATHING, (1) * 10);
- configuration.addDefault(WEAKNESS, (diamondLevel) * 10);
- configuration.addDefault(WITHER, (diamondLevel / 2) * 10);
+ addMaterial(fileConfiguration, Material.GOLDEN_AXE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_BOOTS, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_LEGGINGS, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_CHESTPLATE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_HELMET, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_SWORD, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_SHOVEL, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_PICKAXE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_HOE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.GOLDEN_APPLE, diamondLevel);
+ addMaterial(fileConfiguration, Material.ENCHANTED_GOLDEN_APPLE, diamondLevel);
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
+ addMaterial(fileConfiguration, Material.LEATHER_BOOTS, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.LEATHER_LEGGINGS, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.LEATHER_CHESTPLATE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.LEATHER_HELMET, goldWoodLeatherLevel);
- }
+ addMaterial(fileConfiguration, Material.WOODEN_SWORD, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.WOODEN_AXE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.WOODEN_HOE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.WOODEN_PICKAXE, goldWoodLeatherLevel);
+ addMaterial(fileConfiguration, Material.TRIDENT, tridentLevel);
+ addMaterial(fileConfiguration, Material.ELYTRA, diamondLevel);
+ addMaterial(fileConfiguration, Material.TURTLE_HELMET, goldWoodLeatherLevel);
+
+ addMaterial(fileConfiguration, Material.NETHERITE_AXE, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_PICKAXE, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_SHOVEL, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_HOE, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_SWORD, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_HELMET, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_CHESTPLATE, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_LEGGINGS, netheriteLevel);
+ addMaterial(fileConfiguration, Material.NETHERITE_BOOTS, netheriteLevel);
+
+ defaultMaterialWorth = ConfigurationEngine.setDouble(
+ List.of("Sets the default material worth for items not specifically defined."),
+ fileConfiguration, "materialWorth.defaultMaterialWorth", 1);
+ playerToPlayerTaxes = ConfigurationEngine.setDouble(
+ List.of("Sets the tax rate for transactions between players.", "Strongly recommended for balance reasons, as high level players can gain up to 6x more currency and try to use other players to bypass prestige currency resets."),
+ fileConfiguration, "playerToPlayerPaymentTaxes", 0.2);
+
+ economyPayMessage = ConfigurationEngine.setString(
+ List.of("Message sent when sending elite currency to other players."),
+ file, fileConfiguration, "Economy pay message v2", "&2You have paid &2$amount_sent $currency_name &2to $receiver&2, who got $amount_received after taxes!", true);
+ economyCurrencyLeftMessage = ConfigurationEngine.setString(
+ List.of("Message sent after players send currency."),
+ file, fileConfiguration, "Economy currency left message", "You now have &2$amount_left $currency_name", true);
+ economyPaymentReceivedMessage = ConfigurationEngine.setString(
+ List.of("Message received when receiving currency."),
+ file, fileConfiguration, "Economy money from payment message", "You have received &2$amount_received $currency_name &ffrom $sender", true);
+ economyPaymentInsufficientCurrency = ConfigurationEngine.setString(
+ List.of("Message sent when players try to send an amount of coins they do not have."),
+ file, fileConfiguration, "Economy payment insufficient currency", "&cYou don't have enough $currency_name to do that!", true);
+ economyWalletCommand = ConfigurationEngine.setString(
+ List.of("/em balance message"),
+ file, fileConfiguration, "Wallet command message", "You have &2$balance $currency_name", true);
+ economyTaxMessage = ConfigurationEngine.setString(
+ List.of("Confirmation message sent when players try to send currency to another player."),
+ file, fileConfiguration, "Tax confirmation message", "&cSending a payment will cost $percentage% in taxes. &aDo &9$command &ato proceed!", true);
+ shopBuyMessage = ConfigurationEngine.setString(
+ List.of("Message sent when a player buys from a shop."),
+ file, fileConfiguration, "Shop buy message", "&aYou have bought $item_name &afor $item_value $currency_name!", true);
+ shopCurrentBalance = ConfigurationEngine.setString(
+ List.of("Message sent when a player interacts with a shop."),
+ file, fileConfiguration, "Shop current balance message", "&aYou have $currency_amount $currency_name.", true);
+ shopInsufficientFundsMessage = ConfigurationEngine.setString(
+ List.of("Message sent when players don't have enough currency to purchase an item"),
+ file, fileConfiguration, "Shop insufficient funds message", "&cYou don't have enough $currency_name!", true);
+ shopItemPrice = ConfigurationEngine.setString(
+ List.of("Second part of message sent when players try to purchase an item they can not afford."),
+ file, fileConfiguration, "Shop item cost message", "That item costs &c$item_value $currency_name.", true);
+ shopSellMessage = ConfigurationEngine.setString(
+ List.of("Message sent upon selling an item to a shop."),
+ file, fileConfiguration, "Shop sell message", "&aYou have sold $item_name &afor $currency_amount $currency_name!", true);
+ shopSaleOthersItems = ConfigurationEngine.setString(
+ List.of("Message sent upon trying to sell an item that does not belong to that player."),
+ file, fileConfiguration, "Shop sale player items warning", "&cYou can't sell items that are not currently soulbound to you! This includes items from other prestige tiers!", true);
+ shopSaleInstructions = ConfigurationEngine.setString(
+ List.of("Message sent upon trying to sell a non-EliteMobs item"),
+ file, fileConfiguration, "Shop sale instructions", "&cYou can only sell EliteMobs loot here! (Armor / weapons dropped from elites showing a value on their lore)", true);
+ shopBatchSellMessage = ConfigurationEngine.setString(
+ List.of("Message sent upon selling a batch of elite items."),
+ file, fileConfiguration, "shopBatchSellItem", "&aYou have sold your items &afor $currency_amount $currency_name!", true);
+
+ }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java
index 81ba5fa0b..2d72be5c4 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/EventsConfig.java
@@ -1,120 +1,45 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-import org.bukkit.configuration.Configuration;
-
-public class EventsConfig {
-
- public static final String CONFIG_NAME = "events.yml";
- public static final String ENABLE_EVENTS = "Enable events";
- public static final String MINIMUM_ONLINE_PLAYERS = "Minimum amount of online players for event to trigger";
- public static final String MAXIMUM_ONLINE_PLAYERS = "Maximum amount of online players after which the event frequency won't increase";
- public static final String MINIMUM_EVENT_FREQUENCY = "Minimum event frequency (minutes)";
- public static final String MAXIMUM_EVENT_FREQUENCY = "Maximum event frequency (minutes)";
- private static final String ENABLED_EVENTS = "Enabled events.";
- public static final String TREASURE_GOBLIN_SMALL_ENABLED = ENABLED_EVENTS + "Small treasure goblin";
- public static final String DEAD_MOON_ENABLED = ENABLED_EVENTS + "Dead moon";
- public static final String KRAKEN_ENABLED = ENABLED_EVENTS + "Kraken";
- public static final String BALROG_ENABLED = ENABLED_EVENTS + "Balrog";
- public static final String FAE_ENABLED = ENABLED_EVENTS + "Fae";
- public static final String TREASURE_GOBLIN_NAME = "Name of mob in Treasure Goblin events";
- public static final String SMALL_TREASURE_GOBLIN_EVENT_ANNOUNCEMENT_TEXT = "Small treasure goblin event announcement text";
- public static final String SMALL_TREASURE_GOBLIN_EVENT_PLAYER_END_TEXT = "Small treasure goblin killed by players message";
- public static final String SMALL_TREASURE_GOBLIN_EVENT_OTHER_END_TEXT = "Small treasure goblin nondescript death message";
- public static final String SMALL_TREASURE_GOBLIN_REWARD = "Treasure goblin extra loot drop amount";
- public static final String DEAD_MOON_EVENT_ANNOUNCEMENT_TEXT = "Dead Moon event announcement text";
- public static final String DEAD_MOON_EVENT_PLAYER_END_TEXT = "Zombie King killed by players message";
- public static final String DEAD_MOON_EVENT_OTHER_END_TEXT = "Zombie King nondescript death message";
- private static final String DEAD_MOON_NAMES = "Dead moon names.";
- public static final String DEAD_MOON_THE_RETURNED_NAME = DEAD_MOON_NAMES + "Name of The Returned";
- public static final String DEAD_MOON_ZOMBIE_KING_NAME = DEAD_MOON_NAMES + "Name of the Zombie King";
- private static final String EVENT_WEIGHT = "Event weight.";
- public static final String SMALL_TREASURE_GOBLIN_EVENT_WEIGHT = EVENT_WEIGHT + "Small treasure goblin";
- public static final String DEAD_MOON_EVENT_WEIGHT = EVENT_WEIGHT + "Blood moon";
- public static final String EVENT_TIMEOUT_TIME = "Time before boss mob escapes the map";
- public static final String EVENT_TIMEOUT_MESSAGE = "Message for when boss mobs gets culled";
- public static final String SPIRIT_WALK_HIT_INTERVAL = "Number of hits before spirit walk gets activated";
- public static final String ZOMBIE_KING_FLAMETHROWER_INTERVAL = "Time interval between zombie king flamethrower attacks";
- public static final String ZOMBIE_KING_UNHOLY_SMITE_INTERVAL = "Time interval between zombie king unholy smite attacks";
- public static final String ZOMBIE_KING_SUMMON_MINIONS_INTERVAL = "Time interval between zombie king minion summons";
- public static final String TREASURE_GOBLIN_GOLD_SHOTGUN_INTERVAL = "Time interval between treasure goblin gold shotgun shots";
- public static final String TREASURE_GOBLIN_RADIAL_EXPLOSION = "Time interval between treasure goblin radial explosions";
- public static final String KRAKEN_CHANCE_ON_FISH = "Kraken on fish chance";
- public static final String KRAKEN_NAME = "Name of mob in Kraken event";
- public static final String BALROG_CHANCE_ON_MINE = "Balrog chance on mine";
- public static final String BALROG_NAME = "Name of mob in Balrog event";
- public static final String BALROG_TRASH_MOB_NAME = "Name of trash mobs in Balrog event";
- public static final String FAE_NAME = "Name of mob in Fae event";
- public static final String FAE_CHANCE_ON_CHOP = "Fae chance on chop";
- public static final String ANNOUNCEMENT_BROADCAST_WORLD_ONLY = "Only broadcast event message in event world";
- public static final String DEADMOON_ANNOUNCEMENT_MESSAGE = "Deadmoon announcement message";
- public static final String DEADMOON_END_MESSAGE = "Deadmoon end message";
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void initializeConfig() {
-
- configuration.addDefault(ENABLE_EVENTS, true);
- configuration.addDefault(MINIMUM_ONLINE_PLAYERS, 2);
- configuration.addDefault(MAXIMUM_ONLINE_PLAYERS, 100);
- configuration.addDefault(MINIMUM_EVENT_FREQUENCY, 45);
- configuration.addDefault(MAXIMUM_EVENT_FREQUENCY, 10);
- configuration.addDefault(TREASURE_GOBLIN_SMALL_ENABLED, true);
- configuration.addDefault(DEAD_MOON_ENABLED, true);
- configuration.addDefault(TREASURE_GOBLIN_NAME, "&eTreasure Goblin");
- configuration.addDefault(SMALL_TREASURE_GOBLIN_EVENT_ANNOUNCEMENT_TEXT, "&7&m-----------------------------------------------------\n&7[&aEvent&7] &fA &ctreasure goblin &fhas appeared in&c $world &fat&c $location \n &fMake sure to take a hunting party with you!\n&7&m-----------------------------------------------------");
- configuration.addDefault(SMALL_TREASURE_GOBLIN_EVENT_PLAYER_END_TEXT, "A Treasure Goblin has been slain by $player!");
- configuration.addDefault(SMALL_TREASURE_GOBLIN_EVENT_OTHER_END_TEXT, "A Treasure Goblin has been slain!");
- configuration.addDefault(SMALL_TREASURE_GOBLIN_REWARD, 10);
- configuration.addDefault(DEAD_MOON_EVENT_ANNOUNCEMENT_TEXT, "&7&m-----------------------------------------------------\n&7[&aEvent&7] &fA &cZombie King &fhas appeared in&c $world &fat&c $location \n &fMake sure to take a hunting party with you!\n&7&m-----------------------------------------------------");
- configuration.addDefault(DEAD_MOON_EVENT_PLAYER_END_TEXT, "The Zombie King has been slain by $player!");
- configuration.addDefault(DEAD_MOON_EVENT_OTHER_END_TEXT, "The Zombie King has been slain!");
- configuration.addDefault(DEAD_MOON_THE_RETURNED_NAME, "&2The Returned");
- configuration.addDefault(DEAD_MOON_ZOMBIE_KING_NAME, "&4Zombie King");
- configuration.addDefault(SMALL_TREASURE_GOBLIN_EVENT_WEIGHT, 40);
- configuration.addDefault(DEAD_MOON_EVENT_WEIGHT, 20);
- configuration.addDefault(EVENT_TIMEOUT_TIME, 30);
- configuration.addDefault(EVENT_TIMEOUT_MESSAGE, "$bossmob has escaped!");
- configuration.addDefault(SPIRIT_WALK_HIT_INTERVAL, 15);
- configuration.addDefault(ZOMBIE_KING_FLAMETHROWER_INTERVAL, 20);
- configuration.addDefault(ZOMBIE_KING_UNHOLY_SMITE_INTERVAL, 20);
- configuration.addDefault(ZOMBIE_KING_SUMMON_MINIONS_INTERVAL, 20);
- configuration.addDefault(TREASURE_GOBLIN_GOLD_SHOTGUN_INTERVAL, 20);
- configuration.addDefault(TREASURE_GOBLIN_RADIAL_EXPLOSION, 20);
- configuration.addDefault(KRAKEN_ENABLED, true);
- configuration.addDefault(BALROG_ENABLED, true);
- configuration.addDefault(KRAKEN_CHANCE_ON_FISH, 0.005);
- configuration.addDefault(KRAKEN_NAME, "&1Kraken");
- configuration.addDefault(BALROG_CHANCE_ON_MINE, 0.005);
- configuration.addDefault(BALROG_NAME, "&cBalrog");
- configuration.addDefault(BALROG_TRASH_MOB_NAME, "&cRaug");
- configuration.addDefault(FAE_ENABLED, true);
- configuration.addDefault(FAE_NAME, "&aFae");
- configuration.addDefault(FAE_CHANCE_ON_CHOP, 0.001);
- configuration.addDefault(ANNOUNCEMENT_BROADCAST_WORLD_ONLY, false);
- configuration.addDefault(DEADMOON_ANNOUNCEMENT_MESSAGE, "A dead moon rises, and the undead with it...");
- configuration.addDefault(DEADMOON_END_MESSAGE, "Dawn rises, the Dead Moon wanes for those still alive...");
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class EventsConfig extends ConfigurationFile {
+ @Getter
+ private static boolean announcementBroadcastWorldOnly;
+ @Getter
+ private static int actionEventMinimumCooldown;
+ @Getter
+ private static int timedEventMinimumCooldown;
+ @Getter
+ private static boolean actionEventsEnabled;
+ @Getter
+ private static boolean timedEventsEnabled;
+
+ public EventsConfig() {
+ super("events.yml");
+ }
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
+ @Override
+ public void initializeValues() {
+ announcementBroadcastWorldOnly = ConfigurationEngine.setBoolean(
+ List.of("Sets if events will only broadcasted in the world the events happens in."),
+ fileConfiguration, "Only broadcast event message in event worlds", false);
+ actionEventMinimumCooldown = ConfigurationEngine.setInt(
+ List.of("Sets the minimum cooldown, in minutes, between action events"),
+ fileConfiguration, "actionEventMinimumCooldownMinutes", 4);
+ timedEventMinimumCooldown = ConfigurationEngine.setInt(
+ List.of("Sets the minimum cooldown, in minutes, between timed events"),
+ fileConfiguration, "actionEventMinimumCooldownMinutes", 4);
+ actionEventsEnabled = ConfigurationEngine.setBoolean(
+ List.of("Sets if action events will happen.",
+ "https://github.com/MagmaGuy/EliteMobs/wiki/Creating-Custom-Events#action-events"),
+ fileConfiguration, "actionEventsEnabled", true);
+ timedEventsEnabled = ConfigurationEngine.setBoolean(
+ List.of("Sets if timed events will happen.",
+ "https://github.com/MagmaGuy/EliteMobs/wiki/Creating-Custom-Events#timed-events"),
+ fileConfiguration, "timedEventsEnabled", true);
}
-
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java
new file mode 100644
index 000000000..1e3dc63ec
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/ItemSettingsConfig.java
@@ -0,0 +1,346 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import lombok.Getter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ItemSettingsConfig extends ConfigurationFile {
+ @Getter
+ private static String shopItemSource;
+ @Getter
+ private static boolean doEliteMobsLoot;
+ @Getter
+ private static boolean doMmorpgColors;
+ @Getter
+ private static boolean preventCustomItemPlacement;
+ @Getter
+ private static List loreStructure;
+ @Getter
+ private static String mobItemSource;
+ @Getter
+ private static String loreWorth;
+ @Getter
+ private static String loreResale;
+ @Getter
+ private static double flatDropRate;
+ @Getter
+ private static double regionalBossNonUniqueDropRate;
+ @Getter
+ private static boolean regionalBossesDropVanillaLoot;
+ @Getter
+ private static double levelIncreaseDropRate;
+ @Getter
+ private static double proceduralItemWeight;
+ @Getter
+ private static double weighedItemWeight;
+ @Getter
+ private static double fixedItemWeight;
+ @Getter
+ private static double limitedItemWeight;
+ @Getter
+ private static double scalableItemWeight;
+ @Getter
+ private static double defaultLootMultiplier;
+ @Getter
+ private static double defaultExperienceMultiplier;
+ @Getter
+ private static String potionEffectOnHitTargetLore;
+ @Getter
+ private static int maxLevelForDefaultLootMultiplier;
+ @Getter
+ private static int maximumItemLevel;
+ @Getter
+ private static boolean useEliteEnchantments;
+ @Getter
+ private static String eliteEnchantLoreString;
+ @Getter
+ private static boolean useHoesAsWeapons;
+ @Getter
+ private static boolean enableRareItemParticleEffects;
+ @Getter
+ private static String potionEffectOnHitSelfLore;
+ @Getter
+ private static String potionEffectContinuousLore;
+ @Getter
+ private static String scrapSucceededMessage;
+ @Getter
+ private static String eliteEnchantmentColor;
+ @Getter
+ private static String vanillaEnchantmentColor;
+ @Getter
+ private static String customEnchantmentColor;
+ @Getter
+ private static String potionEffectColor;
+ @Getter
+ private static String noSoulbindLore;
+ @Getter
+ private static boolean preventEliteItemEnchantment;
+ @Getter
+ private static boolean preventEliteItemDisenchantment;
+ @Getter
+ private static String preventEliteItemDisenchantmentMessage;
+ @Getter
+ private static boolean preventEliteItemDiamondToNetheriteUpgrade;
+ @Getter
+ private static boolean eliteDurability;
+ @Getter
+ private static double eliteDurabilityMultiplier;
+ @Getter
+ private static String scrapFailedMessage;
+ @Getter
+ private static boolean putLootDirectlyIntoPlayerInventory;
+ @Getter
+ private static int lootLevelDifferenceLockout;
+ @Getter
+ private static boolean preventEliteItemsFromBreaking;
+ @Getter
+ private static String noItemDurabilityMessage;
+ @Getter
+ private static int minimumProcedurallyGeneratedDiamondLootLevelPlusSeven;
+ @Getter
+ private static String simlootMessageSuccess;
+ @Getter
+ private static String simlootMessageFailure;
+ @Getter
+ private static String directDropCustomLootMessage;
+ @Getter
+ private static String directDropMinecraftLootMessage;
+ @Getter
+ private static String directDropCoinMessage;
+ @Getter
+ private static boolean hideAttributes;
+ @Getter
+ private static String weaponEntry;
+ @Getter
+ private static String armorEntry;
+ @Getter
+ private static String levelRangeTooDifferent;
+
+ public ItemSettingsConfig() {
+ super("ItemSettings.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+
+ doEliteMobsLoot = ConfigurationEngine.setBoolean(
+ List.of("Sets if any EliteMobs loot will drop.",
+ "Includes Elite Coins, Custom Items, Procedurally Generate Items - everything!",
+ "Not recommended, makes mmorpg progression impossible."),
+ fileConfiguration, "doEliteMobsLoot", true);
+ doMmorpgColors = ConfigurationEngine.setBoolean(
+ List.of("Sets if procedurally generated loot will have different colors based on the quality of the item."),
+ fileConfiguration, "doMMORPGColorsForItems", true);
+ preventCustomItemPlacement = ConfigurationEngine.setBoolean(
+ List.of("Sets if the placement of custom items, like banners or blocks, is prevented.", "This is recommended - custom items break when they are placed and can not be recovered!")
+ , fileConfiguration, "preventCustomItemPlacement", true);
+ loreStructure = ConfigurationEngine.setList(
+ List.of("Sets the format for the lore of custom all EliteMobs items!",
+ "The following are valid placeholders:",
+ "$itemLevel - shows the item level",
+ "$prestigeLevel - shows the prestige level",
+ "$weaponOrArmorStats - shows the elite DPS or elite armor stats, depending on the item",
+ "$soulbindInfo - shows who, if anyone, the item is soulbound to",
+ "$itemSource - shows where the item came from, like a mob or a shop",
+ "$ifLore - makes a line only appear if the item has custom lore. Only applies for custom items",
+ "$customLore - shows the entirety of the custom lore. Only applies for custom items",
+ "$ifEnchantments - makes a line only appear if the item has any enchantments",
+ "$enchantments - shows the enchantments on the item",
+ "$eliteEnchantments - shows the elite enchantments on the item",
+ "$ifCustomEnchantments - shows the custom enchantments on the item",
+ "$customEnchantments - shows the custom enchantments on the item",
+ "$ifPotionEffects - only shows the line if the item has potion effects",
+ "$potionEffects - shows the potion effects on the item",
+ "$loreResaleValue - shows the value of the item. Might show the purchase or sell price depending on where it is viewed",
+ "Important: Several of the placeholders can be further customized by the configuration settings further below"),
+ file, fileConfiguration, "itemLoreStructureV2", new ArrayList<>(List.of(
+ ChatColorConverter.convert("&7&m&l---------&7<&lEquip Info&7>&m&l---------"),
+ ChatColorConverter.convert("&7Item level: &f$itemLevel &7Prestige &6$prestigeLevel"),
+ ChatColorConverter.convert("$weaponOrArmorStats"),
+ ChatColorConverter.convert("$soulbindInfo"),
+ ChatColorConverter.convert("$itemSource"),
+ ChatColorConverter.convert("$ifLore&7&m&l-----------&7< &f&lLore&7 >&m&l-----------"),
+ ChatColorConverter.convert("$customLore"),
+ ChatColorConverter.convert("$ifEnchantments&7&m&l--------&7<&9&lEnchantments&7>&m&l--------"),
+ ChatColorConverter.convert("$enchantments"),
+ ChatColorConverter.convert("$eliteEnchantments"),
+ ChatColorConverter.convert("$ifCustomEnchantments&7&m&l------&7< &3&lCustom Enchants&7 >&m&l------"),
+ ChatColorConverter.convert("$customEnchantments"),
+ ChatColorConverter.convert("$ifPotionEffects&7&m&l----------&7< &5&lEffects&7 >&m&l----------"),
+ ChatColorConverter.convert("$potionEffect"),
+ ChatColorConverter.convert("&7&l&m-----------------------------"),
+ ChatColorConverter.convert("$loreResaleValue")
+ )), true);
+ shopItemSource = ConfigurationEngine.setString(
+ List.of("Sets the shop source lore for store purchased"),
+ file, fileConfiguration, "shopSourceItemLores", "&7Purchased from a store", true);
+ mobItemSource = ConfigurationEngine.setString(
+ List.of("Sets the shop source lore for items looted from bosses"),
+ file, fileConfiguration, "mobSourceItemLores", "&7Looted from $mob", true);
+ loreWorth = ConfigurationEngine.setString(
+ List.of("Sets the item worth lore"),
+ file, fileConfiguration, "loreWorths", "&7Worth $worth $currencyName", true);
+ loreResale = ConfigurationEngine.setString(
+ List.of("Sets the item resale value lore"),
+ file, fileConfiguration, "loreResaleValues", "&7Sells for $resale $currencyName", true);
+ flatDropRate = ConfigurationEngine.setDouble(
+ List.of("Sets the base chance for any elite item to drop from elite mobs"),
+ fileConfiguration, "flatDropRateV3", 0.20);
+ regionalBossNonUniqueDropRate = ConfigurationEngine.setDouble(
+ List.of("Sets the base chance for any elite item to drop from regional bosses"),
+ fileConfiguration, "regionalBossNonUniqueDropRate", 0.05);
+ regionalBossesDropVanillaLoot = ConfigurationEngine.setBoolean(
+ List.of("Sets if the regional bosses can drop vanilla loot"),
+ fileConfiguration, "regionalBossesDropVanillaLoot", false);
+ levelIncreaseDropRate = ConfigurationEngine.setDouble(
+ List.of("Sets how much the chance of an elite item dropping increases based on the level of the boss.",
+ "The level of the boss is multiplied by this value and added to the base chance.",
+ "It is no longer recommended to have this above 0.0!"),
+ fileConfiguration, "levelIncreaseDropRateV2", 0.00);
+ proceduralItemWeight = ConfigurationEngine.setDouble(
+ List.of("Sets the weighed chance of a procedurally generated item dropping.",
+ "This system uses weighted probabilities! Look that up on google if you don't know what that is."),
+ fileConfiguration, "proceduralItemDropWeight", 90);
+ weighedItemWeight = ConfigurationEngine.setDouble(
+ List.of("Sets the relative chance of a weighed item dropping.",
+ "Weighed items are custom items that don't have a dynamic weight, like charms.")
+ , fileConfiguration, "weighedItemDropWeight", 1);
+ fixedItemWeight = ConfigurationEngine.setDouble(
+ List.of("Sets the relative chance of a fixed item dropping. These are custom items that do not scale."),
+ fileConfiguration, "fixedItemDropWeight", 10);
+ limitedItemWeight = ConfigurationEngine.setDouble(
+ List.of("Sets the relative chance of a limited item dropping. These are custom items that scale up to a specific level"),
+ fileConfiguration, "limitedItemDropWeight", 3);
+ scalableItemWeight = ConfigurationEngine.setDouble(
+ List.of("Sets the relative chance of a scalable item dropping. These are custom items that can scale to any level, and are the most common in the plugin."),
+ fileConfiguration, "scalableItemDropWeight", 6);
+ defaultLootMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier for the vanilla loot of the mob, based on the level of the mob."),
+ fileConfiguration, "defaultLootMultiplier", 0);
+ maxLevelForDefaultLootMultiplier = ConfigurationEngine.setInt(
+ List.of("Sets the maximum level for the default loot multiplier."),
+ fileConfiguration, "levelCapForDefaultLootMultiplier", 200);
+ defaultExperienceMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the vanilla Minecraft experience dropped multiplier for the boss, based on the level of the boss."),
+ fileConfiguration, "defaultExperienceMultiplier", 1);
+ maximumItemLevel = ConfigurationEngine.setInt(
+ List.of("Sets the level of the maximum loot that will be dropped by EliteMobs. Strongly recommended to leave it at 200."),
+ fileConfiguration, "maximumItemLevel", 200);
+ useEliteEnchantments = ConfigurationEngine.setBoolean(
+ List.of("Sets if elite enchantments will be used. ",
+ "Elite enchantments replace vanilla enchantments when elite items get enchantment levels that go beyond vanilla limits.",
+ "Example: if an elite sword is supposed to have sharpness 10, since the Minecraft limit is level 5, it will have sharpness 5 and elite sharpness 5.",
+ "Elite sharpness only affects mobs spawned by EliteMobs. This is done so PVP and vanilla combat don't become unbalanced."),
+ fileConfiguration, "useEliteEnchantments", true);
+ eliteEnchantLoreString = ConfigurationEngine.setString(
+ List.of("Sets the display name that will be used for the elite enchantments on item lore."),
+ file, fileConfiguration, "eliteEnchantmentLoreStrings", "Elite", true);
+ useHoesAsWeapons = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will see hoes as valid weapons for the damage calculations."),
+ fileConfiguration, "useHoesAsWeapons", false);
+ enableRareItemParticleEffects = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will spawn special particles over dropped items of high quality."),
+ fileConfiguration, "enableRareItemParticleEffects", true);
+ potionEffectOnHitTargetLore = ConfigurationEngine.setString(
+ List.of("Sets the symbols that will be used in item lore to show that a potion effect applies on hit to the entity that gets hit."),
+ file, fileConfiguration, "potionEffectOnHitTargetLore", "&4⚔☠", false);
+ potionEffectOnHitSelfLore = ConfigurationEngine.setString(
+ List.of("Sets the symbols that will be used in item lore to show that a potion effect applies on hit to the player doing the hitting."),
+ file, fileConfiguration, "potionEffectOnHitSelfLore", "&9⚔🛡", false);
+ potionEffectContinuousLore = ConfigurationEngine.setString(
+ List.of("Sets the symbols that will be used in item lore to show that a potion effect will keep reapplying for as long as the player wields it."),
+ file, fileConfiguration, "potionEffectContinuousLore", "&6⟲", false);
+ eliteEnchantmentColor = ConfigurationEngine.setString(
+ List.of("Sets the characters prefixed to elite enchantments in item lore."),
+ file, fileConfiguration, "eliteEnchantmentLoreColor", "&9◇", false);
+ vanillaEnchantmentColor = ConfigurationEngine.setString(
+ List.of("Sets the characters prefixed to vanilla enchantments in item lore."),
+ file, fileConfiguration, "vanillaEnchantmentLoreColor", "&7◇", false);
+ customEnchantmentColor = ConfigurationEngine.setString(
+ List.of("Sets the characters prefixed to custom enchantments in item lore."),
+ file, fileConfiguration, "customEnchantmentColor", "&3◇", false);
+ potionEffectColor = ConfigurationEngine.setString(
+ List.of("Sets the characters prefixed to potion effects in item lore."),
+ file, fileConfiguration, "potionEffectLoreColor", "&5◇", false);
+ noSoulbindLore = ConfigurationEngine.setString(
+ List.of("Sets the text that will appear on the item if the item is not soulbound."),
+ file, fileConfiguration, "noSoulbindLore", "&7Not Soulbound!", true);
+ preventEliteItemEnchantment = ConfigurationEngine.setBoolean(
+ List.of("Sets if elite item can be enchanted by vanilla means. This is not recommended as EliteMobs has its own custom enchantments system with its own balance!"),
+ fileConfiguration, "preventEliteItemEnchantment", true);
+ preventEliteItemDisenchantment = ConfigurationEngine.setBoolean(
+ List.of("Sets if elite items can be disenchanted by vanilla means."),
+ fileConfiguration, "preventEliteItemDisenchantment", true);
+ preventEliteItemDisenchantmentMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears for players when they attempt to disenchant an item and that is not allowed."),
+ file, fileConfiguration, "preventEliteItemDisenchantmentMessage", "&c[EliteMobs] Can't disenchant Elite Items!", true);
+ preventEliteItemDiamondToNetheriteUpgrade = ConfigurationEngine.setBoolean(
+ List.of("Sets whether elite items can be upgraded from diamond to netherite by vanilla means. Not recommended!"),
+ fileConfiguration, "preventEliteItemDiamondToNetheriteUpgrade", true);
+ eliteDurability = ConfigurationEngine.setBoolean(
+ List.of("Sets whether elite items will only lose durability on death.",
+ "This is an important system for EliteMobs, and it is strongly recommended as high level fights are nearly impossible without it!"),
+ fileConfiguration, "eliteItemsDurabilityLossOnlyOnDeath", true);
+ eliteDurabilityMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the durability loss multiplier for elite items if it is set to lose durability on death.",
+ "Values between 0.0 and 1.0 lower the durability loss and values above 1.0 increase it.",
+ "Example: 0.5 deals 50% of the durability loss, 2.0 deals 200% of the durability loss."),
+ fileConfiguration, "eliteItemsDurabilityLossMultiplier", 1d);
+ scrapSucceededMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when item scrapping is successful."),
+ file, fileConfiguration, "scrapSucceededMessageV2", "&8[EliteMobs] &2Scrapping succeeded $amount times!", true);
+ scrapFailedMessage = ConfigurationEngine.setString(
+ List.of("Sets message that appears when item scrapping fails."),
+ file, fileConfiguration, "scrapFailedMessageV2", "&8[EliteMobs] &cScrapping failed $amount times!", true);
+ putLootDirectlyIntoPlayerInventory = ConfigurationEngine.setBoolean(
+ List.of("Sets if elite loot should be placed directly into players' inventories."),
+ fileConfiguration, "putLootDirectlyIntoPlayerInventory", false);
+ lootLevelDifferenceLockout = ConfigurationEngine.setInt(
+ List.of("Sets maximum level difference players can have before they can no longer loot items that are too low level.",
+ "This is calculated based on the average level of the loot the player is wearing.",
+ "As an example, if it is set to 10 and a player has level 50 gear, they will not be able to farm level 39 bosses."),
+ fileConfiguration, "lootLevelDifferenceLockout", 10);
+ preventEliteItemsFromBreaking = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will prevent Elite Items from breaking when using the durability loss on death system.",
+ "Players will not be able to use items with no durability left anyway, this is simply to prevent the accidental loss of high level but low durability items."),
+ fileConfiguration, "preventEliteItemsFromBreaking", true);
+ noItemDurabilityMessage = ConfigurationEngine.setString(
+ List.of("Sets the characters prefixed to vanilla enchantments in item lore."),
+ file, fileConfiguration, "noItemDurabilityMessage", "&8[EliteMobs] $item &4is broken! It won't work until repaired!", true);
+ minimumProcedurallyGeneratedDiamondLootLevelPlusSeven = ConfigurationEngine.setInt(
+ List.of("Sets the minimum level, +7, of bosses that can procedurally generated drop diamond gear in EliteMobs.",
+ "There is no procedurally generated netherite gear in EliteMobs, only custom loot."),
+ fileConfiguration, "minimumProcedurallyGeneratedDiamondLootLevelPlusSeven", 10);
+ simlootMessageSuccess = ConfigurationEngine.setString(
+ List.of("Sets the message show in chat when successfully rolling for loot through the /em simloot command."),
+ file, fileConfiguration, "simlootMessageSuccess", "&8[EliteMobs] &2Rolled for loot and got $itemName &2!", true);
+ simlootMessageFailure = ConfigurationEngine.setString(
+ List.of("Sets the message show in chat when failing to roll for loot through the /em simloot command."),
+ file, fileConfiguration, "simlootMessageFailure", "&8[EliteMobs] &cRolled for loot and got nothing!", true);
+ directDropCustomLootMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that players get when elite loot is deposited directly into their inventories."),
+ file, fileConfiguration, "directDropCustomLootMessage", "&8[EliteMobs] &2Obtained $itemName &2!", true);
+ directDropMinecraftLootMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that players get when vanilla loot is deposited directly into their inventories."),
+ file, fileConfiguration, "directDropMinecraftLootMessage", "&8[EliteMobs] &aObtained $itemName &a!", true);
+ directDropCoinMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that players get when elite coins are deposited directly into their inventories."),
+ file, fileConfiguration, "directDropCoinMessage", "&8[EliteMobs] &aObtained &2$amount $currencyName &a!", true);
+ hideAttributes = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will hide vanilla Minecraft attributes."),
+ fileConfiguration, "hideItemAttributes", true);
+ weaponEntry = ConfigurationEngine.setString(
+ List.of("Sets the weapon-specific lore entry on an elite item. The $EDPS placeholder gets replaced with the elite DPS (damage per second) of the weapon."),
+ file, fileConfiguration, "weaponEntry", "&7Elite DPS: &2$EDPS", true);
+ armorEntry = ConfigurationEngine.setString(
+ List.of("Sets the armor-specific lore entry on an elite item. The $EDEF placeholder gets replaced with the elite DEF (defense) of the weapon."),
+ file, fileConfiguration, "armorEntry", "&7Elite Armor: &2$EDEF", true);
+ levelRangeTooDifferent = ConfigurationEngine.setString(
+ List.of("Sets the message sent when a played kills a boss but the gear level is too different from the boss level to get coins"),
+ file, fileConfiguration, "levelRangeTooDifferent", "&8EM] &4Your gear is level $playerLevel and the boss is level $bossLevel, level difference is too high to get coins!", true);
+
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemsCustomLootListConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemsCustomLootListConfig.java
deleted file mode 100644
index e88e15dad..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ItemsCustomLootListConfig.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.MetadataHandler;
-import org.bukkit.Bukkit;
-
-import java.io.File;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-public class ItemsCustomLootListConfig {
-
- public static final String CONFIG_NAME = "ItemsCustomLootList.yml";
-
- public void intializeConfig() {
-
- Bukkit.getLogger().info(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDataFolder().getAbsolutePath() + "/data/" + CONFIG_NAME);
-
- File file = new File(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS).getDataFolder().getAbsolutePath() + "/data/" + CONFIG_NAME);
-
- if (!file.exists()) {
-
- CustomConfigConstructor customConfigConstructor = new CustomConfigConstructor(CONFIG_NAME, CONFIG_NAME);
-
- }
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemsCustomLootSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemsCustomLootSettingsConfig.java
deleted file mode 100644
index 194a00bdb..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ItemsCustomLootSettingsConfig.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import org.bukkit.configuration.Configuration;
-
-import java.util.Arrays;
-
-public class ItemsCustomLootSettingsConfig {
-
- public static final String CONFIG_NAME = "ItemsCustomLootSettings.yml";
- public static final String MMORPG_COLORS_FOR_CUSTOM_ITEMS = "Use MMORPG colors for custom items";
-// public static final String SHOW_POTION_EFFECTS = "Show potion effects on lore";
- public static final String SHOW_ITEM_VALUE = "Show item value on lore";
- public static final String SHOW_ITEM_TIER = "Show item tier on lore";
- public static final String LORE_STRUCTURE = "Lore Structure";
- public static final String PREVENT_CUSTOM_ITEM_PLACING = "Prevent players from placing pleaceable Elite custom items";
- public static final String DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX = "Default potion effect duration (seconds, on hit).";
- public static final String ABSORPTION = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "ABSORPTION";
- public static final String BLINDNESS = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "BLINDNESS";
- public static final String CONFUSION = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "CONFUSION";
- public static final String DAMAGE_RESISTANCE = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "DAMAGE_RESISTANCE";
- public static final String FAST_DIGGING = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "FAST_DIGGING";
- public static final String FIRE_RESISTANCE = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "FIRE_RESISTANCE";
- public static final String GLOWING = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "GLOWING";
- public static final String HEALTH_BOOST = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "HEALTH_BOOST";
- public static final String HUNGER = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "HUNGER";
- public static final String INCREASE_DAMAGE = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "INCREASE_DAMAGE";
- public static final String INVISIBILITY = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "INVISIBILITY";
- public static final String JUMP = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "LEVITATION";
- public static final String LUCK = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "LUCK";
- public static final String NIGHT_VISION = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "NIGHT_VISION";
- public static final String POISON = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "POISON";
- public static final String REGENERATION = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "REGENERATION";
- public static final String SLOW = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "SLOW";
- public static final String SLOW_DIGGING = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "SLOW_DIGGING";
- public static final String SPEED = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "SPEED";
- public static final String UNLUCK = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "UNLUCK";
- public static final String WATER_BREATHING = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "WATER_BREATHING";
- public static final String WEAKNESS = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "WEAKNESS";
- public static final String WITHER = DEFAULT_POTION_EFFECT_DURATION_NODE_PREFIX + "WITHER";
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void initializeConfig() {
-
- configuration.addDefault(MMORPG_COLORS_FOR_CUSTOM_ITEMS, true);
-// configuration.addDefault(SHOW_POTION_EFFECTS, true);
- configuration.addDefault(SHOW_ITEM_VALUE, true);
- configuration.addDefault(SHOW_ITEM_TIER, true);
- configuration.addDefault(PREVENT_CUSTOM_ITEM_PLACING, true);
- configuration.addDefault(LORE_STRUCTURE, Arrays.asList(
- ChatColorConverter.convert("$enchantments"),
- ChatColorConverter.convert("$potionEffect"),
- ChatColorConverter.convert("&m----------------------"),
- ChatColorConverter.convert(" $customLore "),
- ChatColorConverter.convert(" $itemValue "),
- ChatColorConverter.convert("&m----------------------"),
- ChatColorConverter.convert(" Tier $tier ")
- ));
- configuration.addDefault(ABSORPTION, 2);
- configuration.addDefault(BLINDNESS, 5);
- configuration.addDefault(CONFUSION, 10);
- configuration.addDefault(DAMAGE_RESISTANCE, 30);
- configuration.addDefault(FAST_DIGGING, 30);
- configuration.addDefault(FIRE_RESISTANCE, 15);
- configuration.addDefault(GLOWING, 60);
- configuration.addDefault(HEALTH_BOOST, 90);
- configuration.addDefault(HUNGER, 30);
- configuration.addDefault(INCREASE_DAMAGE, 30);
- configuration.addDefault(INVISIBILITY, 3);
- configuration.addDefault(JUMP, 10);
- configuration.addDefault(LUCK, 5);
- configuration.addDefault(NIGHT_VISION, 30);
- configuration.addDefault(POISON, 20);
- configuration.addDefault(REGENERATION, 20);
- configuration.addDefault(SLOW, 15);
- configuration.addDefault(SLOW_DIGGING, 10);
- configuration.addDefault(SPEED, 30);
- configuration.addDefault(UNLUCK, 30);
- configuration.addDefault(WATER_BREATHING, 30);
- configuration.addDefault(WEAKNESS, 15);
- configuration.addDefault(WITHER, 15);
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemsDropSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemsDropSettingsConfig.java
deleted file mode 100644
index 2c389bf5c..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ItemsDropSettingsConfig.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.items.customenchantments.CustomEnchantmentCache;
-import org.bukkit.configuration.Configuration;
-
-public class ItemsDropSettingsConfig {
-
- public static final String CONFIG_NAME = "ItemsDropSettings.yml";
-
- public static final String ENABLE_PLUGIN_LOOT = "Enable plugin loot";
- public static final String DROP_CUSTOM_ITEMS = "Elite Mobs can drop custom loot";
- public static final String LORE_WORTH = "Item worth";
- public static final String LORE_RESALE_WORTH = "Item resale worth";
- public static final String ELITE_ITEM_FLAT_DROP_RATE = "EliteMob base percentual plugin item drop chance";
- public static final String ELITE_ITEM_TIER_DROP_RATE = "EliteMob plugin item percentual drop chance increase per tier";
- public static final String PROCEDURAL_ITEM_WEIGHT = "Procedurally generated item weight";
- public static final String CUSTOM_ITEM_WEIGHT = "Custom item weight";
- public static final String CUSTOM_DYNAMIC_ITEM_WEIGHT = "Custom dynamic item weight";
- public static final String CUSTOM_STATIC_ITEM_WEIGHT = "Custom static item weight";
- public static final String SPAWNER_DEFAULT_LOOT_MULTIPLIER = "Drop multiplied default loot from elite mobs spawned in spawners";
- public static final String DEFAULT_LOOT_MULTIPLIER = "EliteMob default loot multiplier";
- public static final String MAXIMUM_LEVEL_FOR_LOOT_MULTIPLIER = "Maximum level of the Elite Mob default multiplier";
- public static final String EXPERIENCE_LOOT_MULTIPLIER = "EliteMob xp multiplier";
- public static final String MAXIMUM_LOOT_TIER = "Maximum loot tier (REQUIRES INCREASING SHARPNESS AND PROTECTION ENCHANTMENTS TO WORK PROPERLY, READ GITHUB WIKI!)";
- public static final String ENABLE_CUSTOM_ENCHANTMENT_SYSTEM = "Enable custom echantment system (check the github wiki before changing)";
- public static final String ENCHANTMENT_NAME = "Enchantment name.";
- public static final String ARROW_DAMAGE_NAME = ENCHANTMENT_NAME +"ARROW_DAMAGE";
- public static final String ARROW_FIRE_NAME = ENCHANTMENT_NAME + "ARROW_FIRE";
- public static final String ARROW_INFINITE_NAME = ENCHANTMENT_NAME + "ARROW_INFINITE";
- public static final String ARROW_KNOCKBACK_NAME = ENCHANTMENT_NAME + "ARROW_KNOCKBACK";
- public static final String BINDING_CURSE_NAME = ENCHANTMENT_NAME + "BINDING_CURSE";
- public static final String CHANNELING_NAME = ENCHANTMENT_NAME + "CHANNELING";
- public static final String DAMAGE_ALL_NAME = ENCHANTMENT_NAME + "DAMAGE_ALL";
- public static final String DAMAGE_ARTHROPODS_NAME = ENCHANTMENT_NAME + "DAMAGE_ARTHROPODS";
- public static final String DAMAGE_UNDEAD_NAME = ENCHANTMENT_NAME + "DAMAGE_UNDEAD";
- public static final String DEPTH_STRIDER_NAME = ENCHANTMENT_NAME + "DEPTH_STRIDER";
- public static final String DIG_SPEED_NAME = ENCHANTMENT_NAME + "DIG_SPEED";
- public static final String DURABILITY_NAME = ENCHANTMENT_NAME + "DURABILITY";
- public static final String FIRE_ASPECT_NAME = ENCHANTMENT_NAME + "FIRE_ASPECT";
- public static final String FROST_WALKER_NAME = ENCHANTMENT_NAME + "FROST_WALKER";
- public static final String IMPALING_NAME = ENCHANTMENT_NAME + "IMPALING";
- public static final String KNOCKBACK_NAME = ENCHANTMENT_NAME + "KNOCKBACK";
- public static final String LOOT_BONUS_BLOCKS_NAME = ENCHANTMENT_NAME + "LOOT_BONUS_BLOCKS";
- public static final String LOOT_BONUS_MOBS_NAME = ENCHANTMENT_NAME + "LOOT_BONUS_MOBS";
- public static final String LOYALTY_NAME = ENCHANTMENT_NAME + "LOYALTY";
- public static final String LUCK_ENCHANTMENT_NAME = ENCHANTMENT_NAME + "LUCK";
- public static final String LURE_NAME = ENCHANTMENT_NAME + "LURE";
- public static final String MENDING_NAME = ENCHANTMENT_NAME + "MENDING";
- public static final String OXYGEN_NAME = ENCHANTMENT_NAME + "OXYGEN";
- public static final String PROTECTION_ENVIRONMENTAL_NAME = ENCHANTMENT_NAME + "PROTECTION_ENVIRONMENTAL";
- public static final String PROTECTION_EXPLOSIONS_NAME = ENCHANTMENT_NAME + "PROTECTION_EXPLOSIONS";
- public static final String PROTECTION_FALL_NAME = ENCHANTMENT_NAME + "PROTECTION_FALL";
- public static final String PROTECTION_FIRE_NAME = ENCHANTMENT_NAME + "PROTECTION_FIRE";
- public static final String PROTECTION_PROJECTILE_NAME = ENCHANTMENT_NAME + "PROTECTION_PROJECTILE";
- public static final String RIPTIDE_NAME = ENCHANTMENT_NAME + "RIPTIDE";
- public static final String SILK_TOUCH_NAME = ENCHANTMENT_NAME + "SILK_TOUCH";
- public static final String SWEEPING_EDGE_NAME = ENCHANTMENT_NAME + "SWEEPING_EDGE";
- public static final String THORNS_NAME = ENCHANTMENT_NAME + "THORNS";
- public static final String VANISHING_CURSE_NAME = ENCHANTMENT_NAME + "VANISHING_CURSE";
- public static final String WATER_WORKER_NAME = ENCHANTMENT_NAME + "WATER_WORKER";
- public static final String POTION_EFFECT_NAME = "Potion effect name.";
- public static final String ABSORPTION_NAME = POTION_EFFECT_NAME + "ABSORPTION";
- public static final String BLINDNESS_NAME = POTION_EFFECT_NAME + "BLINDNESS";
- public static final String CONDUIT_POWER_NAME = POTION_EFFECT_NAME + "CONDUIT_POWER";
- public static final String CONFUSION_NAME = POTION_EFFECT_NAME + "CONFUSION";
- public static final String DAMAGE_RESISTANCE_NAME = POTION_EFFECT_NAME + "DAMAGE_RESISTANCE";
- public static final String DOLPHINS_GRACE_NAME = POTION_EFFECT_NAME + "DOLPHINS_GRACE";
- public static final String FAST_DIGGING_NAME = POTION_EFFECT_NAME + "FAST_DIGGING";
- public static final String FIRE_RESISTANCE_NAME = POTION_EFFECT_NAME + "FIRE_RESISTANCE";
- public static final String GLOWING_NAME = POTION_EFFECT_NAME + "GLOWING";
- public static final String HARM_NAME = POTION_EFFECT_NAME + "HARM";
- public static final String HEAL_NAME = POTION_EFFECT_NAME + "HEAL";
- public static final String HEAL_BOOST_NAME = POTION_EFFECT_NAME + "HEAL_BOOST";
- public static final String HUNGER_NAME = POTION_EFFECT_NAME + "HUNGER";
- public static final String INCREASE_DAMAGE_NAME = POTION_EFFECT_NAME + "INCREASE_DAMAGE";
- public static final String INVISIBILITY_NAME = POTION_EFFECT_NAME + "INVISIBILITY";
- public static final String JUMP_NAME = POTION_EFFECT_NAME + "JUMP";
- public static final String LEVITATION_NAME = POTION_EFFECT_NAME + "LEVITATION";
- public static final String LUCK_POTION_NAME = POTION_EFFECT_NAME + "LUCK";
- public static final String NIGHT_VISION_NAME = POTION_EFFECT_NAME + "NIGHT_VISION";
- public static final String POISON_NAME = POTION_EFFECT_NAME + "POISON";
- public static final String REGENERATION_NAME = POTION_EFFECT_NAME + "REGENERATION";
- public static final String SATURATION_NAME = POTION_EFFECT_NAME + "SATURATION";
- public static final String SLOW_NAME = POTION_EFFECT_NAME + "SLOW";
- public static final String SLOW_DIGGING_NAME = POTION_EFFECT_NAME + "SLOW_DIGGING";
- public static final String SLOW_FALLING_NAME = POTION_EFFECT_NAME + "SLOW_FALLING";
- public static final String SPEED_NAME = POTION_EFFECT_NAME + "SPEED";
- public static final String UNLUCK_NAME = POTION_EFFECT_NAME + "UNLUCK";
- public static final String WATER_BREATHING_NAME = POTION_EFFECT_NAME + "WATER_BREATHING";
- public static final String WEAKNESS_NAME = POTION_EFFECT_NAME + "WEAKNESS";
- public static final String WITHER_NAME = POTION_EFFECT_NAME + "WITHER";
- public static final String ENABLE_RARE_DROP_EFFECT = "Enable rare drop visual effect";
-
- /*
- Custom enchantments
- */
- public static final String FLAMETHROWER_NAME = ENCHANTMENT_NAME + CustomEnchantmentCache.flamethrowerEnchantment.getKey();
- public static final String HUNTER_NAME = ENCHANTMENT_NAME + CustomEnchantmentCache.hunterEnchantment.getKey();
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void initializeConfig() {
-
- configuration.addDefault(ENABLE_PLUGIN_LOOT, true);
- configuration.addDefault(DROP_CUSTOM_ITEMS, true);
- configuration.addDefault(LORE_WORTH, "Worth $worth $currencyName");
- configuration.addDefault(LORE_RESALE_WORTH, "$resale $currencyName resale value");
- configuration.addDefault(ELITE_ITEM_FLAT_DROP_RATE, 025.00);
- configuration.addDefault(ELITE_ITEM_TIER_DROP_RATE, 005.00);
- configuration.addDefault(PROCEDURAL_ITEM_WEIGHT, 90);
- configuration.addDefault(CUSTOM_ITEM_WEIGHT, 10);
- configuration.addDefault(CUSTOM_DYNAMIC_ITEM_WEIGHT, 9);
- configuration.addDefault(CUSTOM_STATIC_ITEM_WEIGHT, 1);
- configuration.addDefault(SPAWNER_DEFAULT_LOOT_MULTIPLIER, true);
- configuration.addDefault(DEFAULT_LOOT_MULTIPLIER, 1.0);
- configuration.addDefault(MAXIMUM_LEVEL_FOR_LOOT_MULTIPLIER, 200);
- configuration.addDefault(EXPERIENCE_LOOT_MULTIPLIER, 1.0);
- configuration.addDefault(MAXIMUM_LOOT_TIER, 5);
- configuration.addDefault(ENABLE_CUSTOM_ENCHANTMENT_SYSTEM, true);
- configuration.addDefault(ARROW_DAMAGE_NAME, "Power");
- configuration.addDefault(ARROW_FIRE_NAME, "Flame");
- configuration.addDefault(ARROW_INFINITE_NAME, "Infinity");
- configuration.addDefault(ARROW_KNOCKBACK_NAME, "Punch");
- configuration.addDefault(BINDING_CURSE_NAME, "Curse of Binding");
- configuration.addDefault(CHANNELING_NAME, "Channeling");
- configuration.addDefault(DAMAGE_ALL_NAME, "Sharpness");
- configuration.addDefault(DAMAGE_ARTHROPODS_NAME, "Bane of Arthropods");
- configuration.addDefault(DAMAGE_UNDEAD_NAME, "Smite");
- configuration.addDefault(DEPTH_STRIDER_NAME, "Depth Strider");
- configuration.addDefault(DIG_SPEED_NAME, "Efficiency");
- configuration.addDefault(DURABILITY_NAME, "Unbreaking");
- configuration.addDefault(FIRE_ASPECT_NAME, "Fire Aspect");
- configuration.addDefault(FROST_WALKER_NAME, "Frost Walker");
- configuration.addDefault(IMPALING_NAME, "Impaling");
- configuration.addDefault(KNOCKBACK_NAME, "Knockback");
- configuration.addDefault(LOOT_BONUS_BLOCKS_NAME, "Fortune");
- configuration.addDefault(LOOT_BONUS_MOBS_NAME, "Looting");
- configuration.addDefault(LOYALTY_NAME, "Loyalty");
- configuration.addDefault(LUCK_ENCHANTMENT_NAME, "Luck of the Sea");
- configuration.addDefault(LURE_NAME, "Lure");
- configuration.addDefault(MENDING_NAME, "Mending");
- configuration.addDefault(OXYGEN_NAME, "Respiration");
- configuration.addDefault(PROTECTION_ENVIRONMENTAL_NAME, "Protection");
- configuration.addDefault(PROTECTION_EXPLOSIONS_NAME, "Blast Protection");
- configuration.addDefault(PROTECTION_FALL_NAME, "Feather Falling");
- configuration.addDefault(PROTECTION_FIRE_NAME, "Fire Protection");
- configuration.addDefault(PROTECTION_PROJECTILE_NAME, "Projectile Protection");
- configuration.addDefault(RIPTIDE_NAME, "Riptide");
- configuration.addDefault(SILK_TOUCH_NAME, "Silk Touch");
- configuration.addDefault(SWEEPING_EDGE_NAME, "Sweeping Edge");
- configuration.addDefault(THORNS_NAME, "Thorns");
- configuration.addDefault(VANISHING_CURSE_NAME, "Curse of Vanishing");
- configuration.addDefault(WATER_WORKER_NAME, "Aqua Affinity");
- configuration.addDefault(ABSORPTION_NAME, "Absorption");
- configuration.addDefault(BLINDNESS_NAME, "Blindness");
- configuration.addDefault(CONDUIT_POWER_NAME, "Conduit Power");
- configuration.addDefault(CONFUSION_NAME, "Nausea");
- configuration.addDefault(DAMAGE_RESISTANCE_NAME, "Resistance");
- configuration.addDefault(DOLPHINS_GRACE_NAME, "Dolphin's grace");
- configuration.addDefault(FAST_DIGGING_NAME, "Haste");
- configuration.addDefault(FIRE_RESISTANCE_NAME, "Fire Resistance");
- configuration.addDefault(GLOWING_NAME, "Glowing");
- configuration.addDefault(HARM_NAME, "Instant Damage");
- configuration.addDefault(HEAL_NAME, "Instant Health");
- configuration.addDefault(HEAL_BOOST_NAME, "Health Boost");
- configuration.addDefault(HUNGER_NAME, "Hunger");
- configuration.addDefault(INCREASE_DAMAGE_NAME, "Strength");
- configuration.addDefault(INVISIBILITY_NAME, "Invisibility");
- configuration.addDefault(JUMP_NAME, "Jump Boost");
- configuration.addDefault(LEVITATION_NAME, "Levitation");
- configuration.addDefault(LUCK_POTION_NAME, "Luck");
- configuration.addDefault(NIGHT_VISION_NAME, "Night Vision");
- configuration.addDefault(POISON_NAME, "Poison");
- configuration.addDefault(REGENERATION_NAME, "Regeneration");
- configuration.addDefault(SATURATION_NAME, "Saturation");
- configuration.addDefault(SLOW_NAME, "Slowness");
- configuration.addDefault(SLOW_DIGGING_NAME, "Mining Fatigue");
- configuration.addDefault(SLOW_FALLING_NAME, "Slow Falling");
- configuration.addDefault(SPEED_NAME, "Speed");
- configuration.addDefault(UNLUCK_NAME, "Bad Luck");
- configuration.addDefault(WATER_BREATHING_NAME, "Water Breathing");
- configuration.addDefault(WEAKNESS_NAME, "Weakness");
- configuration.addDefault(WITHER_NAME, "Wither");
- configuration.addDefault(FLAMETHROWER_NAME, "Flamethrower");
- configuration.addDefault(HUNTER_NAME, "Hunter");
- configuration.addDefault(ENABLE_RARE_DROP_EFFECT, true);
-
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemsProceduralSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemsProceduralSettingsConfig.java
deleted file mode 100644
index e255dda69..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ItemsProceduralSettingsConfig.java
+++ /dev/null
@@ -1,1591 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.ChatColorConverter;
-import org.bukkit.configuration.Configuration;
-
-import java.util.Arrays;
-
-/**
- * Created by MagmaGuy on 04/06/2017.
- */
-public class ItemsProceduralSettingsConfig {
-
- public static final String CONFIG_NAME = "ItemsProceduralSettings.yml";
- public static final String LORE_MOB_LEVEL_SOURCE = "Item source (mob)";
- public static final String LORE_SHOP_SOURCE = "Item source (shop)";
- public static final String LORE_STRUCTURE = "Lore structure";
- public static final String DROP_ITEMS_ON_DEATH = "Drop procedurally generated items on Elite Mob death";
- public static final String MONITOR_ITEMS_ON_CONSOLE = "Monitor procedurally generated items on console";
- public static final String PROCEDURAL_ITEM_VALID_MATERIALS = "Valid material list for random items";
- public static String ARROW_DAMAGE_BOOL, ARROW_DAMAGE_MAX_LEVEL,
- ARROW_FIRE_BOOL, ARROW_FIRE_MAX_LEVEL,
- ARROW_INFINITE_BOOL,
- ARROW_KNOCKBACK_BOOL, ARROW_KNOCKBACK_MAX_LEVEL,
- BINDING_CURSE_BOOL,
- DAMAGE_ALL_BOOL, DAMAGE_ALL_MAX_LEVEL,
- DAMAGE_ARTHROPODS_BOOL, DAMAGE_ARTHROPODS_MAX_LEVEL,
- DAMAGE_UNDEAD_BOOL, DAMAGE_UNDEAD_MAX_LEVEL,
- DEPTH_STRIDER_BOOL, DEPTH_STRIDER_MAX_LEVEL,
- DIG_SPEED_BOOL, DIG_SPEED_MAX_LEVEL,
- DURABILITY_BOOL, DURABILITY_MAX_LEVEL,
- FIRE_ASPECT_BOOL, FIRE_ASPECT_MAX_LEVEL,
- FROST_WALKER_BOOL, FROST_WALKER_MAX_LEVEL,
- KNOCKBACK_BOOL, KNOCKBACK_MAX_LEVEL,
- LOOT_BONUS_BLOCKS_BOOL, LOOT_BONUS_BLOCKS_MAX_LEVEL,
- LOOT_BONUS_MOBS_BOOL, LOOT_BONUS_MOBS_MAX_LEVEL,
- LUCK_BOOL, LUCK_MAX_LEVEL,
- LURE_BOOL, LURE_MAX_LEVEL,
- MENDING_BOOL,
- OXYGEN_BOOL, OXYGEN_MAX_LEVEL,
- PROTECTION_ENVIRONMENTAL_BOOL, PROTECTION_ENVIRONMENTAL_MAX_LEVEL,
- PROTECTION_EXPLOSIONS_BOOL, PROTECTION_EXPLOSIONS_MAX_LEVEL,
- PROTECTION_FALL_BOOL, PROTECTION_FALL_MAX_LEVEL,
- PROTECTION_FIRE_BOOL, PROTECTION_FIRE_MAX_LEVEL,
- PROTECTION_PROJECTILE_BOOL, PROTECTION_PROJECTILE_MAX_LEVEL,
- SILK_TOUCH_BOOL,
- SWEEPING_EDGE_BOOL, SWEEPING_EDGE_MAX_LEVEL,
- THORNS_BOOL, THORNS_MAX_LEVEL,
- VANISHING_CURSE_BOOL,
- WATER_WORKER_BOOL, WATER_WORKER_MAX_LEVEL;
- public static String HUNTER_BOOL, HUNTER_MAX_LEVEL;
- public static final String ITEM_NAME_FORMAT = "Procedurally generated item name format";
- private static final String MATERIAL_NAME = "Material name.";
- public static final String SWORD_MATERIAL_NAME = MATERIAL_NAME + "Sword";
- public static final String BOW_MATERIAL_NAME = MATERIAL_NAME + "Bow";
- public static final String PICKAXE_MATERIAL_NAME = MATERIAL_NAME + "Pickaxe";
- public static final String SPADE_MATERIAL_NAME = MATERIAL_NAME + "Spade";
- public static final String HOE_MATERIAL_NAME = MATERIAL_NAME + "Hoe";
- public static final String AXE_MATERIAL_NAME = MATERIAL_NAME + "Axe";
- public static final String HELMET_MATERIAL_NAME = MATERIAL_NAME + "Helmet";
- public static final String CHESTPLATE_MATERIAL_NAME = MATERIAL_NAME + "Chestplate";
- public static final String LEGGINGS_MATERIAL_NAME = MATERIAL_NAME + "Leggings";
- public static final String BOOTS_MATERIAL_NAME = MATERIAL_NAME + "Boots";
- public static final String SHEARS_MATERIAL_NAME = MATERIAL_NAME + "Shears";
- public static final String FISHING_ROD_MATERIAL_NAME = MATERIAL_NAME + "Fishing Rod";
- public static final String SHIELD_MATERIAL_NAME = MATERIAL_NAME + "Shield";
- public static final String CUSTOM_ENCHANTMENT_CHANCE = "Chance of getting a custom enchantment";
-
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- public Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void intializeConfig() {
-
- configuration.addDefault(DROP_ITEMS_ON_DEATH, true);
- configuration.addDefault(MONITOR_ITEMS_ON_CONSOLE, false);
- configuration.addDefault(LORE_MOB_LEVEL_SOURCE, "Looted from a level $level Elite $mob");
- configuration.addDefault(LORE_SHOP_SOURCE, "Purchased from a store");
- configuration.addDefault(LORE_STRUCTURE, Arrays.asList(
- ChatColorConverter.convert("$enchantments"),
- ChatColorConverter.convert("$potionEffects"),
- ChatColorConverter.convert("&m----------------------"),
- ChatColorConverter.convert("$itemSource"),
- ChatColorConverter.convert( "$itemValue"),
- ChatColorConverter.convert("Elite Mobs drop"),
- ChatColorConverter.convert("&m----------------------"),
- ChatColorConverter.convert("Tier $tier")
- ));
- configuration.addDefault(PROCEDURAL_ITEM_VALID_MATERIALS, Arrays.asList(
- "DIAMOND_SWORD",
- "GOLD_SWORD",
- "IRON_SWORD",
- "STONE_SWORD",
- "WOOD_SWORD",
- "BOW",
- "DIAMOND_PICKAXE",
- "GOLD_PICKAXE",
- "IRON_PICKAXE",
- "STONE_PICKAXE",
- "WOOD_PICKAXE",
- "DIAMOND_SPADE",
- "GOLD_SPADE",
- "IRON_SPADE",
- "STONE_SPADE",
- "WOOD_SPADE",
- "DIAMOND_HOE",
- "GOLD_HOE",
- "IRON_HOE",
- "STONE_HOE",
- "WOOD_HOE",
- "DIAMOND_AXE",
- "GOLD_AXE",
- "IRON_AXE",
- "STONE_AXE",
- "WOOD_AXE",
- "SHEARS",
- "SHIELD",
- "FISHING_ROD",
- "CHAINMAIL_HELMET",
- "DIAMOND_HELMET",
- "GOLD_HELMET",
- "IRON_HELMET",
- "LEATHER_HELMET",
- "CHAINMAIL_CHESTPLATE",
- "DIAMOND_CHESTPLATE",
- "GOLD_CHESTPLATE",
- "IRON_CHESTPLATE",
- "LEATHER_CHESTPLATE",
- "CHAINMAIL_LEGGINGS",
- "DIAMOND_LEGGINGS",
- "GOLD_LEGGINGS",
- "IRON_LEGGINGS",
- "LEATHER_LEGGINGS",
- "CHAINMAIL_BOOTS",
- "DIAMOND_BOOTS",
- "GOLD_BOOTS",
- "IRON_BOOTS",
- "LEATHER_BOOTS"
- ));
-
- ARROW_DAMAGE_BOOL = boolValidEnchantmentConstructor("ARROW_DAMAGE");
- ARROW_DAMAGE_MAX_LEVEL = maxLevelValidEnchantmentConstructor("ARROW_DAMAGE");
-
- ARROW_FIRE_BOOL = boolValidEnchantmentConstructor("ARROW_FIRE");
- ARROW_FIRE_MAX_LEVEL = maxLevelValidEnchantmentConstructor("ARROW_FIRE");
-
- ARROW_INFINITE_BOOL = boolValidEnchantmentConstructor("ARROW_INFINITE");
-
- ARROW_KNOCKBACK_BOOL = boolValidEnchantmentConstructor("ARROW_KNOCKBACK");
- ARROW_KNOCKBACK_MAX_LEVEL = maxLevelValidEnchantmentConstructor("ARROW_KNOCKBACK");
-
- BINDING_CURSE_BOOL = boolValidEnchantmentConstructor("BINDING_CURSE");
-
- DAMAGE_ALL_BOOL = boolValidEnchantmentConstructor("DAMAGE_ALL");
- DAMAGE_ALL_MAX_LEVEL = maxLevelValidEnchantmentConstructor("DAMAGE_ALL");
-
- DAMAGE_ARTHROPODS_BOOL = boolValidEnchantmentConstructor("DAMAGE_ARTHROPODS");
- DAMAGE_ARTHROPODS_MAX_LEVEL = maxLevelValidEnchantmentConstructor("DAMAGE_ARTHROPODS");
-
- DAMAGE_UNDEAD_BOOL = boolValidEnchantmentConstructor("DAMAGE_UNDEAD");
- DAMAGE_UNDEAD_MAX_LEVEL = maxLevelValidEnchantmentConstructor("DAMAGE_UNDEAD");
-
- DEPTH_STRIDER_BOOL = boolValidEnchantmentConstructor("DEPTH_STRIDER");
- DEPTH_STRIDER_MAX_LEVEL = maxLevelValidEnchantmentConstructor("DEPTH_STRIDER");
-
- DIG_SPEED_BOOL = boolValidEnchantmentConstructor("DIG_SPEED");
- DIG_SPEED_MAX_LEVEL = maxLevelValidEnchantmentConstructor("DIG_SPEED");
-
- DURABILITY_BOOL = boolValidEnchantmentConstructor("DURABILITY");
- DURABILITY_MAX_LEVEL = maxLevelValidEnchantmentConstructor("DURABILITY");
-
- FIRE_ASPECT_BOOL = boolValidEnchantmentConstructor("FIRE_ASPECT");
- FIRE_ASPECT_MAX_LEVEL = maxLevelValidEnchantmentConstructor("FIRE_ASPECT");
-
- FROST_WALKER_BOOL = boolValidEnchantmentConstructor("FROST_WALKER");
- FROST_WALKER_MAX_LEVEL = maxLevelValidEnchantmentConstructor("FROST_WALKER");
-
- KNOCKBACK_BOOL = boolValidEnchantmentConstructor("KNOCKBACK");
- KNOCKBACK_MAX_LEVEL = maxLevelValidEnchantmentConstructor("KNOCKBACK");
-
- LOOT_BONUS_BLOCKS_BOOL = boolValidEnchantmentConstructor("LOOT_BONUS_BLOCKS");
- LOOT_BONUS_BLOCKS_MAX_LEVEL = maxLevelValidEnchantmentConstructor("LOOT_BONUS_BLOCKS");
-
- LOOT_BONUS_MOBS_BOOL = boolValidEnchantmentConstructor("LOOT_BONUS_MOBS");
- LOOT_BONUS_MOBS_MAX_LEVEL = maxLevelValidEnchantmentConstructor("LOOT_BONUS_MOBS");
-
- LUCK_BOOL = boolValidEnchantmentConstructor("LUCK");
- LUCK_MAX_LEVEL = maxLevelValidEnchantmentConstructor("LUCK");
-
- LURE_BOOL = boolValidEnchantmentConstructor("LURE");
- LURE_MAX_LEVEL = maxLevelValidEnchantmentConstructor("LURE");
-
- MENDING_BOOL = boolValidEnchantmentConstructor("MENDING");
-
- OXYGEN_BOOL = boolValidEnchantmentConstructor("OXYGEN");
- OXYGEN_MAX_LEVEL = maxLevelValidEnchantmentConstructor("OXYGEN");
-
- PROTECTION_ENVIRONMENTAL_BOOL = boolValidEnchantmentConstructor("PROTECTION_ENVIRONMENTAL");
- PROTECTION_ENVIRONMENTAL_MAX_LEVEL = maxLevelValidEnchantmentConstructor("PROTECTION_ENVIRONMENTAL");
-
- PROTECTION_EXPLOSIONS_BOOL = boolValidEnchantmentConstructor("PROTECTION_EXPLOSIONS");
- PROTECTION_EXPLOSIONS_MAX_LEVEL = maxLevelValidEnchantmentConstructor("PROTECTION_EXPLOSIONS");
-
- PROTECTION_FALL_BOOL = boolValidEnchantmentConstructor("PROTECTION_FALL");
- PROTECTION_FALL_MAX_LEVEL = maxLevelValidEnchantmentConstructor("PROTECTION_FALL");
-
- PROTECTION_FIRE_BOOL = boolValidEnchantmentConstructor("PROTECTION_FIRE");
- PROTECTION_FIRE_MAX_LEVEL = maxLevelValidEnchantmentConstructor("PROTECTION_FIRE");
-
- PROTECTION_PROJECTILE_BOOL = boolValidEnchantmentConstructor("PROTECTION_PROJECTILE");
- PROTECTION_PROJECTILE_MAX_LEVEL = maxLevelValidEnchantmentConstructor("PROTECTION_PROJECTILE");
-
- SILK_TOUCH_BOOL = boolValidEnchantmentConstructor("SILK_TOUCH");
-
- SWEEPING_EDGE_BOOL = boolValidEnchantmentConstructor("SWEEPING_EDGE");
- SWEEPING_EDGE_MAX_LEVEL = maxLevelValidEnchantmentConstructor("SWEEPING_EDGE");
-
- THORNS_BOOL = boolValidEnchantmentConstructor("THORNS");
- THORNS_MAX_LEVEL = maxLevelValidEnchantmentConstructor("THORNS");
-
- VANISHING_CURSE_BOOL = boolValidEnchantmentConstructor("VANISHING");
-
- WATER_WORKER_BOOL = boolValidEnchantmentConstructor("WATER_WORKER");
- WATER_WORKER_MAX_LEVEL = maxLevelValidEnchantmentConstructor("WATER_WORKER");
-
- /*
- Custom enchantments
- */
- HUNTER_BOOL = boolValidEnchantmentConstructor("HUNTER");
- HUNTER_MAX_LEVEL = maxLevelValidEnchantmentConstructor("HUNTER");
-
-
- configuration.addDefault(ARROW_DAMAGE_BOOL, true);
- configuration.addDefault(ARROW_DAMAGE_MAX_LEVEL, 5);
-
- configuration.addDefault(ARROW_FIRE_BOOL, true);
- configuration.addDefault(ARROW_FIRE_MAX_LEVEL, 1);
-
- configuration.addDefault(ARROW_INFINITE_BOOL, true);
-
- configuration.addDefault(ARROW_KNOCKBACK_BOOL, true);
- configuration.addDefault(ARROW_KNOCKBACK_MAX_LEVEL, 2);
-
- configuration.addDefault(BINDING_CURSE_BOOL, true);
-
- configuration.addDefault(DAMAGE_ALL_BOOL, true);
- configuration.addDefault(DAMAGE_ALL_MAX_LEVEL, 5);
-
- configuration.addDefault(DAMAGE_ARTHROPODS_BOOL, true);
- configuration.addDefault(DAMAGE_ARTHROPODS_MAX_LEVEL, 5);
-
- configuration.addDefault(DAMAGE_UNDEAD_BOOL, true);
- configuration.addDefault(DAMAGE_UNDEAD_MAX_LEVEL, 5);
-
- configuration.addDefault(DEPTH_STRIDER_BOOL, true);
- configuration.addDefault(DEPTH_STRIDER_MAX_LEVEL, 3);
-
- configuration.addDefault(DIG_SPEED_BOOL, true);
- configuration.addDefault(DIG_SPEED_MAX_LEVEL, 5);
-
- configuration.addDefault(DURABILITY_BOOL, true);
- configuration.addDefault(DURABILITY_MAX_LEVEL, 3);
-
- configuration.addDefault(FIRE_ASPECT_BOOL, true);
- configuration.addDefault(FIRE_ASPECT_MAX_LEVEL, 2);
-
- configuration.addDefault(FROST_WALKER_BOOL, true);
- configuration.addDefault(FROST_WALKER_MAX_LEVEL, 2);
-
- configuration.addDefault(KNOCKBACK_BOOL, true);
- configuration.addDefault(KNOCKBACK_MAX_LEVEL, 2);
-
- configuration.addDefault(LOOT_BONUS_BLOCKS_BOOL, true);
- configuration.addDefault(LOOT_BONUS_BLOCKS_MAX_LEVEL, 3);
-
- configuration.addDefault(LOOT_BONUS_MOBS_BOOL, true);
- configuration.addDefault(LOOT_BONUS_MOBS_MAX_LEVEL, 3);
-
- configuration.addDefault(LUCK_BOOL, true);
- configuration.addDefault(LUCK_MAX_LEVEL, 3);
-
- configuration.addDefault(LURE_BOOL, true);
- configuration.addDefault(LURE_MAX_LEVEL, 3);
-
- configuration.addDefault(MENDING_BOOL, false);
-
- configuration.addDefault(OXYGEN_BOOL, true);
- configuration.addDefault(OXYGEN_MAX_LEVEL, 3);
-
- configuration.addDefault(PROTECTION_ENVIRONMENTAL_BOOL, true);
- configuration.addDefault(PROTECTION_ENVIRONMENTAL_MAX_LEVEL, 4);
-
- configuration.addDefault(PROTECTION_EXPLOSIONS_BOOL, true);
- configuration.addDefault(PROTECTION_EXPLOSIONS_MAX_LEVEL, 4);
-
- configuration.addDefault(PROTECTION_FALL_BOOL, true);
- configuration.addDefault(PROTECTION_FALL_MAX_LEVEL, 4);
-
- configuration.addDefault(PROTECTION_FIRE_BOOL, true);
- configuration.addDefault(PROTECTION_FIRE_MAX_LEVEL, 4);
-
- configuration.addDefault(PROTECTION_PROJECTILE_BOOL, true);
- configuration.addDefault(PROTECTION_PROJECTILE_MAX_LEVEL, 4);
-
- configuration.addDefault(SILK_TOUCH_BOOL, true);
-
- configuration.addDefault(SWEEPING_EDGE_BOOL, true);
- configuration.addDefault(SWEEPING_EDGE_MAX_LEVEL, 3);
-
- configuration.addDefault(THORNS_BOOL, true);
- configuration.addDefault(THORNS_MAX_LEVEL, 3);
-
- configuration.addDefault(VANISHING_CURSE_BOOL, true);
-
- configuration.addDefault(WATER_WORKER_BOOL, true);
- configuration.addDefault(WATER_WORKER_MAX_LEVEL, 1);
-
- configuration.addDefault(HUNTER_BOOL, true);
- configuration.addDefault(HUNTER_MAX_LEVEL, 3);
-
- configuration.addDefault(SWORD_MATERIAL_NAME, "Sword");
- configuration.addDefault(BOW_MATERIAL_NAME, "Bow");
- configuration.addDefault(PICKAXE_MATERIAL_NAME, "Pickaxe");
- configuration.addDefault(SPADE_MATERIAL_NAME, "Spade");
- configuration.addDefault(HOE_MATERIAL_NAME, "Hoe");
- configuration.addDefault(AXE_MATERIAL_NAME, "Axe");
- configuration.addDefault(FISHING_ROD_MATERIAL_NAME, "Fishing Rod");
- configuration.addDefault(SHIELD_MATERIAL_NAME, "Shield");
- configuration.addDefault(SHEARS_MATERIAL_NAME, "Shears");
- configuration.addDefault(HELMET_MATERIAL_NAME, "Helmet");
- configuration.addDefault(CHESTPLATE_MATERIAL_NAME, "Chestplate");
- configuration.addDefault(LEGGINGS_MATERIAL_NAME, "Leggings");
- configuration.addDefault(BOOTS_MATERIAL_NAME, "Boots");
- configuration.addDefault(CUSTOM_ENCHANTMENT_CHANCE, 0.1);
-
- configuration.addDefault(ITEM_NAME_FORMAT, Arrays.asList(
- "$verb $itemType of the $adjective $noun",
- "$itemType of the $adjective $noun",
- "$noun's $adjective $verb $itemType",
- "$verb $itemType",
- "$adjective $verb $itemType",
- "The $verb-er",
- "The $adjective $verb-er"
- ));
-
- configuration.addDefault("Valid nouns", Arrays.asList(
- "MagmaGuy",
- "Dawn",
- "Sunset",
- "Heaven",
- "Hell",
- "Angel",
- "Archangel",
- "Cherub",
- "Seraph",
- "Demon",
- "Fiend",
- "Bat",
- "Chicken",
- "Cow",
- "Mooshroom",
- "Pig",
- "Rabbit",
- "Sheep",
- "Squid",
- "Villager",
- "Cave Spider",
- "Enderman",
- "Polar Bear",
- "Spider",
- "Zombie Pigman",
- "Blaze",
- "Creeper",
- "Elder Guardian",
- "Endermite",
- "Evoker",
- "Ghast",
- "Guardian",
- "Husk",
- "Magma Cube",
- "Shulker",
- "Silverfish",
- "Skeleton",
- "Slime",
- "Stray",
- "Vex",
- "Vindicator",
- "Witch",
- "Wither Skeleton",
- "Zombie",
- "Donkey",
- "Horse",
- "Llama",
- "Mule",
- "Ocelot",
- "Wolf",
- "Iron Golem",
- "Snow Golem",
- "Ender Dragon",
- "Wither",
- "Illusioner",
- "Parrot",
- "Giant",
- "Killer Bunny",
- "Steve",
- "Wolfbane",
- "Chaos",
- "Aeon",
- "Dragon",
- "Sphynx",
- "Minotaur",
- "Hades",
- "Oath",
- "Oathbreaker",
- "Deserter",
- "Betrayer",
- "Jade",
- "Light",
- "Darkness",
- "Oblivion",
- "Shadow",
- "Void",
- "Xeno",
- "Zealot",
- "Zenith",
- "Dusk",
- "Twilight",
- "Mob",
- "Elite Mob",
- "Urist",
- "Dwarf",
- "Elf",
- "Ork",
- "Goblin",
- "Gnome",
- "Goliath",
- "Drow",
- "Human",
- "Halfling",
- "Half-Orc",
- "Beholder",
- "Mind Flayer",
- "Owlbear",
- "Bulette",
- "Rust Monster",
- "Hill Giant",
- "Stone Giant",
- "Frost Giant",
- "Fire Giant",
- "Cloud Giant",
- "Storm Giant",
- "Kobold",
- "Lich",
- "Ork",
- "Umber Hulk",
- "Fighter",
- "Wizard",
- "Paladin",
- "Cleric",
- "Ranger",
- "Archer",
- "Mage",
- "Tiefling",
- "Werewolf",
- "Vampire",
- "Centaur",
- "Catfolk",
- "Half-Giant",
- "Ogre",
- "Troll",
- "Rogue",
- "Barbarian",
- "Bard",
- "Druid",
- "Monk",
- "Sorcerer",
- "Warlock",
- "Demon HunterEnchantment",
- "Death Knight",
- "Priest",
- "Shaman",
- "Warrior",
- "Basilisk",
- "Chimera",
- "Imp",
- "Dryad",
- "Gargoyle",
- "Djinni",
- "Efreeti",
- "Ghost",
- "Hobgoblin",
- "Hydra",
- "Kraken",
- "Lamia",
- "Medusa",
- "Mimic",
- "Mummy",
- "Pegasus",
- "Roc",
- "Satyr",
- "Tarrasque",
- "Abomination",
- "Ghoul",
- "Treant",
- "Unicorn",
- "Wraith",
- "Acolyte",
- "Gladiator",
- "Knight",
- "Gryphon",
- "Raider",
- "Scout",
- "Spy",
- "Thg",
- "Noble",
- "Guard",
- "Veteran",
- "Wyvern",
- "Abyssal",
- "Infernal",
- "Elemental",
- "Tauren",
- "Pandaren",
- "Sasquatch",
- "Forsaken",
- "Yeti",
- "Banshee",
- "Arachnid",
- "Undead",
- "Night Elf",
- "Blood Elf",
- "Draenei",
- "Worgen",
- "Warlord",
- "Witch",
- "Magi",
- "Sage",
- "Thief",
- "Assassin",
- "Templar",
- "Beastmaster",
- "Berserker",
- "Inventor",
- "Luchador",
- "Pirate",
- "Vanguard",
- "Voidblade",
- "Whisp",
- "Peasant",
- "Footman",
- "Swordsman",
- "Thrall",
- "Felhound",
- "Huntress",
- "HunterEnchantment"
- ));
-
- configuration.addDefault("Valid verb-er (noun)", Arrays.asList(
- "World Breaker",
- "World Shatterer",
- "Avenger",
- "Ashbringer",
- "Windseeker",
- "Defiler",
- "Thunderfury",
- "Slicer",
- "Slasher",
- "Cutter",
- "Stabber",
- "Scratcher",
- "Killer",
- "Slayer",
- "Destroyer",
- "Hugger",
- "Murderer",
- "Slapper",
- "Traveller",
- "Teleporter",
- "Blinker",
- "Wrecker",
- "Materializer",
- "Spawner",
- "Demander",
- "Assaulter",
- "Striker",
- "Ambusher",
- "Rusher",
- "Stormer",
- "Bombarder",
- "Barrager",
- "Smiter",
- "Charger",
- "Battler",
- "Hammerer",
- "Beater",
- "Combater",
- "Overwhelmer",
- "Raider",
- "Tackler",
- "Shooter",
- "Venturer",
- "Cracker",
- "Smasher",
- "Shatterer",
- "Fracturer",
- "Splinterer",
- "Pulverizer",
- "Tearer",
- "Renderer",
- "Snapper",
- "Burster",
- "Exploder",
- "Damager",
- "Fragmenter",
- "Splitter",
- "Fortifier",
- "Nudger",
- "Tapper",
- "Thumper",
- "Butter",
- "Clatterer",
- "Striker",
- "Whacker",
- "Slammer",
- "Summoner",
- "Screamer",
- "Shifter",
- "Transformer",
- "Modifyer",
- "Twister",
- "Blurrer",
- "Warper",
- "Alterer",
- "Adapter",
- "Evolver",
- "HunterEnchantment",
- "Trailer",
- "Follower",
- "Stalker",
- "Shadower",
- "Hounder",
- "Caser",
- "Mounter",
- "Ascender",
- "Riser",
- "Springer",
- "Hoarder",
- "Reaper",
- "Harvester",
- "Saver",
- "Shelterer",
- "Cloaker",
- "Shrouder",
- "Encloser",
- "Hider",
- "Masker",
- "Buryer",
- "Clouder",
- "Shader",
- "Sealer",
- "Enveloper",
- "Veiler",
- "Traverser",
- "Forder",
- "Glider",
- "Howler",
- "Whimperer",
- "Screamer",
- "Squealer",
- "Bawler",
- "Screecher",
- "Chopper",
- "Chipper",
- "Snipper",
- "Splitter",
- "Axer",
- "Slasher",
- "Renderer",
- "Tearer",
- "Thinner",
- "Cropper",
- "Carver",
- "Hacker",
- "Piercer",
- "Sawer",
- "Shaver",
- "Shearer",
- "Miner",
- "Excavater",
- "Burrower",
- "Driller",
- "Tunneler",
- "Invader",
- "Boarder",
- "Wanderer",
- "Intruder",
- "Evader",
- "Runner",
- "Dodger",
- "Crasher",
- "Battler",
- "Wrestler",
- "Scuffler",
- "Dueler",
- "Brawler",
- "Clasher",
- "Grappler",
- "Scrapper",
- "Attacker",
- "Feuder",
- "Catcher",
- "Solver",
- "Revealer",
- "Leaper",
- "Bouncer",
- "Vaulter",
- "Hopper",
- "Surger",
- "Punter",
- "Dropkicker",
- "Perceiver",
- "Fader",
- "Bleeder",
- "Weakener",
- "Forger",
- "Releaser",
- "Gatherer",
- "Crusher",
- "Propeller",
- "Jogger",
- "Sprinter",
- "Scouter",
- "Explorer",
- "Digger",
- "Trembler",
- "Parter",
- "Hacker",
- "Carver",
- "Divider",
- "Halver",
- "Breaker",
- "Renderer",
- "Ripper",
- "Grazer",
- "Imprisoner",
- "Cornerer",
- "Pinner",
- "Catcher",
- "Restrainer",
- "Binder",
- "Snagger",
- "Snatcher",
- "Cager",
- "Capturer",
- "Haunter",
- "Creeper",
- "Sneaker"
- ));
-
- configuration.addDefault("Valid adjectives", Arrays.asList(
- "Adorable",
- "Beautiful",
- "Clean",
- "Elegant",
- "Fancy",
- "Glamorous",
- "Handsome",
- "Long",
- "Magnificent",
- "Plain",
- "Quaint",
- "Sparkling",
- "Ugliest",
- "Red",
- "Orange",
- "Yellow",
- "Green",
- "Blue",
- "Purple",
- "Gray",
- "Black",
- "White",
- "Dead",
- "Odd",
- "Powerful",
- "Rich",
- "Vast",
- "Zealous",
- "Deafening",
- "Faint",
- "Melodic",
- "Quiet",
- "Thundering",
- "Whispering",
- "Hissing",
- "Ancient",
- "Fast",
- "Old",
- "Rapid",
- "Slow",
- "Rotten",
- "Creepy",
- "Crooked",
- "Empty",
- "Heavy",
- "Abhorrent",
- "Abnormal",
- "Absurd",
- "Acceptable",
- "Accidental",
- "Adamant",
- "Adventurous",
- "Agonizing",
- "Alert",
- "Annoyed",
- "Annoying",
- "Anxious",
- "Aromatic",
- "Aggressive",
- "Aloof",
- "Amazing",
- "Ambiguous",
- "Ambitious",
- "Amused",
- "Angry",
- "Arrogant",
- "Ashamed",
- "Aspiring",
- "Astonishing",
- "Auspicious",
- "Average",
- "Awesome",
- "Awful",
- "Bad",
- "Barbarous",
- "Bashful",
- "Beffiting",
- "Belligerent",
- "Beneficial",
- "Berserk",
- "Best",
- "Bewildered",
- "Big",
- "Bitter",
- "Bizarre",
- "Bloody",
- "Boiling",
- "Boundless",
- "Brash",
- "Brave",
- "Brawny",
- "Breakable",
- "Brief",
- "Bright",
- "Broken",
- "Busy",
- "Calculating",
- "Callous",
- "Calm",
- "Capricious",
- "Careful",
- "Careless",
- "Caring",
- "Cautious",
- "Ceaseless",
- "Certain",
- "Charming",
- "Cheap",
- "Chief",
- "Chilly",
- "Chivalrous",
- "Chunky",
- "Clear",
- "Clever",
- "Cloistered",
- "Clumsy",
- "Cloudy",
- "Classy",
- "Colossal",
- "Combative",
- "Common",
- "Confused",
- "Condemned",
- "Cool",
- "Courageous",
- "Cowardly",
- "Crazy",
- "Craven",
- "Cruel",
- "Cuddly",
- "Curious",
- "Cute",
- "Damaged",
- "Damaging",
- "Dangerous",
- "Dark",
- "Dashing",
- "Decisive",
- "Deep",
- "Defeated",
- "Defective",
- "Defiant",
- "Delicate",
- "Delicious",
- "Delightful",
- "Demonic",
- "Delirious",
- "Deranged",
- "Descriptive",
- "Devilish",
- "Difficult",
- "Diligent",
- "Direful",
- "Dirty",
- "Disastrous",
- "Disgusted",
- "Disgusting",
- "Disillusioned",
- "Distinct",
- "Disturbed",
- "Draconian",
- "Dramatic",
- "Dreary",
- "Dysfunctional",
- "Eager",
- "Elderly",
- "Electric",
- "Elite",
- "Enchanted",
- "Enchanting",
- "Energetic",
- "Enormous",
- "Entertaining",
- "Enthusiastic",
- "Envious",
- "Erratic",
- "Ethereal",
- "Evasive",
- "Excellent",
- "Excited",
- "Exciting",
- "Exotic",
- "Exuberant",
- "Fabulous",
- "Faded",
- "Fair",
- "Faithful",
- "False",
- "Familiar",
- "Famous",
- "Fanatical",
- "Fantastic",
- "Fascinated",
- "Fat",
- "Fearful",
- "Fearless",
- "Feeble",
- "Festive",
- "Fierce",
- "Filthy",
- "Fine",
- "Finicky",
- "First",
- "Fixed",
- "Flashy",
- "Flawless",
- "Flimsy",
- "Flippant",
- "Flowery",
- "Fluffy",
- "Fluttering",
- "Foamy",
- "Foolish",
- "Forgetful",
- "Fortunate",
- "Frail",
- "Fragile",
- "Frantic",
- "Free",
- "Freezing",
- "Fresh",
- "Friendly",
- "Frightening",
- "Fumbling",
- "Funny",
- "Furry",
- "Furtive",
- "Fuzzy",
- "Giant",
- "Gifted",
- "Gigantic",
- "Glistening",
- "Glorious",
- "Godly",
- "Good",
- "Goofy",
- "Gorgeous",
- "Graceful",
- "Grandiose",
- "Grateful",
- "Greasy",
- "Great",
- "Greedy",
- "Grieving",
- "Groovy",
- "Grotesque",
- "Grubby",
- "Gruesome",
- "Grumpy",
- "Guarded",
- "Guiltless",
- "Gullible",
- "Gutsy",
- "Guttural",
- "Hallowed",
- "Hanging",
- "Hapless",
- "Happy",
- "Harmonious",
- "Hateful",
- "Healthy",
- "Heartbreaking",
- "Heavenly",
- "Hellish",
- "Helpful",
- "Helpless",
- "Hesitant",
- "Hideous",
- "Hilarious",
- "Hollow",
- "Homeless",
- "Honorable",
- "Horrible",
- "Hospitable",
- "Huge",
- "Hulking",
- "Humorous",
- "Hungry",
- "Hurt",
- "Hushed",
- "Hypnotic",
- "Hysterical",
- "Icky",
- "Icy",
- "Ignorant",
- "Ill",
- "Illegal",
- "Illustrious",
- "Imaginary",
- "Immense",
- "Imminent",
- "Impartial",
- "Imperfect",
- "Impolite",
- "Important",
- "Incandescent",
- "Incompetent",
- "Industrious",
- "Incredible",
- "Inexpensive",
- "Infamous",
- "Innocent",
- "Inquisitive",
- "Insidious",
- "Instinctive",
- "Intelligent",
- "Interesting",
- "Invincible",
- "Irate",
- "Itchy",
- "Jaded",
- "Jagged",
- "Jealous",
- "Jolly",
- "Joyous",
- "Jumpy",
- "Juvenile",
- "Keen",
- "Kind",
- "Kindhearted",
- "Knowing",
- "Knowledgeable",
- "Known",
- "Labored",
- "Lame",
- "Large",
- "Last",
- "Late",
- "Laughable",
- "Lazy",
- "Lean",
- "Lethal",
- "Light",
- "Little",
- "Living",
- "Lonely",
- "Loud",
- "Lovely",
- "Lucky",
- "Magenta",
- "Magical",
- "Majestic",
- "Malicious",
- "Marked",
- "Massive",
- "Marvelous",
- "Mean",
- "Medical",
- "Melted",
- "Messy",
- "Mighty",
- "Military",
- "Mindless",
- "Minor",
- "Misty",
- "Mixed",
- "Modern",
- "Motionless",
- "Mysterious",
- "Naive",
- "Narrow",
- "Natural",
- "Neat",
- "Necessary",
- "Needless",
- "Needy",
- "Nervous",
- "New",
- "Nice",
- "Normal",
- "Nostalgic",
- "Numberless",
- "Obsolete",
- "Obtainable",
- "Oceanic",
- "Old-fashioned",
- "Omniscient",
- "Optimal",
- "Ordinary",
- "Organic",
- "Outstanding",
- "Oval",
- "Overrated",
- "Painful",
- "Parallel",
- "Pathetic",
- "Peaceful",
- "Penitent",
- "Perfect",
- "Periodic",
- "Petite",
- "Physical",
- "Pink",
- "Plastic",
- "Pleasant",
- "Pointless",
- "Polite",
- "Poor",
- "Precious",
- "Premium",
- "Present",
- "Pretty",
- "Private",
- "Productive",
- "Protective",
- "Public",
- "Puzzling",
- "Questionable",
- "Quick",
- "Quickest",
- "Rare",
- "Ready",
- "Real",
- "Rebel",
- "Regular",
- "Remarkable",
- "Responsible",
- "Romantic",
- "Round",
- "Royal",
- "Sad",
- "Safe",
- "Salty",
- "Satisfying",
- "Scared",
- "Scary",
- "Scientific",
- "Scrawny",
- "Screeching",
- "Second",
- "Second-hand",
- "Secret",
- "Selfish",
- "Sequacious",
- "Serious",
- "Shallow",
- "Sharp",
- "Shiny",
- "Shocking",
- "Short",
- "Shy",
- "Sick",
- "Silent",
- "Silky",
- "Silly",
- "Simple",
- "Skinny",
- "Slim",
- "Slimy",
- "Slippery",
- "Small",
- "Smart",
- "Smiling",
- "Smooth",
- "Sneaky",
- "Soft",
- "Solid",
- "Special",
- "Spectacular",
- "Spicy",
- "Spiky",
- "Splendid",
- "Spooky",
- "Spotless",
- "Square",
- "Staking",
- "Standing",
- "Steady",
- "Sticky",
- "Strange",
- "Striped",
- "Strong",
- "Successful",
- "Super",
- "Supreme",
- "Sweet",
- "Talented",
- "Tall",
- "Tasty",
- "Temporary",
- "Tense",
- "Terrible",
- "Terrific",
- "Tested",
- "Thankful",
- "Thick",
- "Thin",
- "Thirsty",
- "Thoughtful",
- "Tiny",
- "Tired",
- "Tricky",
- "Troubled",
- "True",
- "Ugly",
- "Ultra",
- "Unadvised",
- "Unarmed",
- "Uncovered",
- "Unhealthy",
- "Unique",
- "Unknown",
- "Unnatural",
- "Unused",
- "Unusual",
- "Used",
- "Useful",
- "Useless",
- "Valuable",
- "Violent",
- "Waiting",
- "Wandering",
- "Warm",
- "Weak",
- "Wealthy",
- "Whole",
- "Wise",
- "Wonderful",
- "Wooden",
- "Worried",
- "Worthless",
- "Wrong",
- "Menacing"
- ));
-
- configuration.addDefault("Valid verbs", Arrays.asList(
- "Slashing",
- "Cutting",
- "Stabbing",
- "Scratching",
- "Killing",
- "Slaying",
- "Butchering",
- "Destroying",
- "Tickling",
- "Hugging",
- "Murdering",
- "Slapping",
- "Hissing",
- "Traveling",
- "Teleporting",
- "Blinking",
- "Destroying",
- "Wrecking",
- "Flashing",
- "Materializing",
- "Spawning",
- "Questioning",
- "Inquiring",
- "Pleading",
- "Demanding",
- "Interrogating",
- "Querying",
- "Assaulting",
- "Striking",
- "Ambushing",
- "Assailing",
- "Rushing",
- "Storming",
- "Bombarding",
- "Barraging",
- "Smiting",
- "Charging",
- "Clobbering",
- "Battling",
- "Battering",
- "Hammering",
- "Beating",
- "Combating",
- "Overwhelming",
- "Raiding",
- "Tackling",
- "Shooting",
- "Venturing",
- "Cracking",
- "Rupturing",
- "Smashing",
- "Shattering",
- "Fracturing",
- "Splintering",
- "Pulverizing",
- "Tearing",
- "Rending",
- "Snapping",
- "Bursting",
- "Exploding",
- "Damaging",
- "Fragmenting",
- "Splitting",
- "Fortifying",
- "Nudging",
- "Tapping",
- "Jostling",
- "Thumping",
- "Butting",
- "Clattering",
- "Striking",
- "Whacking",
- "Slamming",
- "Summoning",
- "Screaming",
- "Bellowing",
- "Roaring",
- "Shifting",
- "Transforming",
- "Modifying",
- "Twisting",
- "Mutating",
- "Distorting",
- "Blurring",
- "Adjusting",
- "Warping",
- "Altering",
- "Adapting",
- "Evolving",
- "Varying",
- "Hunting",
- "Trailing",
- "Following",
- "Stalking",
- "Shadowing",
- "Hounding",
- "Casing",
- "Mounting",
- "Ascending",
- "Rising",
- "Heaving",
- "Springing",
- "Cresting",
- "Gathering",
- "Corralling",
- "Hoarding",
- "Reaping",
- "Harvesting",
- "Saving",
- "Sheltering",
- "Cloaking",
- "Shrouding",
- "Enclosing",
- "Concealing",
- "Hiding",
- "Disguising",
- "Masking",
- "Burying",
- "Smothering",
- "Clouding",
- "Shielding",
- "Shading",
- "Sealing",
- "Enveloping",
- "Veiling",
- "Obscuring",
- "Traversing",
- "Fording",
- "Gliding",
- "Howling",
- "Whimpering",
- "Screaming",
- "Shrieking",
- "Squealing",
- "Roaring",
- "Wailing",
- "Bawling",
- "Screeching",
- "Cleaving",
- "Chopping",
- "Chipping",
- "Severing",
- "Slicing",
- "Snipping",
- "Splitting",
- "Axing",
- "Slashing",
- "Rending",
- "Tearing",
- "Thinning",
- "Cropping",
- "Carving",
- "Dissecting",
- "Hacking",
- "Piercing",
- "Sawing",
- "Shaving",
- "Shearing",
- "Mining",
- "Delving",
- "Excavating",
- "Burrowing",
- "Drilling",
- "Hollowing",
- "Gouging",
- "Tunneling",
- "Invading",
- "Boarding",
- "Wandering",
- "Infiltrating",
- "Intruding",
- "Evading",
- "Fleeing",
- "Running",
- "Dodging",
- "Crashing",
- "Battling",
- "Tussling",
- "Wrestling",
- "Scuffling",
- "Dueling",
- "Brawling",
- "Jousting",
- "Sparring",
- "Clashing",
- "Warring",
- "Grappling",
- "Scrapping",
- "Attacking",
- "Feuding",
- "Skirmishing",
- "Discovering",
- "Detecting",
- "Catching",
- "Solving",
- "Revealing",
- "Unearthing",
- "Leaping",
- "Bouncing",
- "Springing",
- "Vaulting",
- "Hopping",
- "Surging",
- "Punting",
- "Booting",
- "Dropkicking",
- "Sensing",
- "Perceiving",
- "Detecting",
- "Fading",
- "Bleeding",
- "Shrinking",
- "Weakening",
- "Abating",
- "Diminishing",
- "Forging",
- "Releasing",
- "Gathering",
- "Collecting",
- "Culling",
- "Crushing",
- "Propelling",
- "Jogging",
- "Sprinting",
- "Questing",
- "Scouting",
- "Exploring",
- "Digging",
- "Trembling",
- "Rattling",
- "Parting",
- "Hacking",
- "Rupturing",
- "Carving",
- "Dividing",
- "Halving",
- "Breaking",
- "Sundering",
- "Separating",
- "Rending",
- "Ripping",
- "Grazing",
- "Imprisoning",
- "Snaring",
- "Cornering",
- "Entangling",
- "Pinning",
- "Catching",
- "Restraining",
- "Binding",
- "Hooking",
- "Snagging",
- "Snatching",
- "Caging",
- "Capturing",
- "Haunting",
- "Creeping",
- "Sneaking",
- "Spying",
- "Avenging"
-
- ));
-
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
- private String boolValidEnchantmentConstructor(String string) {
-
- String validEnchantmentsprefix = "Valid Enchantments.";
- String allowSuffix = ".Allow";
-
- String finalString = validEnchantmentsprefix + string + allowSuffix;
-
- return finalString;
-
- }
-
- private String maxLevelValidEnchantmentConstructor(String string) {
-
- String validEnchantmentsprefix = "Valid Enchantments.";
- String maxLevelSuffix = ".Max Level";
-
- String finalString = validEnchantmentsprefix + string + maxLevelSuffix;
-
- return finalString;
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ItemsUniqueConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ItemsUniqueConfig.java
deleted file mode 100644
index ae6af6a33..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ItemsUniqueConfig.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import com.magmaguy.elitemobs.items.uniqueitems.*;
-import org.bukkit.configuration.Configuration;
-
-public class ItemsUniqueConfig{
-
- public static final String CONFIG_NAME = "ItemsUnique.yml";
- private CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public static final String ENABLE_UNIQUE_ITEMS = "Enable unique items";
- public static final String ENABLE_HUNTING_SET = "Enable Mob Hunting set";
- public static final String HUNTING_SET_CHANCE_INCREASER = "EliteMob percentual spawn chance increase per hunting set item";
- public static final String ENABLE_ZOMBIE_KING_AXE = "Enable Zombie King Axe";
- public static final String SHOW_ITEM_WORTH = "Show item worth";
- public static final String ENABLE_KRAKEN_FISHING_ROD = "Enable Depths Seeker Fishing Rod";
- public static final String ENABLE_GREED = "Enable Dwarven Greed pickaxe";
- public static final String ENABLE_THE_FELLER = "Enable The Feller";
-
- public void initializeConfig() {
-
- configuration.addDefault(ENABLE_UNIQUE_ITEMS, true);
- configuration.addDefault(SHOW_ITEM_WORTH, true);
- configuration.addDefault(ENABLE_HUNTING_SET, true);
- configuration.addDefault(HUNTING_SET_CHANCE_INCREASER, 10);
- configuration.addDefault(ENABLE_ZOMBIE_KING_AXE, true);
- configuration.addDefault(ENABLE_KRAKEN_FISHING_ROD, true);
- configuration.addDefault(ENABLE_GREED, true);
- configuration.addDefault(ENABLE_THE_FELLER, true);
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
-// Non-static item assembly to avoid issues with making the configuration static (messes up reloads and changes)
- HuntingHelmet huntingHelmet = new HuntingHelmet();
- huntingHelmet.assembleConfigItem(configuration);
-
- HuntingChestplate huntingChestplate = new HuntingChestplate();
- huntingChestplate.assembleConfigItem(configuration);
-
- HuntingLeggings huntingLeggings = new HuntingLeggings();
- huntingLeggings.assembleConfigItem(configuration);
-
- HuntingBoots huntingBoots = new HuntingBoots();
- huntingBoots.assembleConfigItem(configuration);
-
- HuntingBow huntingBow = new HuntingBow();
- huntingBow.assembleConfigItem(configuration);
-
- ZombieKingsAxe zombieKingsAxe = new ZombieKingsAxe();
- zombieKingsAxe.assembleConfigItem(configuration);
-
- DepthsSeeker depthsSeeker = new DepthsSeeker();
- depthsSeeker.assembleConfigItem(configuration);
-
- DwarvenGreed dwarvenGreed = new DwarvenGreed();
- dwarvenGreed.assembleConfigItem(configuration);
-
- TheFeller theFeller = new TheFeller();
- theFeller.assembleConfigItem(configuration);
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java
new file mode 100644
index 000000000..3a0b9fcdd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/LegacyValueConverter.java
@@ -0,0 +1,121 @@
+package com.magmaguy.elitemobs.config;
+
+import org.bukkit.Particle;
+
+import java.util.Locale;
+
+public class LegacyValueConverter {
+ private LegacyValueConverter() {
+ }
+
+ public static String parseEnchantment(String materialName) {
+ switch (materialName.toUpperCase(Locale.ROOT)) {
+ case "ARROW_DAMAGE":
+ return "POWER";
+ case "ARROW_FIRE":
+ return "FLAME";
+ case "ARROW_INFINITE":
+ return "INFINITY";
+ case "ARROW_KNOCKBACK":
+ return "PUNCH";
+ case "DAMAGE_ARTHROPODS":
+ return "BANE_OF_ARTHROPODS";
+ case "DAMAGE_UNDEAD":
+ return "SMITE";
+ case "DIG_SPEED":
+ return "EFFICIENCY";
+ case "DURABILITY":
+ return "UNBREAKING";
+ case "LOOT_BONUS_BLOCKS":
+ return "FORTUNE";
+ case "LOOT_BONUS_MOBS":
+ return "LOOTING";
+ case "LUCK":
+ return "LUCK_OF_THE_SEA";
+ case "RESPIRATION":
+ return "RESPIRATION";
+ case "PROTECTION_ENVIRONMENTAL":
+ return "PROTECTION";
+ case "BLAST_PROTECTION":
+ return "BLAST_PROTECTION";
+ case "PROTECTION_FALL":
+ return "FEATHER_FALLING";
+ case "PROTECTION_FIRE":
+ return "FIRE_PROTECTION";
+ case "PROTECTION_PROJECTILE":
+ return "PROJECTILE_PROTECTION";
+ case "WATER_WORKER":
+ return "AQUA_AFFINITY";
+ default:
+ return materialName;
+ }
+ }
+
+ public static String parsePotionEffect(String potionEffectName) {
+ switch (potionEffectName.toUpperCase(Locale.ROOT)) {
+ case "CONFUSION":
+ return "NAUSEA";
+ case "DAMAGE_RESISTANCE":
+ return "RESISTANCE";
+ case "FAST_DIGGING":
+ return "HASTE";
+ case "HARM":
+ return "INSTANT_DAMAGE";
+ case "HEAL":
+ return "INSTANT_HEALTH";
+ case "INCREASE_DAMAGE":
+ return "STRENGTH";
+ case "JUMP":
+ return "JUMP_BOOST";
+ case "SLOW":
+ return "SLOWNESS";
+ case "SLOW_DIGGING":
+ return "MINING_FATIGUE";
+ default:
+ return potionEffectName;
+ }
+ }
+
+ public static String parseParticle(String potionEffectName) {
+ switch (potionEffectName.toUpperCase(Locale.ROOT)) {
+ case "EXPLOSION_NORMAL", "EXPLOSION_LARGE":
+ return Particle.EXPLOSION.toString();
+ case "SMOKE_NORMAL":
+ return Particle.SMOKE.toString();
+ case "SMOKE_LARGE":
+ return Particle.LARGE_SMOKE.toString();
+ case "REDSTONE":
+ return Particle.DUST.toString();
+ case "SLIME":
+ return Particle.ITEM_SLIME.toString();
+ case "DRIP_LAVA":
+ return Particle.DRIPPING_WATER.toString();
+ case "EXPLOSION_HUGE":
+ return Particle.EXPLOSION.toString();
+ case "SNOWBALL":
+ return Particle.SNOWFLAKE.toString();
+ case "SPELL":
+ return Particle.WITCH.toString();
+ case "DRIP_WATER":
+ return Particle.DRIPPING_WATER.toString();
+ case "SPELL_MOB":
+ return Particle.WITCH.toString();
+ case "VILLAGER_ANGRY":
+ return Particle.ANGRY_VILLAGER.toString();
+ case "WATER_BUBBLE":
+ return Particle.UNDERWATER.toString();
+ case "VILLAGER_HAPPY":
+ return Particle.HAPPY_VILLAGER.toString();
+ case "WATER_SPLASH":
+ return Particle.SPLASH.toString();
+ default:
+ return potionEffectName;
+ }
+ }
+
+ public static String parseDeserializedBlocks(String originalDeserializedBlock) {
+ if (originalDeserializedBlock.endsWith("grass"))
+ return originalDeserializedBlock.replace("grass", "grass_block[snowy=false]");
+ return originalDeserializedBlock;
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java
index d80be6013..070621c58 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/MobCombatSettingsConfig.java
@@ -1,129 +1,222 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-import org.bukkit.configuration.Configuration;
-
-public class MobCombatSettingsConfig {
-
- public static final String CONFIG_NAME = "MobCombatSettings.yml";
-
- public static final String NATURAL_MOB_SPAWNING = "Natural EliteMob spawning";
- public static final String SPAWNERS_SPAWN_ELITE_MOBS = "Spawners can spawn Elite Mobs";
- public static final String AGGRESSIVE_MOB_CONVERSION_PERCENTAGE = "Percentage of aggressive mobs that get converted to EliteMobs when they spawn";
- public static final String AGGRESSIVE_MOB_STACKING = "Aggressive mob stacking";
- public static final String ELITEMOB_STACKING_CAP = "Elite mob stacking cap";
- public static final String PER_TIER_LEVEL_INCREASE = "Levels between elite mob tiers";
- public static final String STACK_AGGRESSIVE_SPAWNER_MOBS = "Stack aggressive spawner mobs";
- public static final String STACK_AGGRESSIVE_NATURAL_MOBS = "Stack aggressive natural mobs";
- public static final String AGGRESSIVE_STACK_RANGE = "Range to stack aggressive mobs";
- public static final String PASSIVE_STACK_RANGE = "Range to stack passive mobs";
- public static final String NATURAL_ELITEMOB_LEVEL_CAP = "Natural elite mob level cap";
- public final static String TARGET_HITS_TO_KILL = "Target hits to kill Elite Mob";
- public final static String BASE_DAMAGE_DEALT_TO_PLAYER = "Base damage dealt to players by Elite Mobs";
- public static final String ELITE_CREEPER_EXPLOSION_MULTIPLIER = "SuperCreeper explosion nerf multiplier";
- public static final String ELITE_ARMOR = "Elite Mobs wear armor";
- public static final String ELITE_HELMETS = "Elite Mobs wear helmets";
- public static final String ENABLE_VISUAL_EFFECTS_FOR_NATURAL_MOBS = "Turn on visual effects for natural or plugin-spawned EliteMobs";
- public static final String DISABLE_VISUAL_EFFECTS_FOR_SPAWNER_MOBS = "Dangerous! Turn off visual effects for non-natural or non-plugin-spawned EliteMobs";
- public static final String ENABLE_WARNING_VISUAL_EFFECTS = "Turn on visual effects that indicate an attack is about to happen";
- public static final String ENABLE_DEATH_MESSAGES = "Enable EliteMobs death messages";
- private static final String DEATH_MESSAGES = "Player death messages cause by.";
- public static final String BLAZE_DEATH_MESSAGE = DEATH_MESSAGES + "blazes";
- public static final String CREEPER_DEATH_MESSAGE = DEATH_MESSAGES + "creeper";
- public static final String ENDERMAN_DEATH_MESSAGE = DEATH_MESSAGES + "enderman";
- public static final String ENDERMITE_DEATH_MESSAGE = DEATH_MESSAGES + "endermite";
- public static final String IRONGOLEM_DEATH_MESSAGE = DEATH_MESSAGES + "iron golem";
- public static final String POLARBEAR_DEATH_MESSAGE = DEATH_MESSAGES + "polar bear";
- public static final String SILVERFISH_DEATH_MESSAGE = DEATH_MESSAGES + "silverfish";
- public static final String SKELETON_DEATH_MESSAGE = DEATH_MESSAGES + "skeleton";
- public static final String SPIDER_DEATH_MESSAGE = DEATH_MESSAGES + "spider";
- public static final String WITCH_DEATH_MESSAGE = DEATH_MESSAGES + "witch";
- public static final String ZOMBIE_DEATH_MESSAGE = DEATH_MESSAGES + "zombie";
- public static final String HUSK_DEATH_MESSAGE = DEATH_MESSAGES + "husk";
- public static final String ZOMBIE_PIGMAN_DEATH_MESSAGE = DEATH_MESSAGES + "zombie pigman";
- public static final String STRAY_DEATH_MESSAGE = DEATH_MESSAGES + "stray";
- public static final String WITHER_SKELETON_DEATH_MESSAGE = DEATH_MESSAGES + "wither skeleton";
- public static final String DEFAULT_DEATH_MESSAGE = DEATH_MESSAGES + "default";
- public static final String DISPLAY_HEALTH_ON_HIT = "Display Elite Mob health on hit";
- public static final String DISPLAY_DAMAGE_ON_HIT = "Display damage dealt to Elite Mobs on hit";
- public static final String ONLY_SHOW_HEALTH_FOR_ELITE_MOBS = "Only display health indicator for Elite Mobs";
- public static final String ONLY_SHOW_DAMAGE_FOR_ELITE_MOBS = "Only display damage indicator for Elite Mobs";
- public static final String INCREASE_DIFFICULTY_WITH_SPAWN_DISTANCE = "Increase level of mobs spawned based on distance from world spawn";
- public static final String DISTANCE_TO_INCREMENT = "Distance between increments";
- public static final String LEVEL_TO_INCREMENT = "Amount of levels incremented per distance";
- public static final String ANTI_EXPLOIT_MESSAGE = "Anti exploit message";
- public static final String OBFUSCATE_MOB_POWERS = "Hide mob powers until they are engaged";
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- public Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
+import java.util.Collections;
+import java.util.List;
- public void initializeConfig() {
-
- configuration.addDefault(NATURAL_MOB_SPAWNING, true);
- configuration.addDefault(SPAWNERS_SPAWN_ELITE_MOBS, false);
- configuration.addDefault(AGGRESSIVE_MOB_CONVERSION_PERCENTAGE, 020.00);
- configuration.addDefault(AGGRESSIVE_MOB_STACKING, true);
- configuration.addDefault(ELITEMOB_STACKING_CAP, 100);
- configuration.addDefault(STACK_AGGRESSIVE_SPAWNER_MOBS, true);
- configuration.addDefault(STACK_AGGRESSIVE_NATURAL_MOBS, false);
- configuration.addDefault(AGGRESSIVE_STACK_RANGE, 1);
- configuration.addDefault(PASSIVE_STACK_RANGE, 15);
- configuration.addDefault(NATURAL_ELITEMOB_LEVEL_CAP, 2500);
- configuration.addDefault(TARGET_HITS_TO_KILL, 10);
- configuration.addDefault(BASE_DAMAGE_DEALT_TO_PLAYER, 5);
- configuration.addDefault(ELITE_CREEPER_EXPLOSION_MULTIPLIER, 1.0);
- configuration.addDefault(ELITE_ARMOR, true);
- configuration.addDefault(ELITE_HELMETS, true);
- configuration.addDefault(ENABLE_VISUAL_EFFECTS_FOR_NATURAL_MOBS, true);
- configuration.addDefault(DISABLE_VISUAL_EFFECTS_FOR_SPAWNER_MOBS, true);
- configuration.addDefault(ENABLE_WARNING_VISUAL_EFFECTS, true);
- configuration.addDefault(PER_TIER_LEVEL_INCREASE, 10);
- configuration.addDefault(ENABLE_DEATH_MESSAGES, true);
- configuration.addDefault(BLAZE_DEATH_MESSAGE, "$player was lit ablaze by $entity!");
- configuration.addDefault(CREEPER_DEATH_MESSAGE, "$player was blasted away by $entity!");
- configuration.addDefault(ENDERMAN_DEATH_MESSAGE, "$entity sent $player into the void!");
- configuration.addDefault(ENDERMITE_DEATH_MESSAGE, "$player was glitched to death by $entity!");
- configuration.addDefault(IRONGOLEM_DEATH_MESSAGE, "$player messed with the wrong $entity!");
- configuration.addDefault(POLARBEAR_DEATH_MESSAGE, "$player was clawed to death by $entity!");
- configuration.addDefault(SILVERFISH_DEATH_MESSAGE, "$player mistook $entity for a stone block!");
- configuration.addDefault(SKELETON_DEATH_MESSAGE, "$player became $entity's pin cushion!");
- configuration.addDefault(SPIDER_DEATH_MESSAGE, "$player became entangled in $entity's web!");
- configuration.addDefault(WITCH_DEATH_MESSAGE, "$player became $entity's test subject!");
- configuration.addDefault(ZOMBIE_DEATH_MESSAGE, "$player was devoured by $entity!");
- configuration.addDefault(HUSK_DEATH_MESSAGE, "$player was hollowed out by $entity!");
- configuration.addDefault(ZOMBIE_PIGMAN_DEATH_MESSAGE, "$player was mobbed to death by $entity!");
- configuration.addDefault(STRAY_DEATH_MESSAGE, "$player was led astray by $entity!");
- configuration.addDefault(WITHER_SKELETON_DEATH_MESSAGE, "$entity's arrows withered away $player!");
- configuration.addDefault(DEFAULT_DEATH_MESSAGE, "$player has been slain by $entity");
- configuration.addDefault(DISPLAY_HEALTH_ON_HIT, true);
- configuration.addDefault(DISPLAY_DAMAGE_ON_HIT, true);
- configuration.addDefault(ONLY_SHOW_HEALTH_FOR_ELITE_MOBS, true);
- configuration.addDefault(ONLY_SHOW_DAMAGE_FOR_ELITE_MOBS, true);
- configuration.addDefault(INCREASE_DIFFICULTY_WITH_SPAWN_DISTANCE, false);
- configuration.addDefault(DISTANCE_TO_INCREMENT, 100);
- configuration.addDefault(LEVEL_TO_INCREMENT, 1);
- configuration.addDefault(ANTI_EXPLOIT_MESSAGE, "&c[EM AntiExploit] &7Nearby elite won't drop special loot.");
- configuration.addDefault(OBFUSCATE_MOB_POWERS, true);
-
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
+public class MobCombatSettingsConfig extends ConfigurationFile {
+ @Getter
+ private static boolean doNaturalMobSpawning;
+ @Getter
+ private static boolean doSpawnersSpawnEliteMobs;
+ @Getter
+ private static double aggressiveMobConversionPercentage;
+ @Getter
+ private static int superMobsStackRange;
+ @Getter
+ private static int naturalEliteMobLevelCap;
+ @Getter
+ private static boolean doEliteArmor;
+ @Getter
+ private static boolean doEliteHelmets;
+ @Getter
+ private static boolean enableVisualEffectsForNaturalMobs;
+ @Getter
+ private static boolean disableVisualEffectsForSpawnerMobs;
+ @Getter
+ private static boolean enableWarningVisualEffects;
+ @Getter
+ private static boolean enableDeathMessages;
+ @Getter
+ private static boolean displayHealthOnHit;
+ @Getter
+ private static boolean displayDamageOnHit;
+ @Getter
+ private static boolean increaseDifficultyWithSpawnDistance;
+ @Getter
+ private static double distanceToIncrement;
+ @Getter
+ private static double levelToIncrement;
+ @Getter
+ private static boolean obfuscateMobPowers;
+ @Getter
+ private static double damageToEliteMultiplier;
+ @Getter
+ private static double damageToPlayerMultiplier;
+ @Getter
+ private static boolean showCustomBossLocation;
+ @Getter
+ private static String bossLocationMessage;
+ @Getter
+ private static List commandsOnDeath;
+ @Getter
+ private static String bossKillParticipationMessage;
+ @Getter
+ private static boolean regenerateCustomBossHealthOnCombatEnd;
+ @Getter
+ private static String defaultOtherWorldBossLocationMessage;
+ @Getter
+ private static String weakTextColor;
+ @Getter
+ private static String resistTextColor;
+ @Getter
+ private static String weakText;
+ @Getter
+ private static String resistText;
+ @Getter
+ private static boolean doWeakEffect;
+ @Getter
+ private static boolean doResistEffect;
+ @Getter
+ private static double normalizedBaselineDamage;
+ @Getter
+ private static double normalizedBaselineHealth;
+ @Getter
+ private static double normalizedDamageToEliteMultiplier;
+ @Getter
+ private static double normalizedDamageToPlayerMultiplier;
+ @Getter
+ private static boolean normalizeRegionalBosses;
+ @Getter
+ private static String fullHealMessage;
+ @Getter
+ private static double strengthAndWeaknessDamageMultipliers;
+ @Getter
+ private static double resistanceDamageMultiplier;
+ @Getter
+ private static double blockingDamageReduction;
+ public MobCombatSettingsConfig() {
+ super("MobCombatSettings.yml");
}
+ @Override
+ public void initializeValues() {
+ doNaturalMobSpawning = ConfigurationEngine.setBoolean(
+ List.of("Sets if naturally spawned elites will spawn. Note: event mobs like the zombie king are not naturally spawned elites! You will have to disable events if you want to disable event bosses."),
+ fileConfiguration, "doNaturalEliteMobSpawning", true);
+ doSpawnersSpawnEliteMobs = ConfigurationEngine.setBoolean(
+ List.of("Sets if spawns spawned from mob spawners can be converted to elites. Not recommended!"),
+ fileConfiguration, "doSpawnersSpawnEliteMobs", false);
+ aggressiveMobConversionPercentage = ConfigurationEngine.setDouble(
+ List.of("Sets the percentage of naturally spawned mobs that get converted to elite mobs."),
+ fileConfiguration, "eliteMobsSpawnPercentage", 0.05);
+ superMobsStackRange = Math.max(ConfigurationEngine.setInt(
+ List.of("Sets the super mob range to scan for super mob stacking"),
+ fileConfiguration, "superMobStackRange", 15), 2);
+ naturalEliteMobLevelCap = ConfigurationEngine.setInt(
+ List.of("Sets the maximum level elites can spawn at.", "Note: elite mob level is based on what armor and weapons players are wearing, and armor only scales up to level 200."),
+ fileConfiguration, "naturalEliteMobsLevelCap", 250);
+ doEliteArmor = ConfigurationEngine.setBoolean(
+ List.of("Sets if elites will wear armor based on their level. This is for visual purposes only and does not affect combat."),
+ fileConfiguration, "doElitesWearArmor", true);
+ doEliteHelmets = ConfigurationEngine.setBoolean(
+ List.of("Sets if elites will wear helmets based on their level. This will prevent them from easily burning away during the daytime."),
+ fileConfiguration, "doElitesWearHelmets", true);
+ enableVisualEffectsForNaturalMobs = ConfigurationEngine.setBoolean(
+ List.of("Sets if elites will have visual trails around them warning players about what players they have."),
+ fileConfiguration, "doNaturalEliteMobVisualEffects", true);
+ disableVisualEffectsForSpawnerMobs = ConfigurationEngine.setBoolean(
+ List.of("Sets if elites spawned from spawners will do visual effects."),
+ fileConfiguration, "doSpawnerEliteMobVisualEffects", false);
+ enableWarningVisualEffects = ConfigurationEngine.setBoolean(
+ List.of("Sets if some powers will do the warning phase of the power. This is very important as warning phases usually mean the power can be dodged, and the visual lets players know where to dodge to."),
+ fileConfiguration, "doPowerBuildupVisualEffects", true);
+ enableDeathMessages = ConfigurationEngine.setBoolean(
+ List.of("Sets if custom death messages will be used when players die from elites."),
+ fileConfiguration, "doCustomEliteMobsDeathMessages", true);
+ displayHealthOnHit = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will show health indicators for elites."),
+ fileConfiguration, "doDisplayMobHealthOnHit", true);
+ displayDamageOnHit = ConfigurationEngine.setBoolean(
+ List.of("Sets if EliteMobs will show damage indicators for damage done to elites."),
+ fileConfiguration, "doDisplayMobDamageOnHit", true);
+ increaseDifficultyWithSpawnDistance = ConfigurationEngine.setBoolean(
+ List.of("Sets if the level of elites will increased based on the distance from spawn.",
+ "This is a value added on top of their normal level, meaning that if a player is wearing level 100 gear near spawn and the boss has +1 level due from the distanced from spawn, the boss will spawn at level 101.",
+ "This option is generally not recommended, especially if you have a random tp system on your server."),
+ fileConfiguration, "doIncreaseEliteMobLevelBasedOnSpawnDistance", false);
+ distanceToIncrement = ConfigurationEngine.setDouble(
+ List.of("Sets the distance between level increments for distance-based level increases."),
+ fileConfiguration, "distanceBetweenIncrements", 100);
+ levelToIncrement = ConfigurationEngine.setDouble(
+ List.of("Sets how many levels increase at each distance increment for distance-based level increases."),
+ fileConfiguration, "levelIncreaseAtIncrements", 1);
+ obfuscateMobPowers = ConfigurationEngine.setBoolean(
+ List.of("Sets if the powers of elites will be hidden until they enter combat. This is recommended for performance reasons."),
+ fileConfiguration, "hideEliteMobPowersUntilAggro", true);
+ damageToEliteMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier for the damage dealt to all bosses spawned by EliteMobs, except those using the normalized damage system (regional dungeon bosses). Higher values increase the damage dealt, making bosses easier to kill.", "2.0 = 200%, 0.5 = 50%"),
+ fileConfiguration, "damageToEliteMobMultiplierV2", 1);
+ damageToPlayerMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier for the damage dealt to players by elites. Higher values increase the amount of damage dealt by bosses, except those using the normalized damage system (regional dungeon bosses), making bosses hit harder.", "2.0 = 200%, 0.5 = 50%"),
+ fileConfiguration, "damageToPlayerMultiplierV2", 1);
+ showCustomBossLocation = ConfigurationEngine.setBoolean(
+ List.of("Sets if special bosses can be tracked."),
+ fileConfiguration, "showCustomBossLocation", true);
+ bossLocationMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players to track a boss location."),
+ file, fileConfiguration, "bossLocationMessage", "&7[EM] &2[Click to track!]", true);
+ //Accepts placeholders $players, $level and $name
+ commandsOnDeath = ConfigurationEngine.setList(
+ List.of("Sets the commands that run when an elite dies. Valid placeholders are:", "$level for the level of the boss", "$name for the name of the boss", "$players will make the command run for each player that participated in the kill. As an example, if Bob and Steve killed a boss, 'broadcast $players killed the boss!' will run 'bob killed the boss' and 'steve killed the boss!'"),
+ file, fileConfiguration, "commandsOnEliteMobDeath", Collections.emptyList(), false);
+ //Accepts placeholder $playerDamage
+ bossKillParticipationMessage = ConfigurationEngine.setString(
+ List.of("Sets teh message sent to players that participate in big boss kills."),
+ file, fileConfiguration, "bossKillParticipationMessage", "&eYour damage: &2$playerDamage", true);
+ regenerateCustomBossHealthOnCombatEnd = ConfigurationEngine.setBoolean(
+ List.of("Sets if bosses regenerate health when they go out of combat. Strongly recommended."),
+ fileConfiguration, "regenerateCustomBossHealthOnCombatEnd", true);
+ defaultOtherWorldBossLocationMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players that are trying to track bosses currently in a different world."),
+ file, fileConfiguration, "defaultOtherWorldBossLocationMessage", "$name: In different world!", true);
+ weakTextColor = ConfigurationEngine.setString(
+ List.of("Sets the prefix added to damage indicators when players hit a boss with something that boss is weak against."),
+ file, fileConfiguration, "weakTextColor", "&9", false);
+ resistTextColor = ConfigurationEngine.setString(
+ List.of("Sets the prefix added to damage indicators when players hit a boss with something that boss is strong against."),
+ file, fileConfiguration, "resistTextColor", "&c", false);
+ weakText = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when players hit the boss with something that boss is weak against."),
+ file, fileConfiguration, "weakText", "&9&lWeak!", true);
+ resistText = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when players hit the boss with something that boss is strong against."),
+ file, fileConfiguration, "resistText", "&c&lResist!", true);
+ doWeakEffect = ConfigurationEngine.setBoolean(
+ List.of("Sets if visuals will be used to show that a boss is weak against an attack."),
+ fileConfiguration, "doWeakEffect", true);
+ doResistEffect = ConfigurationEngine.setBoolean(
+ List.of("Sets if visuals will be used to show that a boss is strong against an attack."),
+ fileConfiguration, "doResistEffect", true);
+ normalizedDamageToEliteMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier for the damage dealt to bosses using the normalized damage system (regional dungeon bosses). Higher values increase the damage dealt, making bosses easier to kill.", "2.0 = 200%, 0.5 = 50%"),
+ fileConfiguration, "damageToEliteMobMultiplier", 1);
+ normalizedDamageToPlayerMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier for the damage dealt to players by bosses using the normalized damage system (regional dungeon bosses). Higher values increase the amount of damage dealt by bosses, making bosses hit harder.", "2.0 = 200%, 0.5 = 50%"),
+ fileConfiguration, "damageToPlayerMultiplier", 1);
+ normalizedBaselineDamage = ConfigurationEngine.setDouble(
+ List.of("Sets the baseline damage for custom bosses using the normalized damage (usually regional bosses)."),
+ fileConfiguration, "normalizedRegionalBossBaselineDamageV2", 3);
+ normalizedBaselineHealth = ConfigurationEngine.setDouble(
+ List.of("Sets the baseline health for custom bosses using the normalized health (usually regional bosses)."),
+ fileConfiguration, "normalizedRegionalBossBaselineHealthV3", 4);
+ normalizeRegionalBosses = ConfigurationEngine.setBoolean(
+ List.of("Sets if regional bosses will used the normalized combat system.", "This is very strongly recommended, and premade content will not be balanced properly if modified."),
+ fileConfiguration, "normalizeRegionalBosses", true);
+ fullHealMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when a boss heals from going out of combat."),
+ file, fileConfiguration, "fullHealMessage", "&2FULL HEAL!", true);
+ strengthAndWeaknessDamageMultipliers = ConfigurationEngine.setDouble(
+ List.of("Sets the multipliers applied to attacks bosses are strong and weak against."),
+ fileConfiguration, "strengthAndWeaknessDamageMultipliers", 2D);
+ resistanceDamageMultiplier = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier applied to damage reduction from the resistance potion effect for players."),
+ fileConfiguration, "resistanceDamageMultiplier", 1);
+ blockingDamageReduction = ConfigurationEngine.setDouble(
+ List.of("Sets the multiplier applied to damage reduction when a player is holding up a shield for melee attacks (powers excluded)."),
+ fileConfiguration, "blockingDamageReduction", 0.8);
+ }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/MobPowersConfig.java b/src/main/java/com/magmaguy/elitemobs/config/MobPowersConfig.java
deleted file mode 100644
index 045da3623..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/MobPowersConfig.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-/**
- * Created by MagmaGuy on 01/05/2017.
- */
-public class MobPowersConfig {
-
- public static final String CONFIG_NAME = "MobPowers.yml";
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- private static final String POWERS = "Powers.";
- private static final String DEFENSIVE_POWERS = POWERS + "Defensive Powers.";
- private static final String OFFENSIVE_POWERS = POWERS + "Offensive Powers.";
- private static final String MISCELLANEOUS_POWERS = POWERS + "Miscellaneous Powers.";
- private static final String MAJOR_POWERS = POWERS + "Major Powers.";
-
- public static final String ATTACK_ARROW = OFFENSIVE_POWERS + "AttackArrow";
- public static final String ATTACK_BLINDING = OFFENSIVE_POWERS + "AttackBlinding";
- public static final String ATTACK_CONFUSING = OFFENSIVE_POWERS + "AttackConfusing";
- public static final String ATTACK_FIRE = OFFENSIVE_POWERS + "AttackFire";
- public static final String ATTACK_FIREBALL = OFFENSIVE_POWERS + "AttackFireball";
- public static final String ATTACK_FREEZE = OFFENSIVE_POWERS + "AttackFreeze";
- public static final String ATTACK_GRAVITY = OFFENSIVE_POWERS + "AttackGravity";
- public static final String ATTACK_POISON = OFFENSIVE_POWERS + "AttackPoison";
- public static final String ATTACK_PUSH = OFFENSIVE_POWERS + "AttackPush";
- public static final String ATTACK_WEAKNESS = OFFENSIVE_POWERS + "AttackWeakness";
- public static final String ATTACK_WEB = OFFENSIVE_POWERS + "AttackWeb";
- public static final String ATTACK_WITHER = OFFENSIVE_POWERS + "AttackWither";
-
- public static final String INVISIBILITY = DEFENSIVE_POWERS + "Invisibility";
- public static final String INVULNERABILITY_ARROW = DEFENSIVE_POWERS + "InvulnerabilityArrow";
- public static final String INVULNERABILITY_FALL_DAMAGE = DEFENSIVE_POWERS + "InvulnerabilityFallDamage";
- public static final String INVULNERABILITY_FIRE = DEFENSIVE_POWERS + "InvulnerabilityFire";
- public static final String INVULNERABILITY_KNOCKBACK = DEFENSIVE_POWERS + "InvulnerabilityKnockback";
-
- public static final String BONUS_LOOT = MISCELLANEOUS_POWERS + "BonusLoot";
- public static final String MOVEMENT_SPEED = MISCELLANEOUS_POWERS + "MovementSpeed";
- public static final String TAUNT = MISCELLANEOUS_POWERS + "Taunt";
-
- public static final String SKELETON_PILLAR = MAJOR_POWERS + "SkeletonPillar";
- public static final String SKELETON_TRACKING_ARROW = MAJOR_POWERS + "SkeletonTrackingArrow";
- public static final String ZOMBIE_BLOAT = MAJOR_POWERS + "ZombieBloat";
- public static final String ZOMBIE_FRIENDS = MAJOR_POWERS + "ZombieFriends";
- public static final String ZOMBIE_NECRONOMICON = MAJOR_POWERS + "ZombieNecronomicon";
- public static final String ZOMBIE_PARENTS = MAJOR_POWERS + "ZombieParents";
- public static final String ZOMBIE_TEAM_ROCKET = MAJOR_POWERS + "ZombieTeamRocket";
-
- public static final String FROZEN_MESSAGE = "Freeze power message";
-
- public void initializeConfig() {
-
- configuration.addDefault(ATTACK_ARROW, true);
- configuration.addDefault(ATTACK_BLINDING, true);
- configuration.addDefault(ATTACK_CONFUSING, true);
- configuration.addDefault(ATTACK_FIRE, true);
- configuration.addDefault(ATTACK_FIREBALL, true);
- configuration.addDefault(ATTACK_FREEZE, true);
- configuration.addDefault(ATTACK_GRAVITY, true);
- configuration.addDefault(ATTACK_POISON, true);
- configuration.addDefault(ATTACK_PUSH, true);
- configuration.addDefault(ATTACK_WEAKNESS, true);
- configuration.addDefault(ATTACK_WEB, true);
- configuration.addDefault(ATTACK_WITHER, true);
-
- configuration.addDefault(INVISIBILITY, true);
- configuration.addDefault(INVULNERABILITY_ARROW, true);
- configuration.addDefault(INVULNERABILITY_FALL_DAMAGE, true);
- configuration.addDefault(INVULNERABILITY_FIRE, true);
- configuration.addDefault(INVULNERABILITY_KNOCKBACK, true);
-
- configuration.addDefault(BONUS_LOOT, true);
- configuration.addDefault(MOVEMENT_SPEED, true);
- configuration.addDefault(TAUNT, true);
- configuration.addDefault(SKELETON_PILLAR, true);
- configuration.addDefault(SKELETON_TRACKING_ARROW, true);
- configuration.addDefault(ZOMBIE_BLOAT, true);
- configuration.addDefault(ZOMBIE_FRIENDS, true);
- configuration.addDefault(ZOMBIE_NECRONOMICON, true);
- configuration.addDefault(ZOMBIE_PARENTS, true);
- configuration.addDefault(ZOMBIE_TEAM_ROCKET, true);
-
- configuration.addDefault(FROZEN_MESSAGE, "&9You've been frozen!");
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java
new file mode 100644
index 000000000..0114dfdaf
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/ModelsConfig.java
@@ -0,0 +1,20 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+
+import java.util.List;
+
+public class ModelsConfig extends ConfigurationFile {
+ public static String treasureChest;
+
+ public ModelsConfig() {
+ super("Models.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ treasureChest = ConfigurationEngine.setString(
+ List.of("Name of the custom model for the treasure chest"),
+ file, fileConfiguration, "treasureChest", "elitemobs_treasure_chest", false);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/PlayerCacheData.java b/src/main/java/com/magmaguy/elitemobs/config/PlayerCacheData.java
deleted file mode 100644
index b2d107ad6..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/PlayerCacheData.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-/**
- * Created by MagmaGuy on 02/07/2017.
- */
-public class PlayerCacheData {
-
- public static final String CONFIG_NAME = "playerCache.yml";
- public CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- public Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME, true);
-
- public void initializeConfig() {
-
- //no real defaults, just a data file
- customConfigLoader.getCustomConfig(CONFIG_NAME, true).options().copyDefaults(true);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME, true);
- customConfigLoader.saveCustomConfig(CONFIG_NAME, true);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/PlayerGuildRank.java b/src/main/java/com/magmaguy/elitemobs/config/PlayerGuildRank.java
deleted file mode 100644
index e5c9ebe9c..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/PlayerGuildRank.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-public class PlayerGuildRank {
-
- public static final String CONFIG_NAME = "playerGuildRank.yml";
- public CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- public Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME, true);
-
- public void intializeConfig() {
-
- //no real defaults, just a data file
- customConfigLoader.getCustomConfig(CONFIG_NAME, true).options().copyDefaults(true);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME, true);
- customConfigLoader.saveCustomConfig(CONFIG_NAME, true);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/PlayerMaxGuildRank.java b/src/main/java/com/magmaguy/elitemobs/config/PlayerMaxGuildRank.java
deleted file mode 100644
index a8aa2cbfe..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/PlayerMaxGuildRank.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-public class PlayerMaxGuildRank {
-
- public static final String CONFIG_NAME = "playerMaxGuildRank.yml";
- public CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- public Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME, true);
-
- public void intializeConfig() {
-
- //no real defaults, just a data file
- customConfigLoader.getCustomConfig(CONFIG_NAME, true).options().copyDefaults(true);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME, true);
- customConfigLoader.saveCustomConfig(CONFIG_NAME, true);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/PlayerMoneyData.java b/src/main/java/com/magmaguy/elitemobs/config/PlayerMoneyData.java
deleted file mode 100644
index 3d29906d4..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/PlayerMoneyData.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-/**
- * Created by MagmaGuy on 17/06/2017.
- */
-public class PlayerMoneyData {
-
- public static final String CONFIG_NAME = "playerMoneyData.yml";
- public CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- public Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME, true);
-
- public void intializeConfig() {
-
- //no real defaults, just a data file
- customConfigLoader.getCustomConfig(CONFIG_NAME, true).options().copyDefaults(true);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME, true);
- customConfigLoader.saveCustomConfig(CONFIG_NAME, true);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java
new file mode 100644
index 000000000..c49ca5e92
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/ProceduralItemGenerationSettingsConfig.java
@@ -0,0 +1,1465 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.elitemobs.items.itemconstructor.MaterialGenerator;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+import org.bukkit.Material;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ProceduralItemGenerationSettingsConfig extends ConfigurationFile {
+ @Getter
+ private static final List validMaterials = new ArrayList<>();
+ @Getter
+ private
+ static boolean doProceduralItemDrops;
+ @Getter
+ private static double customEnchantmentChance;
+ @Getter
+ private static String swordName;
+ @Getter
+ private static String bowName;
+ @Getter
+ private static String pickaxeName;
+ @Getter
+ private static String spadeName;
+ @Getter
+ private static String hoeName;
+ @Getter
+ private static String axeName;
+ @Getter
+ private static String helmetName;
+ @Getter
+ private static String chestplateName;
+ @Getter
+ private static String leggingsName;
+ @Getter
+ private static String bootsName;
+ @Getter
+ private static String shearsName;
+ @Getter
+ private static String fishingRodName;
+ @Getter
+ private static String shieldName;
+ @Getter
+ private static String tridentName;
+ @Getter
+ private static String crossbowName;
+ @Getter
+ private static List nameFormat;
+ @Getter
+ private static List nouns;
+ @Getter
+ private static List adjectives;
+ @Getter
+ private static List verbs;
+ @Getter
+ private static List verbers;
+ @Getter
+ private static ProceduralItemGenerationSettingsConfig instance;
+
+ public ProceduralItemGenerationSettingsConfig() {
+ super("ProceduralItemGenerationSettings.yml");
+ }
+
+ private void addMaterial(Material material) {
+ ConfigurationEngine.setBoolean(fileConfiguration, "validMaterials." + material.name(), true);
+ }
+
+ public void cacheMaterials() {
+ validMaterials.clear();
+ for (String material : fileConfiguration.getConfigurationSection("validMaterials").getKeys(false))
+ if (fileConfiguration.getConfigurationSection("validMaterials").getBoolean(material))
+ validMaterials.add(material);
+ }
+
+
+ @Override
+ public void initializeValues() {
+ instance = this;
+
+ doProceduralItemDrops = ConfigurationEngine.setBoolean(fileConfiguration, "dropProcedurallyGeneratedItems", true);
+ customEnchantmentChance = ConfigurationEngine.setDouble(fileConfiguration, "customEnchantmentsChance", 0.5);
+
+ addMaterial(Material.DIAMOND_HELMET);
+ addMaterial(Material.DIAMOND_CHESTPLATE);
+ addMaterial(Material.DIAMOND_LEGGINGS);
+ addMaterial(Material.DIAMOND_BOOTS);
+
+ addMaterial(Material.DIAMOND_SWORD);
+ addMaterial(Material.DIAMOND_AXE);
+
+
+ addMaterial(Material.IRON_HELMET);
+ addMaterial(Material.IRON_CHESTPLATE);
+ addMaterial(Material.IRON_LEGGINGS);
+ addMaterial(Material.IRON_BOOTS);
+
+ addMaterial(Material.IRON_SWORD);
+ addMaterial(Material.IRON_AXE);
+
+
+ addMaterial(Material.GOLDEN_HELMET);
+ addMaterial(Material.GOLDEN_CHESTPLATE);
+ addMaterial(Material.GOLDEN_LEGGINGS);
+ addMaterial(Material.GOLDEN_BOOTS);
+
+ addMaterial(Material.GOLDEN_SWORD);
+ addMaterial(Material.GOLDEN_AXE);
+
+
+ addMaterial(Material.CHAINMAIL_HELMET);
+ addMaterial(Material.CHAINMAIL_CHESTPLATE);
+ addMaterial(Material.CHAINMAIL_LEGGINGS);
+ addMaterial(Material.CHAINMAIL_BOOTS);
+
+
+ addMaterial(Material.LEATHER_HELMET);
+ addMaterial(Material.LEATHER_CHESTPLATE);
+ addMaterial(Material.LEATHER_LEGGINGS);
+ addMaterial(Material.LEATHER_BOOTS);
+
+
+ addMaterial(Material.STONE_SWORD);
+ addMaterial(Material.STONE_AXE);
+
+
+ addMaterial(Material.WOODEN_SWORD);
+ addMaterial(Material.WOODEN_AXE);
+
+
+ addMaterial(Material.SHIELD);
+ addMaterial(Material.TURTLE_HELMET);
+ addMaterial(Material.TRIDENT);
+ addMaterial(Material.BOW);
+ addMaterial(Material.CROSSBOW);
+
+ cacheMaterials();
+
+ swordName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.swordName", "Sword", true);
+ bowName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.bowName", "Bow", true);
+ pickaxeName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.pickaxe", "Pickaxe", true);
+ spadeName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.spade", "Spade", true);
+ hoeName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.hoe", "Hoe", true);
+ axeName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.axe", "Axe", true);
+ helmetName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.helmet", "Helmet", true);
+ chestplateName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.chestplate", "Chestplate", true);
+ leggingsName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.leggings", "Leggings", true);
+ bootsName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.boots", "Boots", true);
+ shearsName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.shears", "Shears", true);
+ fishingRodName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.fishingRod", "Fishing Rod", true);
+ shieldName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.shield", "Shield", true);
+ tridentName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.trident", "Trident", true);
+ crossbowName = ConfigurationEngine.setString(file, fileConfiguration, "materialNames.crossbow", "Crossbow", true);
+
+ nameFormat = ConfigurationEngine.setList(file, fileConfiguration, "nameFormats", new ArrayList<>(List.of(
+ "$verb $itemType of the $adjective $noun",
+ "$itemType of the $adjective $noun",
+ "$noun's $adjective $verb $itemType",
+ "$verb $itemType",
+ "$adjective $verb $itemType",
+ "The $verb-er",
+ "The $adjective $verb-er"
+ )), true);
+
+ nouns = ConfigurationEngine.setList(file, fileConfiguration, "nouns", new ArrayList<>(List.of(
+ "MagmaGuy",
+ "Dawn",
+ "Sunset",
+ "Heaven",
+ "Hell",
+ "Angel",
+ "Archangel",
+ "Cherub",
+ "Seraph",
+ "Demon",
+ "Fiend",
+ "Bat",
+ "Chicken",
+ "Cow",
+ "Mooshroom",
+ "Pig",
+ "Rabbit",
+ "Sheep",
+ "Squid",
+ "Villager",
+ "Cave Spider",
+ "Enderman",
+ "Polar Bear",
+ "Spider",
+ "Zombie Pigman",
+ "Blaze",
+ "Creeper",
+ "Elder Guardian",
+ "Endermite",
+ "Evoker",
+ "Ghast",
+ "Guardian",
+ "Husk",
+ "Magma Cube",
+ "Shulker",
+ "Silverfish",
+ "Skeleton",
+ "Slime",
+ "Stray",
+ "Vex",
+ "Vindicator",
+ "Witch",
+ "Wither Skeleton",
+ "Zombie",
+ "Donkey",
+ "Horse",
+ "Llama",
+ "Mule",
+ "Ocelot",
+ "Wolf",
+ "Iron Golem",
+ "Snow Golem",
+ "Ender Dragon",
+ "Wither",
+ "Illusioner",
+ "Parrot",
+ "Giant",
+ "Killer Bunny",
+ "Steve",
+ "Wolfbane",
+ "Chaos",
+ "Aeon",
+ "Dragon",
+ "Sphynx",
+ "Minotaur",
+ "Hades",
+ "Oath",
+ "Oathbreaker",
+ "Deserter",
+ "Betrayer",
+ "Jade",
+ "Light",
+ "Darkness",
+ "Oblivion",
+ "Shadow",
+ "Void",
+ "Xeno",
+ "Zealot",
+ "Zenith",
+ "Dusk",
+ "Twilight",
+ "Mob",
+ "Elite Mob",
+ "Urist",
+ "Dwarf",
+ "Elf",
+ "Ork",
+ "Goblin",
+ "Gnome",
+ "Goliath",
+ "Drow",
+ "Human",
+ "Halfling",
+ "Half-Orc",
+ "Beholder",
+ "Mind Flayer",
+ "Owlbear",
+ "Bulette",
+ "Rust Monster",
+ "Hill Giant",
+ "Stone Giant",
+ "Frost Giant",
+ "Fire Giant",
+ "Cloud Giant",
+ "Storm Giant",
+ "Kobold",
+ "Lich",
+ "Ork",
+ "Umber Hulk",
+ "Fighter",
+ "Wizard",
+ "Paladin",
+ "Cleric",
+ "Ranger",
+ "Archer",
+ "Mage",
+ "Tiefling",
+ "Werewolf",
+ "Vampire",
+ "Centaur",
+ "Catfolk",
+ "Half-Giant",
+ "Ogre",
+ "Troll",
+ "Rogue",
+ "Barbarian",
+ "Bard",
+ "Druid",
+ "Monk",
+ "Sorcerer",
+ "Warlock",
+ "Demon Hunter",
+ "Death Knight",
+ "Priest",
+ "Shaman",
+ "Warrior",
+ "Basilisk",
+ "Chimera",
+ "Imp",
+ "Dryad",
+ "Gargoyle",
+ "Djinni",
+ "Efreeti",
+ "Ghost",
+ "Hobgoblin",
+ "Hydra",
+ "Kraken",
+ "Lamia",
+ "Medusa",
+ "Mimic",
+ "Mummy",
+ "Pegasus",
+ "Roc",
+ "Satyr",
+ "Tarrasque",
+ "Abomination",
+ "Ghoul",
+ "Treant",
+ "Unicorn",
+ "Wraith",
+ "Acolyte",
+ "Gladiator",
+ "Knight",
+ "Gryphon",
+ "Raider",
+ "Scout",
+ "Spy",
+ "Thg",
+ "Noble",
+ "Guard",
+ "Veteran",
+ "Wyvern",
+ "Abyssal",
+ "Infernal",
+ "Elemental",
+ "Tauren",
+ "Pandaren",
+ "Sasquatch",
+ "Forsaken",
+ "Yeti",
+ "Banshee",
+ "Arachnid",
+ "Undead",
+ "Night Elf",
+ "Blood Elf",
+ "Draenei",
+ "Worgen",
+ "Warlord",
+ "Witch",
+ "Magi",
+ "Sage",
+ "Thief",
+ "Assassin",
+ "Templar",
+ "Beastmaster",
+ "Berserker",
+ "Inventor",
+ "Luchador",
+ "Pirate",
+ "Vanguard",
+ "Voidblade",
+ "Wisp",
+ "Peasant",
+ "Footman",
+ "Swordsman",
+ "Thrall",
+ "Felhound",
+ "Huntress",
+ "Hunter",
+ "Aarakorcra",
+ "Aboleth",
+ "Deva",
+ "Planetar",
+ "Solar",
+ "Ankheg",
+ "Azer",
+ "Behir",
+ "Death Tyrant",
+ "Blight",
+ "Bugbear",
+ "Hugbear",
+ "Bullywug",
+ "Cambion",
+ "Chuul",
+ "Lich King",
+ "Cockatrice",
+ "Couatl",
+ "Cyclops",
+ "Titan",
+ "Darkmantle",
+ "Ancient One",
+ "Demilich",
+ "Balor",
+ "Barlgura",
+ "Chasme",
+ "Dretch",
+ "Glabrezu",
+ "Goristro",
+ "Hezrou",
+ "Manes",
+ "Marilith",
+ "Nalfeshnee",
+ "Quasit",
+ "Vrock",
+ "Yochlol",
+ "Pit Fiend",
+ "Lemure",
+ "Dracolich",
+ "Doppleganger",
+ "Chromatic Dragon",
+ "Drider",
+ "Air Elemental",
+ "Earth Elemental",
+ "Fire Elemental",
+ "Water Elemental",
+ "Rohirrim",
+ "Gondorian",
+ "Empyrean",
+ "Faerie Dragon",
+ "Ettin",
+ "Flumph",
+ "Fomorian",
+ "Dao",
+ "Gnoll",
+ "Parshendi",
+ "Listener",
+ "Spren",
+ "Stormfather",
+ "Rosharian",
+ "Brightlord",
+ "Highprince",
+ "King",
+ "Emperor",
+ "Shardbearer",
+ "Surgebinder",
+ "Bondsmith",
+ "Golem",
+ "Gorgon",
+ "Hag",
+ "Harpy",
+ "Hippogriff",
+ "Homunculus",
+ "State Alchemist",
+ "Undying Soldier",
+ "Jackalwere",
+ "Nothic",
+ "Oni",
+ "Rakshasa",
+ "Revenant",
+ "Cultist"
+ )), true);
+
+ adjectives = ConfigurationEngine.setList(file, fileConfiguration, "adjectives", new ArrayList<>(List.of(
+ "Adorable",
+ "Beautiful",
+ "Clean",
+ "Elegant",
+ "Fancy",
+ "Glamorous",
+ "Handsome",
+ "Long",
+ "Magnificent",
+ "Plain",
+ "Quaint",
+ "Sparkling",
+ "Ugliest",
+ "Red",
+ "Orange",
+ "Yellow",
+ "Green",
+ "Blue",
+ "Purple",
+ "Gray",
+ "Black",
+ "White",
+ "Dead",
+ "Odd",
+ "Powerful",
+ "Rich",
+ "Vast",
+ "Zealous",
+ "Deafening",
+ "Faint",
+ "Melodic",
+ "Quiet",
+ "Thundering",
+ "Whispering",
+ "Hissing",
+ "Ancient",
+ "Fast",
+ "Old",
+ "Rapid",
+ "Slow",
+ "Rotten",
+ "Creepy",
+ "Crooked",
+ "Empty",
+ "Heavy",
+ "Abhorrent",
+ "Abnormal",
+ "Absurd",
+ "Acceptable",
+ "Accidental",
+ "Adamant",
+ "Adventurous",
+ "Agonizing",
+ "Alert",
+ "Annoyed",
+ "Annoying",
+ "Anxious",
+ "Aromatic",
+ "Aggressive",
+ "Aloof",
+ "Amazing",
+ "Ambiguous",
+ "Ambitious",
+ "Amused",
+ "Angry",
+ "Arrogant",
+ "Ashamed",
+ "Aspiring",
+ "Astonishing",
+ "Auspicious",
+ "Average",
+ "Awesome",
+ "Awful",
+ "Bad",
+ "Barbarous",
+ "Bashful",
+ "Beffiting",
+ "Belligerent",
+ "Beneficial",
+ "Berserk",
+ "Best",
+ "Bewildered",
+ "Big",
+ "Bitter",
+ "Bizarre",
+ "Bloody",
+ "Boiling",
+ "Boundless",
+ "Brash",
+ "Brave",
+ "Brawny",
+ "Breakable",
+ "Brief",
+ "Bright",
+ "Broken",
+ "Busy",
+ "Calculating",
+ "Callous",
+ "Calm",
+ "Capricious",
+ "Careful",
+ "Careless",
+ "Caring",
+ "Cautious",
+ "Ceaseless",
+ "Certain",
+ "Charming",
+ "Cheap",
+ "Chief",
+ "Chilly",
+ "Chivalrous",
+ "Chunky",
+ "Clear",
+ "Clever",
+ "Cloistered",
+ "Clumsy",
+ "Cloudy",
+ "Classy",
+ "Colossal",
+ "Combative",
+ "Common",
+ "Confused",
+ "Condemned",
+ "Cool",
+ "Courageous",
+ "Cowardly",
+ "Crazy",
+ "Craven",
+ "Cruel",
+ "Cuddly",
+ "Curious",
+ "Cute",
+ "Damaged",
+ "Damaging",
+ "Dangerous",
+ "Dark",
+ "Dashing",
+ "Decisive",
+ "Deep",
+ "Defeated",
+ "Defective",
+ "Defiant",
+ "Delicate",
+ "Delicious",
+ "Delightful",
+ "Demonic",
+ "Delirious",
+ "Deranged",
+ "Descriptive",
+ "Devilish",
+ "Difficult",
+ "Diligent",
+ "Direful",
+ "Dirty",
+ "Disastrous",
+ "Disgusted",
+ "Disgusting",
+ "Disillusioned",
+ "Distinct",
+ "Disturbed",
+ "Draconian",
+ "Dramatic",
+ "Dreary",
+ "Dysfunctional",
+ "Eager",
+ "Elderly",
+ "Electric",
+ "Elite",
+ "Enchanted",
+ "Enchanting",
+ "Energetic",
+ "Enormous",
+ "Entertaining",
+ "Enthusiastic",
+ "Envious",
+ "Erratic",
+ "Ethereal",
+ "Evasive",
+ "Excellent",
+ "Excited",
+ "Exciting",
+ "Exotic",
+ "Exuberant",
+ "Fabulous",
+ "Faded",
+ "Fair",
+ "Faithful",
+ "False",
+ "Familiar",
+ "Famous",
+ "Fanatical",
+ "Fantastic",
+ "Fascinated",
+ "Fat",
+ "Fearful",
+ "Fearless",
+ "Feeble",
+ "Festive",
+ "Fierce",
+ "Filthy",
+ "Fine",
+ "Finicky",
+ "First",
+ "Fixed",
+ "Flashy",
+ "Flawless",
+ "Flimsy",
+ "Flippant",
+ "Flowery",
+ "Fluffy",
+ "Fluttering",
+ "Foamy",
+ "Foolish",
+ "Forgetful",
+ "Fortunate",
+ "Frail",
+ "Fragile",
+ "Frantic",
+ "Free",
+ "Freezing",
+ "Fresh",
+ "Friendly",
+ "Frightening",
+ "Fumbling",
+ "Funny",
+ "Furry",
+ "Furtive",
+ "Fuzzy",
+ "Giant",
+ "Gifted",
+ "Gigantic",
+ "Glistening",
+ "Glorious",
+ "Godly",
+ "Good",
+ "Goofy",
+ "Gorgeous",
+ "Graceful",
+ "Grandiose",
+ "Grateful",
+ "Greasy",
+ "Great",
+ "Greedy",
+ "Grieving",
+ "Groovy",
+ "Grotesque",
+ "Grubby",
+ "Gruesome",
+ "Grumpy",
+ "Guarded",
+ "Guiltless",
+ "Gullible",
+ "Gutsy",
+ "Guttural",
+ "Hallowed",
+ "Hanging",
+ "Hapless",
+ "Happy",
+ "Harmonious",
+ "Hateful",
+ "Healthy",
+ "Heartbreaking",
+ "Heavenly",
+ "Hellish",
+ "Helpful",
+ "Helpless",
+ "Hesitant",
+ "Hideous",
+ "Hilarious",
+ "Hollow",
+ "Homeless",
+ "Honorable",
+ "Horrible",
+ "Hospitable",
+ "Huge",
+ "Hulking",
+ "Humorous",
+ "Hungry",
+ "Hurt",
+ "Hushed",
+ "Hypnotic",
+ "Hysterical",
+ "Icky",
+ "Icy",
+ "Ignorant",
+ "Ill",
+ "Illegal",
+ "Illustrious",
+ "Imaginary",
+ "Immense",
+ "Imminent",
+ "Impartial",
+ "Imperfect",
+ "Impolite",
+ "Important",
+ "Incandescent",
+ "Incompetent",
+ "Industrious",
+ "Incredible",
+ "Inexpensive",
+ "Infamous",
+ "Innocent",
+ "Inquisitive",
+ "Insidious",
+ "Instinctive",
+ "Intelligent",
+ "Interesting",
+ "Invincible",
+ "Irate",
+ "Itchy",
+ "Jaded",
+ "Jagged",
+ "Jealous",
+ "Jolly",
+ "Joyous",
+ "Jumpy",
+ "Juvenile",
+ "Keen",
+ "Kind",
+ "Kindhearted",
+ "Knowing",
+ "Knowledgeable",
+ "Known",
+ "Labored",
+ "Lame",
+ "Large",
+ "Last",
+ "Late",
+ "Laughable",
+ "Lazy",
+ "Lean",
+ "Lethal",
+ "Light",
+ "Little",
+ "Living",
+ "Lonely",
+ "Loud",
+ "Lovely",
+ "Lucky",
+ "Magenta",
+ "Magical",
+ "Majestic",
+ "Malicious",
+ "Marked",
+ "Massive",
+ "Marvelous",
+ "Mean",
+ "Medical",
+ "Melted",
+ "Messy",
+ "Mighty",
+ "Military",
+ "Mindless",
+ "Minor",
+ "Misty",
+ "Mixed",
+ "Modern",
+ "Motionless",
+ "Mysterious",
+ "Naive",
+ "Narrow",
+ "Natural",
+ "Neat",
+ "Necessary",
+ "Needless",
+ "Needy",
+ "Nervous",
+ "New",
+ "Nice",
+ "Normal",
+ "Nostalgic",
+ "Numberless",
+ "Obsolete",
+ "Obtainable",
+ "Oceanic",
+ "Old-fashioned",
+ "Omniscient",
+ "Optimal",
+ "Ordinary",
+ "Organic",
+ "Outstanding",
+ "Oval",
+ "Overrated",
+ "Painful",
+ "Parallel",
+ "Pathetic",
+ "Peaceful",
+ "Penitent",
+ "Perfect",
+ "Periodic",
+ "Petite",
+ "Physical",
+ "Pink",
+ "Plastic",
+ "Pleasant",
+ "Pointless",
+ "Polite",
+ "Poor",
+ "Precious",
+ "Premium",
+ "Present",
+ "Pretty",
+ "Private",
+ "Productive",
+ "Protective",
+ "Public",
+ "Puzzling",
+ "Questionable",
+ "Quick",
+ "Quickest",
+ "Rare",
+ "Ready",
+ "Real",
+ "Rebel",
+ "Regular",
+ "Remarkable",
+ "Responsible",
+ "Romantic",
+ "Round",
+ "Royal",
+ "Sad",
+ "Safe",
+ "Salty",
+ "Satisfying",
+ "Scared",
+ "Scary",
+ "Scientific",
+ "Scrawny",
+ "Screeching",
+ "Second",
+ "Second-hand",
+ "Secret",
+ "Selfish",
+ "Sequacious",
+ "Serious",
+ "Shallow",
+ "Sharp",
+ "Shiny",
+ "Shocking",
+ "Short",
+ "Shy",
+ "Sick",
+ "Silent",
+ "Silky",
+ "Silly",
+ "Simple",
+ "Skinny",
+ "Slim",
+ "Slimy",
+ "Slippery",
+ "Small",
+ "Smart",
+ "Smiling",
+ "Smooth",
+ "Sneaky",
+ "Soft",
+ "Solid",
+ "Special",
+ "Spectacular",
+ "Spicy",
+ "Spiky",
+ "Splendid",
+ "Spooky",
+ "Spotless",
+ "Square",
+ "Staking",
+ "Standing",
+ "Steady",
+ "Sticky",
+ "Strange",
+ "Striped",
+ "Strong",
+ "Successful",
+ "Super",
+ "Supreme",
+ "Sweet",
+ "Talented",
+ "Tall",
+ "Tasty",
+ "Temporary",
+ "Tense",
+ "Terrible",
+ "Terrific",
+ "Tested",
+ "Thankful",
+ "Thick",
+ "Thin",
+ "Thirsty",
+ "Thoughtful",
+ "Tiny",
+ "Tired",
+ "Tricky",
+ "Troubled",
+ "True",
+ "Ugly",
+ "Ultra",
+ "Unadvised",
+ "Unarmed",
+ "Uncovered",
+ "Unhealthy",
+ "Unique",
+ "Unknown",
+ "Unnatural",
+ "Unused",
+ "Unusual",
+ "Used",
+ "Useful",
+ "Useless",
+ "Valuable",
+ "Violent",
+ "Waiting",
+ "Wandering",
+ "Warm",
+ "Weak",
+ "Wealthy",
+ "Whole",
+ "Wise",
+ "Wonderful",
+ "Wooden",
+ "Worried",
+ "Worthless",
+ "Wrong",
+ "Menacing",
+ "Trusting",
+ "Unassuming",
+ "Threatening"
+ )), true);
+
+ verbs = ConfigurationEngine.setList(file, fileConfiguration, "verbs", new ArrayList<>(List.of(
+ "Slashing",
+ "Cutting",
+ "Stabbing",
+ "Scratching",
+ "Killing",
+ "Slaying",
+ "Butchering",
+ "Destroying",
+ "Tickling",
+ "Hugging",
+ "Murdering",
+ "Slapping",
+ "Hissing",
+ "Traveling",
+ "Teleporting",
+ "Blinking",
+ "Destroying",
+ "Wrecking",
+ "Flashing",
+ "Materializing",
+ "Spawning",
+ "Questioning",
+ "Inquiring",
+ "Pleading",
+ "Demanding",
+ "Interrogating",
+ "Querying",
+ "Assaulting",
+ "Striking",
+ "Ambushing",
+ "Assailing",
+ "Rushing",
+ "Storming",
+ "Bombarding",
+ "Barraging",
+ "Smiting",
+ "Charging",
+ "Clobbering",
+ "Battling",
+ "Battering",
+ "Hammering",
+ "Beating",
+ "Combating",
+ "Overwhelming",
+ "Raiding",
+ "Tackling",
+ "Shooting",
+ "Venturing",
+ "Cracking",
+ "Rupturing",
+ "Smashing",
+ "Shattering",
+ "Fracturing",
+ "Splintering",
+ "Pulverizing",
+ "Tearing",
+ "Rending",
+ "Snapping",
+ "Bursting",
+ "Exploding",
+ "Damaging",
+ "Fragmenting",
+ "Splitting",
+ "Fortifying",
+ "Nudging",
+ "Tapping",
+ "Jostling",
+ "Thumping",
+ "Butting",
+ "Clattering",
+ "Striking",
+ "Whacking",
+ "Slamming",
+ "Summoning",
+ "Screaming",
+ "Bellowing",
+ "Roaring",
+ "Shifting",
+ "Transforming",
+ "Modifying",
+ "Twisting",
+ "Mutating",
+ "Distorting",
+ "Blurring",
+ "Adjusting",
+ "Warping",
+ "Altering",
+ "Adapting",
+ "Evolving",
+ "Varying",
+ "Hunting",
+ "Trailing",
+ "Following",
+ "Stalking",
+ "Shadowing",
+ "Hounding",
+ "Casing",
+ "Mounting",
+ "Ascending",
+ "Rising",
+ "Heaving",
+ "Springing",
+ "Cresting",
+ "Gathering",
+ "Corralling",
+ "Hoarding",
+ "Reaping",
+ "Harvesting",
+ "Saving",
+ "Sheltering",
+ "Cloaking",
+ "Shrouding",
+ "Enclosing",
+ "Concealing",
+ "Hiding",
+ "Disguising",
+ "Masking",
+ "Burying",
+ "Smothering",
+ "Clouding",
+ "Shielding",
+ "Shading",
+ "Sealing",
+ "Enveloping",
+ "Veiling",
+ "Obscuring",
+ "Traversing",
+ "Fording",
+ "Gliding",
+ "Howling",
+ "Whimpering",
+ "Screaming",
+ "Shrieking",
+ "Squealing",
+ "Roaring",
+ "Wailing",
+ "Bawling",
+ "Screeching",
+ "Cleaving",
+ "Chopping",
+ "Chipping",
+ "Severing",
+ "Slicing",
+ "Snipping",
+ "Splitting",
+ "Axing",
+ "Slashing",
+ "Rending",
+ "Tearing",
+ "Thinning",
+ "Cropping",
+ "Carving",
+ "Dissecting",
+ "Hacking",
+ "Piercing",
+ "Sawing",
+ "Shaving",
+ "Shearing",
+ "Mining",
+ "Delving",
+ "Excavating",
+ "Burrowing",
+ "Drilling",
+ "Hollowing",
+ "Gouging",
+ "Tunneling",
+ "Invading",
+ "Boarding",
+ "Wandering",
+ "Infiltrating",
+ "Intruding",
+ "Evading",
+ "Fleeing",
+ "Running",
+ "Dodging",
+ "Crashing",
+ "Battling",
+ "Tussling",
+ "Wrestling",
+ "Scuffling",
+ "Dueling",
+ "Brawling",
+ "Jousting",
+ "Sparring",
+ "Clashing",
+ "Warring",
+ "Grappling",
+ "Scrapping",
+ "Attacking",
+ "Feuding",
+ "Skirmishing",
+ "Discovering",
+ "Detecting",
+ "Catching",
+ "Solving",
+ "Revealing",
+ "Unearthing",
+ "Leaping",
+ "Bouncing",
+ "Springing",
+ "Vaulting",
+ "Hopping",
+ "Surging",
+ "Punting",
+ "Booting",
+ "Dropkicking",
+ "Sensing",
+ "Perceiving",
+ "Detecting",
+ "Fading",
+ "Bleeding",
+ "Shrinking",
+ "Weakening",
+ "Abating",
+ "Diminishing",
+ "Forging",
+ "Releasing",
+ "Gathering",
+ "Collecting",
+ "Culling",
+ "Crushing",
+ "Propelling",
+ "Jogging",
+ "Sprinting",
+ "Questing",
+ "Scouting",
+ "Exploring",
+ "Digging",
+ "Trembling",
+ "Rattling",
+ "Parting",
+ "Hacking",
+ "Rupturing",
+ "Carving",
+ "Dividing",
+ "Halving",
+ "Breaking",
+ "Sundering",
+ "Separating",
+ "Rending",
+ "Ripping",
+ "Grazing",
+ "Imprisoning",
+ "Snaring",
+ "Cornering",
+ "Entangling",
+ "Pinning",
+ "Catching",
+ "Restraining",
+ "Binding",
+ "Hooking",
+ "Snagging",
+ "Snatching",
+ "Caging",
+ "Capturing",
+ "Haunting",
+ "Creeping",
+ "Sneaking",
+ "Spying",
+ "Avenging",
+ "Storming"
+ )), true);
+
+ verbers = ConfigurationEngine.setList(file, fileConfiguration, "verb-ers (noun)", new ArrayList<>(List.of(
+ "World Breaker",
+ "World Shatterer",
+ "Avenger",
+ "Ashbringer",
+ "Windseeker",
+ "Defiler",
+ "Thunderfury",
+ "Slicer",
+ "Slasher",
+ "Cutter",
+ "Stabber",
+ "Scratcher",
+ "Killer",
+ "Slayer",
+ "Destroyer",
+ "Hugger",
+ "Murderer",
+ "Slapper",
+ "Traveller",
+ "Teleporter",
+ "Blinker",
+ "Wrecker",
+ "Materializer",
+ "Spawner",
+ "Demander",
+ "Assaulter",
+ "Striker",
+ "Ambusher",
+ "Rusher",
+ "Stormer",
+ "Bombarder",
+ "Barrager",
+ "Smiter",
+ "Charger",
+ "Battler",
+ "Hammerer",
+ "Beater",
+ "Combater",
+ "Overwhelmer",
+ "Raider",
+ "Tackler",
+ "Shooter",
+ "Venturer",
+ "Cracker",
+ "Smasher",
+ "Shatterer",
+ "Fracturer",
+ "Splinterer",
+ "Pulverizer",
+ "Tearer",
+ "Renderer",
+ "Snapper",
+ "Burster",
+ "Exploder",
+ "Damager",
+ "Fragmenter",
+ "Splitter",
+ "Fortifier",
+ "Nudger",
+ "Tapper",
+ "Thumper",
+ "Butter",
+ "Clatterer",
+ "Striker",
+ "Whacker",
+ "Slammer",
+ "Summoner",
+ "Screamer",
+ "Shifter",
+ "Transformer",
+ "Modifyer",
+ "Twister",
+ "Blurrer",
+ "Warper",
+ "Alterer",
+ "Adapter",
+ "Evolver",
+ "HunterEnchantment",
+ "Trailer",
+ "Follower",
+ "Stalker",
+ "Shadower",
+ "Hounder",
+ "Caser",
+ "Mounter",
+ "Ascender",
+ "Riser",
+ "Springer",
+ "Hoarder",
+ "Reaper",
+ "Harvester",
+ "Saver",
+ "Shelterer",
+ "Cloaker",
+ "Shrouder",
+ "Encloser",
+ "Hider",
+ "Masker",
+ "Buryer",
+ "Clouder",
+ "Shader",
+ "Sealer",
+ "Enveloper",
+ "Veiler",
+ "Traverser",
+ "Forder",
+ "Glider",
+ "Howler",
+ "Whimperer",
+ "Screamer",
+ "Squealer",
+ "Bawler",
+ "Screecher",
+ "Chopper",
+ "Chipper",
+ "Snipper",
+ "Splitter",
+ "Axer",
+ "Slasher",
+ "Renderer",
+ "Tearer",
+ "Thinner",
+ "Cropper",
+ "Carver",
+ "Hacker",
+ "Piercer",
+ "Sawer",
+ "Shaver",
+ "Shearer",
+ "Miner",
+ "Excavater",
+ "Burrower",
+ "Driller",
+ "Tunneler",
+ "Invader",
+ "Boarder",
+ "Wanderer",
+ "Intruder",
+ "Evader",
+ "Runner",
+ "Dodger",
+ "Crasher",
+ "Battler",
+ "Wrestler",
+ "Scuffler",
+ "Dueler",
+ "Brawler",
+ "Clasher",
+ "Grappler",
+ "Scrapper",
+ "Attacker",
+ "Feuder",
+ "Catcher",
+ "Solver",
+ "Revealer",
+ "Leaper",
+ "Bouncer",
+ "Vaulter",
+ "Hopper",
+ "Surger",
+ "Punter",
+ "Dropkicker",
+ "Perceiver",
+ "Fader",
+ "Bleeder",
+ "Weakener",
+ "Forger",
+ "Releaser",
+ "Gatherer",
+ "Crusher",
+ "Propeller",
+ "Jogger",
+ "Sprinter",
+ "Scouter",
+ "Explorer",
+ "Digger",
+ "Trembler",
+ "Parter",
+ "Hacker",
+ "Carver",
+ "Divider",
+ "Halver",
+ "Breaker",
+ "Renderer",
+ "Ripper",
+ "Grazer",
+ "Imprisoner",
+ "Cornerer",
+ "Pinner",
+ "Catcher",
+ "Restrainer",
+ "Binder",
+ "Snagger",
+ "Snatcher",
+ "Cager",
+ "Capturer",
+ "Haunter",
+ "Creeper",
+ "Sneaker",
+ "Binder",
+ "Jailer",
+ "Seducer",
+ "Dancer",
+ "Blasphemer",
+ "Eater",
+ "Snorer",
+ "Thruster",
+ "Slapper"
+ )), true);
+
+ MaterialGenerator.initializeValidProceduralMaterials();
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java
new file mode 100644
index 000000000..863584853
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/QuestsConfig.java
@@ -0,0 +1,336 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.elitemobs.quests.objectives.CustomFetchObjective;
+import com.magmaguy.elitemobs.quests.objectives.DialogObjective;
+import com.magmaguy.elitemobs.quests.objectives.KillObjective;
+import com.magmaguy.elitemobs.quests.objectives.Objective;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import com.magmaguy.magmacore.util.Logger;
+import lombok.Getter;
+import org.bukkit.ChatColor;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.EntityType;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class QuestsConfig extends ConfigurationFile {
+
+ @Getter
+ private static boolean requireQuestTurnIn;
+ @Getter
+ private static String questJoinMessage;
+ @Getter
+ private static String questLeaveMessage;
+ @Getter
+ private static String questCompleteMessage;
+ @Getter
+ private static String leaveWhenNoActiveQuestsExist;
+ @Getter
+ private static String questLeaveConfirmationMessage;
+ @Getter
+ private static boolean useQuestAcceptTitles;
+ @Getter
+ private static String questStartTitle;
+ @Getter
+ private static String questStartSubtitle;
+ @Getter
+ private static boolean useQuestCompleteTitles;
+ @Getter
+ private static String questCompleteTitle;
+ @Getter
+ private static String questCompleteSubtitle;
+ @Getter
+ private static boolean useQuestLeaveTitles;
+ @Getter
+ private static String questLeaveTitle;
+ @Getter
+ private static String questLeaveSubtitle;
+ @Getter
+ private static boolean doQuestChatProgression;
+ @Getter
+ private static String ongoingColorCode;
+ @Getter
+ private static String completedColorCode;
+ @Getter
+ private static String killQuestChatProgressionMessage;
+ @Getter
+ private static String fetchQuestChatProgressionMessage;
+ @Getter
+ private static String dialogQuestChatProgressionMessage;
+ @Getter
+ private static boolean useQuestScoreboards;
+ @Getter
+ private static String killQuestScoreboardProgressionLine;
+ @Getter
+ private static String fetchQuestScoreboardProgressionLine;
+ @Getter
+ private static String dialogQuestScoreboardProgressionLine;
+ @Getter
+ private static int maximumActiveQuests;
+ @Getter
+ private static String questCapMessage;
+ @Getter
+ private static List questEntityTypes = new ArrayList<>();
+ @Getter
+ private static String chatTrackMessage;
+ @Getter
+ private static String chatTrackHover;
+ @Getter
+ private static String chatTrackCommand;
+ @Getter
+ private static String chatTrackingMessage;
+ @Getter
+ private static String chatTrackingHover;
+ @Getter
+ private static String chatTrackingCommand;
+ @Getter
+ private static boolean autoTrackQuestsOnAccept;
+ @Getter
+ private static String noQuestDestinationFound;
+ @Getter
+ private static String questDestinationInOtherWorld;
+ @Getter
+ private static String questAlreadyCompletedMessage;
+ @Getter
+ private static String questPrerequisitesMissingMessage;
+ @Getter
+ private static String lowRankDynamicQuestWarning;
+ @Getter
+ private static String questTurnInObjective;
+ @Getter
+ private static int horizontalCharacterLimitBedrockMenu;
+ @Getter
+ private static int itemEntryCharacterLimitBedrockMenu;
+
+ public QuestsConfig() {
+ super("Quests.yml");
+ }
+
+ private static List setEntityTypes(FileConfiguration fileConfiguration, File file) {
+ List entityTypes = new ArrayList<>(new ArrayList<>(List.of(
+ EntityType.BLAZE.toString(),
+ EntityType.CAVE_SPIDER.toString(),
+ EntityType.DROWNED.toString(),
+ EntityType.ELDER_GUARDIAN.toString(),
+ EntityType.ENDERMAN.toString(),
+ EntityType.ENDERMITE.toString(),
+ EntityType.EVOKER.toString(),
+ EntityType.GHAST.toString(),
+ EntityType.GUARDIAN.toString(),
+ EntityType.HUSK.toString(),
+ EntityType.ILLUSIONER.toString(),
+ EntityType.IRON_GOLEM.toString(),
+ EntityType.PILLAGER.toString(),
+ EntityType.RAVAGER.toString(),
+ EntityType.SILVERFISH.toString(),
+ EntityType.SKELETON.toString(),
+ EntityType.SPIDER.toString(),
+ EntityType.STRAY.toString(),
+ EntityType.VINDICATOR.toString(),
+ EntityType.WITCH.toString(),
+ EntityType.WITHER_SKELETON.toString(),
+ EntityType.WOLF.toString(),
+ EntityType.ZOMBIE.toString()
+ )));
+
+ List laterEntities = new ArrayList<>(List.of(
+ EntityType.HOGLIN.toString(),
+ EntityType.ZOGLIN.toString(),
+ EntityType.PIGLIN_BRUTE.toString(),
+ EntityType.PIGLIN.toString(),
+ EntityType.ZOMBIFIED_PIGLIN.toString()));
+ entityTypes.addAll(laterEntities);
+
+ ConfigurationEngine.setList(file, fileConfiguration, "questEntityTypes", entityTypes, false);
+
+ List parsedTypes = new ArrayList<>();
+ for (String string : entityTypes)
+ try {
+ parsedTypes.add(EntityType.valueOf(string));
+ } catch (Exception ex) {
+ Logger.warn("Entity type " + string + " is not a valid entity type from the Spigot API!");
+ }
+ return parsedTypes;
+ }
+
+ public static String getQuestChatProgressionMessage(Objective objective) {
+ String newString = "";
+ if (objective instanceof KillObjective)
+ newString = killQuestChatProgressionMessage;
+ else if (objective instanceof CustomFetchObjective)
+ newString = fetchQuestChatProgressionMessage;
+ else if (objective instanceof DialogObjective)
+ newString = dialogQuestChatProgressionMessage;
+ newString = newString.replace("$name", ChatColor.WHITE + ChatColor.stripColor(objective.getObjectiveName()));
+ newString = newString.replace("$current", objective.getCurrentAmount() + "");
+ newString = newString.replace("$target", objective.getTargetAmount() + "");
+ if (!objective.isObjectiveCompleted())
+ return newString.replace("$color", ongoingColorCode);
+ else
+ return newString.replace("$color", completedColorCode);
+ }
+
+ public static String getQuestScoreboardProgressionLine(Objective objective) {
+ String newString = "";
+ if (objective instanceof KillObjective)
+ newString = killQuestScoreboardProgressionLine;
+ else if (objective instanceof CustomFetchObjective)
+ newString = fetchQuestScoreboardProgressionLine;
+ else if (objective instanceof DialogObjective)
+ newString = dialogQuestScoreboardProgressionLine;
+ newString = newString.replace("$name", ChatColor.WHITE + ChatColor.stripColor(objective.getObjectiveName()));
+ newString = newString.replace("$current", objective.getCurrentAmount() + "");
+ newString = newString.replace("$target", objective.getTargetAmount() + "");
+ if (!objective.isObjectiveCompleted())
+ return newString.replace("$color", ongoingColorCode);
+ else
+ return newString.replace("$color", completedColorCode);
+ }
+
+ @Override
+ public void initializeValues() {
+
+ requireQuestTurnIn = ConfigurationEngine.setBoolean(
+ List.of("Sets if quests have to be returned to quest givers to complete the quest."),
+ fileConfiguration, "requireQuestTurnIn", true);
+ questJoinMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent when a quest is accepted."),
+ file, fileConfiguration, "questJoinMessage", "&aYou have accepted the quest $questName &a!", true);
+ questLeaveMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent when a quest is abandoned."),
+ file, fileConfiguration, "questLeaveMessage", "&cYou have abandoned the quest $questName &c!", true);
+ questCompleteMessage = ConfigurationEngine.setString(
+ List.of("Sets message sent when a quest is completed."),
+ file, fileConfiguration, "questCompleteMessage", "&2You completed the quest $questName &2!", true);
+ leaveWhenNoActiveQuestsExist = ConfigurationEngine.setString(
+ List.of("Sets the message sent when a player tried to abandon a quest when none are active."),
+ file, fileConfiguration, "leaveWhenNoActiveQuestsExist", "&cYou don't currently have an active quest!", true);
+ questLeaveConfirmationMessage = ConfigurationEngine.setString(
+ List.of("Sets the confirmation message sent when players try to leave a quest."),
+ file, fileConfiguration, "questLeaveConfirmationMessage", "&cAre you sure you want to abandon your current quest? Do &a/em confirm &c to confirm your choice!", true);
+ useQuestAcceptTitles = ConfigurationEngine.setBoolean(
+ List.of("Sets if some of the messages related to quests will use titles instead of chat messages."),
+ fileConfiguration, "useQuestAcceptTitles", true);
+ questStartTitle = ConfigurationEngine.setString(
+ List.of("Sets the title sent when a players starts a quest."),
+ file, fileConfiguration, "questStartTitle", "&aQuest Accepted!", true);
+ questStartSubtitle = ConfigurationEngine.setString(
+ List.of("Sets the subtitle sent when a players starts a quest."),
+ file, fileConfiguration, "questStartSubtitle", "$questName", false);
+ useQuestCompleteTitles = ConfigurationEngine.setBoolean(
+ List.of("Sets if titles will be sent when players complete a quest."),
+ fileConfiguration, "useQuestCompleteTitles", true);
+ questCompleteTitle = ConfigurationEngine.setString(
+ List.of("Sets the title sent when a player completes a quest."),
+ file, fileConfiguration, "questCompleteTitle", "&2Quest Completed!", true);
+ questCompleteSubtitle = ConfigurationEngine.setString(
+ List.of("Sets the subtitle sent when a player completes a quest."),
+ file, fileConfiguration, "questCompleteSubtitle", "$questName", true);
+ useQuestLeaveTitles = ConfigurationEngine.setBoolean(
+ List.of("Sets if titles are sent when players leave quests.."),
+ fileConfiguration, "useQuestLeaveTitles", true);
+ questLeaveTitle = ConfigurationEngine.setString(
+ List.of("Sets the title sent when a player leaves a quest."),
+ file, fileConfiguration, "questLeaveTitle", "&cQuest Abandoned!", true);
+ questLeaveSubtitle = ConfigurationEngine.setString(
+ List.of("Sets the subtitle sent when a player leaves a quest."),
+ file, fileConfiguration, "questLeaveSubtitle", "$questName", false);
+ doQuestChatProgression = ConfigurationEngine.setBoolean(
+ List.of("Sets if messages are sent on chat reporting quest objective progression."),
+ fileConfiguration, "doQuestChatProgression", true);
+ ongoingColorCode = ConfigurationEngine.setString(
+ List.of("Sets the color codes for ongoing objectives."),
+ file, fileConfiguration, "ongoingQuestColorCode", "&c", false);
+ completedColorCode = ConfigurationEngine.setString(
+ List.of("Sets the color codes for completed objectives."),
+ file, fileConfiguration, "ongoingQuestColorCode", "&2", false);
+ killQuestChatProgressionMessage = ConfigurationEngine.setString(
+ List.of("Sets the formatting for progression messages of kill quests."),
+ file, fileConfiguration, "killQuestChatProgressionMessage", "&8[EliteMobs]&c➤Kill $name:$color$current&0/$color$target", true);
+ fetchQuestChatProgressionMessage = ConfigurationEngine.setString(
+ List.of("Sets the formatting for progression messages of fetch quests."),
+ file, fileConfiguration, "fetchQuestChatProgressionMessage", "&8[EliteMobs]&c➤Get $name:$color$current&0/$color$target", true);
+ dialogQuestChatProgressionMessage = ConfigurationEngine.setString(
+ List.of("Sets the formatting for progression messages of dialog quests."),
+ file, fileConfiguration, "dialogQuestChatProgressionMessage", "&8[EliteMobs]&c➤Talk to $name:$color$current&0/$color$target", true);
+ maximumActiveQuests = ConfigurationEngine.setInt(
+ List.of("Sets the maximum amount of accepted quests a player can have."),
+ fileConfiguration, "maximumActiveQuests", 10);
+ questCapMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players when trying to accept an amount of quests that exceed the active quest cap."),
+ file, fileConfiguration, "questCapMessage", "&8[EliteMobs] &cYou have reached the maximum amount of active quests (10)! " +
+ "&4Abandon or complete at least one active quest if you want to get more quests!", true);
+
+ useQuestScoreboards = ConfigurationEngine.setBoolean(
+ List.of("Sets if scoreboards messages will be used for quests."),
+ fileConfiguration, "useQuestScoreboards", true);
+
+ killQuestScoreboardProgressionLine = ConfigurationEngine.setString(
+ List.of("Sets the formatting for scoreboard progression messages of kill quests."),
+ file, fileConfiguration, "killQuestScoreboardProgressionMessage", "&c➤Kill $name:$color$current&0/$color$target", true);
+ fetchQuestScoreboardProgressionLine = ConfigurationEngine.setString(
+ List.of("Sets the formatting for scoreboard progression message of fetch quests."),
+ file, fileConfiguration, "fetchQuestScoreboardProgressionMessage", "&c➤Get $name:$color$current&0/$color$target", true);
+ dialogQuestScoreboardProgressionLine = ConfigurationEngine.setString(
+ List.of("Sets the formatting for scoreboard progression messages of dialog quests."),
+ file, fileConfiguration, "dialogQuestScoreboardProgressionMessage", "&c➤Talk to $name:$color$current&0/$color$target", true);
+
+ questEntityTypes = setEntityTypes(fileConfiguration, file);
+
+ chatTrackMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players to activate quest tracking."),
+ file, fileConfiguration, "chatTrackMessage", "&8[EliteMobs]&2 Click here to track your quest!", true);
+ chatTrackHover = ConfigurationEngine.setString(
+ List.of("Sets the hover message of the quest tracking message."),
+ file, fileConfiguration, "chatTrackHover", "&2Click to track!", true);
+ chatTrackCommand = ConfigurationEngine.setString(
+ List.of("Sets the command sent when clicking on the tracking message. You really should not modify this."),
+ file, fileConfiguration, "chatTrackCommand", "/elitemobs quest track $questID", false);
+
+ chatTrackingMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players when activating quest tracking."),
+ file, fileConfiguration, "chatTrackingMessage", "&8[EliteMobs]&9 You are now tracking a quest!", true);
+ chatTrackingHover = ConfigurationEngine.setString(
+ List.of("Sets the hover message of the quest tracking enabled message."),
+ file, fileConfiguration, "chatTrackingHover", "&2Click to untrack/track! /em -> Quests to track a different quest!", true);
+ chatTrackingCommand = ConfigurationEngine.setString(
+ List.of("Sets the command sent when click on the quest tracking activation message. You really should not modify this."),
+ file, fileConfiguration, "chatTrackingCommand", "/elitemobs quest track $questID", false);
+
+ autoTrackQuestsOnAccept = ConfigurationEngine.setBoolean(
+ List.of("Sets if quests are automatically tracked when accepted."),
+ fileConfiguration, "autoTrackQuestsOnAccept", true);
+
+ noQuestDestinationFound = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when the destination of the quest could not be found."),
+ file, fileConfiguration, "noQuestDestinationFound", "[EM] No quest destination found!", true);
+ questDestinationInOtherWorld = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when the quest target is in a different world."),
+ file, fileConfiguration, "questDestinationInOtherWorld", "[EM] Go to world $world!", true);
+
+ questAlreadyCompletedMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players when trying to accept a quest they have already completed."),
+ file, fileConfiguration, "questAlreadyCompletedMessage", "&8[EliteMobs] &cYou already completed this quest!", true);
+ questPrerequisitesMissingMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players when trying to accept a quest they do not have the permission for."),
+ file, fileConfiguration, "questPrerequisitesMissingMessage", "&8[EliteMobs] &cThis NPC has some quest(s) you can't accept yet!", true);
+
+ lowRankDynamicQuestWarning = ConfigurationEngine.setString(
+ List.of("Sets the message sent to players trying to get a quest for which they do not have the correct guild rank activated."),
+ file, fileConfiguration, "lowRankDynamicQuestWarning", "&8[EliteMobs] &cYou can't take these quests with your current guild rank! Increase your guild rank to accept these quests.", true);
+
+ questTurnInObjective = ConfigurationEngine.setString(
+ List.of("Sets the formatting for the quest turn-in message."),
+ file, fileConfiguration, "questTurnInObjective", "&a2Talk to $npcName", true);
+
+ horizontalCharacterLimitBedrockMenu = ConfigurationEngine.setInt(
+ List.of("Sets the maximum amount of characters inventory-based menus for quests will have before breaking the line."),
+ fileConfiguration, "horizontalCharacterLimitBedrockMenu", 30);
+ itemEntryCharacterLimitBedrockMenu = ConfigurationEngine.setInt(
+ List.of("Sets the maximum amount of characters per item entry in inventory-based menus for quests before creating another item to continue the entry."),
+ fileConfiguration, "itemEntryCharacterLimitBedrockMenu", 300);
+
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java
new file mode 100644
index 000000000..0e211c4fd
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/SoundsConfig.java
@@ -0,0 +1,50 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+
+import java.util.List;
+
+public class SoundsConfig extends ConfigurationFile {
+ public static String treasureChestOpenSound;
+ public static String guildRankUpSound;
+ public static String guildPrestigeSound;
+ public static String questProgressionSound;
+ public static String questCompleteSound;
+ public static String questAbandonSound;
+ public static String questAcceptSound;
+
+ public SoundsConfig() {
+ super("Sounds.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ treasureChestOpenSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a treasure chest opens"),
+ file, fileConfiguration, "treasureChestOpenSound", "elitemobs:treasure_chest.open", false);
+
+ guildRankUpSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a player ranks up at the guild"),
+ file, fileConfiguration, "guildRankUpSound", "elitemobs:guild.rankup", false);
+
+ guildPrestigeSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a player prestiges at the guild"),
+ file, fileConfiguration, "guildPrestigeSound", "elitemobs:guild.prestige", false);
+
+ questProgressionSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a player progresses a quest"),
+ file, fileConfiguration, "questProgressionSound", "elitemobs:quest.progression", false);
+
+ questCompleteSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a player completes a quest"),
+ file, fileConfiguration, "questCompleteSound", "elitemobs:quest.completion", false);
+
+ questAbandonSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a player abandons a quest"),
+ file, fileConfiguration, "questAbandonSound", "elitemobs:quest.abandon", false);
+
+ questAcceptSound = ConfigurationEngine.setString(
+ List.of("Sets the sound that will play when a player accepts a quest"),
+ file, fileConfiguration, "questAcceptSound", "elitemobs:quest.accept", false);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java
new file mode 100644
index 000000000..536569ffa
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/SpecialItemSystemsConfig.java
@@ -0,0 +1,169 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.elitemobs.items.customitems.CustomItem;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import com.magmaguy.magmacore.util.Logger;
+import lombok.Getter;
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.util.HashMap;
+import java.util.List;
+
+public class SpecialItemSystemsConfig extends ConfigurationFile {
+
+ @Getter
+ private static final HashMap specialValues = new HashMap<>();
+ @Getter
+ private static boolean dropSpecialLoot;
+ @Getter
+ private static double bossChanceToDrop;
+ @Getter
+ private static double nonEliteChanceToDrop;
+ @Getter
+ private static double luckyTicketMultiplier;
+ @Getter
+ private static double criticalFailureChance;
+ @Getter
+ private static double challengeChance;
+ @Getter
+ private static double criticalFailureChanceDuringChallengeChance;
+ @Getter
+ private static String insufficientFundsMessage;
+ @Getter
+ private static String newFundsMessage;
+ @Getter
+ private static boolean announceImportantEnchantments;
+ @Getter
+ private static String successAnnouncement;
+ @Getter
+ private static String criticalFailureAnnouncement;
+ @Getter
+ private static String challengeAnnouncement;
+
+ public SpecialItemSystemsConfig() {
+ super("SpecialItemSystems.yml");
+ }
+
+ private static void addDefaultEnchantmentBook(FileConfiguration fileConfiguration, String configFilename, double chance) {
+ String key = "enchantedBookWeightedDropChance." + configFilename;
+ fileConfiguration.addDefault(key, chance);
+ CustomItem customItem = CustomItem.getCustomItem(configFilename + ".yml");
+ if (customItem == null) {
+ Logger.warn("Failed to get custom item " + configFilename + ".yml for the special loot list!");
+ return;
+ }
+ specialValues.put(customItem, fileConfiguration.getDouble(key));
+ }
+
+ @Override
+ public void initializeValues() {
+ specialValues.clear();
+
+ dropSpecialLoot = ConfigurationEngine.setBoolean(
+ List.of("Sets if special loot will drop."),
+ fileConfiguration, "dropSpecialLoot", true);
+
+ bossChanceToDrop = ConfigurationEngine.setDouble(
+ List.of("Sets the chance of special loot dropping from any custom boss that can drop elite loot with a health multiplier over 1.0.", "This means all bosses, minibosses and marginally hard bosses."),
+ fileConfiguration, "bossChanceToDrop", 0.1);
+ nonEliteChanceToDrop = ConfigurationEngine.setDouble(
+ List.of("Sets the chance of special loot dropping custom boss that can drop elite loot.", "Normal elites are excluded to avoid encouraging mob farms."),
+ fileConfiguration, "normalChanceToDrop", 0.01);
+
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_arrow_damage", 200);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_arrow_fire", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_arrow_infinite", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_arrow_knockback", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_channeling", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_critical_strikes", 1);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_damage_all", 200);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_damage_arthropods", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_damage_undead", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_depth_strider", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_dig_speed", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_drilling", 1);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_durability", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_earthquake", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_flamethrower", 0);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_frost_walker", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_hunter", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_ice_breaker", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_impaling", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_knockback", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_lightning", 0);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_loot_bonus_blocks", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_loot_bonus_mobs", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_loud_strikes", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_loyalty", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_luck", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_lure", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_mending", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_meteor_shower", 0);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_multishot", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_oxygen", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_piercing", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_plasma_boots", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_protection_environmental", 600);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_protection_explosions", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_protection_fall", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_protection_fire", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_protection_projectile", 100);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_quick_charge", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_riptide", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_silk_touch", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_soul_speed", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_sweeping_edge", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_thorns", 10);
+ addDefaultEnchantmentBook(fileConfiguration, "enchanted_book_water_worker", 10);
+
+ addDefaultEnchantmentBook(fileConfiguration, "elite_lucky_ticket", 100);
+
+ addDefaultEnchantmentBook(fileConfiguration, "elite_scrap_huge", 100);
+
+ fileConfiguration.setComments("enchantedBookWeightedDropChance",
+ List.of("Sets the chance of a special item dropping over another special item.",
+ "The higher the value, the higher the chance of that item getting picked over other items.",
+ "Keep in mind that if values get too high, things with low values will become almost impossible to obtain."));
+
+ luckyTicketMultiplier = ConfigurationEngine.setDouble(
+ List.of("Multiplier for the lucky ticket success chance in enchantments. 2.0 = 2x"),
+ fileConfiguration, "luckyTicketMultiplier", 2.00);
+
+ criticalFailureChance = ConfigurationEngine.setDouble(
+ List.of("Chance of an item being lost if an item enchantment fails. This is a percentage of the base failure chance."),
+ fileConfiguration, "criticalFailureChanceV2", 0.01);
+
+ challengeChance = ConfigurationEngine.setDouble(
+ List.of("Chance of a player being teleported to a challenge arena if an item enchantment fails. This is a percentage of the base failure chance.", "If the player defeats the arena, their item is upgraded correctly. If the lose, either it is not enchanted or, if they're unlucky, they may lose the item."),
+ fileConfiguration, "challengeChance", 0.30);
+
+ criticalFailureChanceDuringChallengeChance = ConfigurationEngine.setDouble(
+ List.of("Chance of an item being lost if a player loses the enchantment challenge. This is a percentage of the base failure chance."),
+ fileConfiguration, "criticalFailureChanceDuringChallengeChance", 0.10);
+
+ insufficientFundsMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent when players do not have enough elite coins to enchant an item"),
+ file, fileConfiguration, "insufficientFundsMessage", "&8[EliteMobs] &c$price $currencyName is required to enchant $itemName, but you only have $currentAmount!", true);
+
+ newFundsMessage = ConfigurationEngine.setString(
+ List.of("Sets the message sent when players after deducting the funds"),
+ file, fileConfiguration, "newFundsMessage", "&8[EliteMobs] &fYou just spent $price $currencyName! You now have $currentAmount $currencyName.", true);
+
+ announceImportantEnchantments = ConfigurationEngine.setBoolean(
+ List.of("Sets if enchantments of items with more than 10 enchantments in them will be announced"),
+ fileConfiguration, "successAnnouncement", true);
+
+ successAnnouncement = ConfigurationEngine.setString(
+ List.of("Sets the message announced to all players when successfully enchanting an item with more than 10 enchantments"),
+ file, fileConfiguration, "successAnnouncement", "&8[EliteMobs] $player &2has successfully enchanted $itemName&2!", true);
+
+ challengeAnnouncement = ConfigurationEngine.setString(
+ List.of("Sets the message announced to all players when they get a boss fight while trying to enchant an item with more than 10 enchantments"),
+ file, fileConfiguration, "challengeAnnouncement", "&8[EliteMobs] $player &6is challenging a boss to enchant $itemName&6!", true);
+
+ criticalFailureAnnouncement = ConfigurationEngine.setString(
+ List.of("Sets the message announced to all players when losing an item while trying to enchant it if the item has more than 10 enchantments"),
+ file, fileConfiguration, "criticalFailureAnnouncement", "&8[EliteMobs] $player &clost $itemName &cwhile trying to enchant it!", true);
+
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/TranslationConfig.java b/src/main/java/com/magmaguy/elitemobs/config/TranslationConfig.java
deleted file mode 100644
index b42e74aaa..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/TranslationConfig.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-import java.util.Arrays;
-
-/**
- * Created by MagmaGuy on 12/05/2017.
- */
-public class TranslationConfig {
-
- private static final String ELITE_MOB_NAME = "Elite mob names.";
- public static final String NAME_BLAZE = ELITE_MOB_NAME + "Blaze";
- public static final String NAME_CAVE_SPIDER = ELITE_MOB_NAME + "CaveSpider";
- public static final String NAME_CREEPER = ELITE_MOB_NAME + "Creeper";
- public static final String NAME_ENDERMAN = ELITE_MOB_NAME + "Enderman";
- public static final String NAME_ENDERMITE = ELITE_MOB_NAME + "Endermite";
- public static final String NAME_HUSK = ELITE_MOB_NAME + "Husk";
- public static final String NAME_IRON_GOLEM = ELITE_MOB_NAME + "IronGolem";
- public static final String NAME_PIG_ZOMBIE = ELITE_MOB_NAME + "PigZombie";
- public static final String NAME_POLAR_BEAR = ELITE_MOB_NAME + "PolarBear";
- public static final String NAME_SILVERFISH = ELITE_MOB_NAME + "Silverfish";
- public static final String NAME_SKELETON = ELITE_MOB_NAME + "Skeleton";
- public static final String NAME_SPIDER = ELITE_MOB_NAME + "Spider";
- public static final String NAME_STRAY = ELITE_MOB_NAME + "Stray";
- public static final String NAME_WITCH = ELITE_MOB_NAME + "Witch";
- public static final String NAME_WITHER_SKELETON = ELITE_MOB_NAME + "WitherSkeleton";
- public static final String NAME_ZOMBIE = ELITE_MOB_NAME + "Zombie";
- public static final String NAME_VEX = ELITE_MOB_NAME + "Vex";
- public static final String NAME_VINDICATOR = ELITE_MOB_NAME + "Vindicator";
- public static final String NAME_DROWNED = ELITE_MOB_NAME + "Drowned";
-
- public static final String NAME_CHICKEN = ELITE_MOB_NAME + "Chicken";
- public static final String NAME_COW = ELITE_MOB_NAME + "Cow";
- public static final String NAME_MUSHROOM_COW = ELITE_MOB_NAME + "MushroomCow";
- public static final String NAME_PIG = ELITE_MOB_NAME + "Pig";
- public static final String NAME_SHEEP = ELITE_MOB_NAME + "Sheep";
-
- public static final String CONFIG_NAME = "translation.yml";
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void initializeConfig() {
-
- configuration.addDefault(NAME_BLAZE, "Level $level Elite Blaze");
- configuration.addDefault(NAME_CAVE_SPIDER, "Level $level Elite Cave Spider");
- configuration.addDefault(NAME_CREEPER, "Level $level Elite Creeper");
- configuration.addDefault(NAME_ENDERMAN, "Level $level Elite Enderman");
- configuration.addDefault(NAME_ENDERMITE, "Level $level Elite Endermite");
- configuration.addDefault(NAME_HUSK, "Level $level Elite Husk");
- configuration.addDefault(NAME_IRON_GOLEM, "Level $level Elite Iron Golem");
- configuration.addDefault(NAME_PIG_ZOMBIE, "Level $level Elite Zombie Pigman");
- configuration.addDefault(NAME_POLAR_BEAR, "Level $level Elite Polar Bear");
- configuration.addDefault(NAME_SILVERFISH, "Level $level Elite Silverfish");
- configuration.addDefault(NAME_SKELETON, "Level $level Elite Skeleton");
- configuration.addDefault(NAME_SPIDER, "Level $level Elite Spider");
- configuration.addDefault(NAME_STRAY, "Level $level Elite Stray");
- configuration.addDefault(NAME_WITCH, "Level $level Elite Witch");
- configuration.addDefault(NAME_WITHER_SKELETON, "Level $level Elite Wither Skeleton");
- configuration.addDefault(NAME_ZOMBIE, "Level $level Elite Zombie");
- configuration.addDefault(NAME_VEX, "Level $level Elite Vex");
- configuration.addDefault(NAME_VINDICATOR, "Level $level Elite Vindicator");
- configuration.addDefault(NAME_DROWNED, "Level $level Elite Drowned");
-
- configuration.addDefault(NAME_CHICKEN, "Super Chicken");
- configuration.addDefault(NAME_COW, "Super Cow");
- configuration.addDefault(NAME_MUSHROOM_COW, "Super Mooshroom");
- configuration.addDefault(NAME_PIG, "Super Pig");
- configuration.addDefault(NAME_SHEEP, "Super Sheep");
-
- configuration.addDefault("ScoreBoard.Health", "Health: ");
-
- configuration.addDefault("Taunts.Target", Arrays.asList(
- "OI! Get over here!",
- "What's that I see? A coward?",
- "Sir, prepare your fisticuffs!",
- "Let's settle this like cavemen!",
- "En garde!",
- "Look out! A creeper, behind you!",
- "Aren't you a right ugly mug!",
- "You look delicious.",
- "Prepare for trouble!",
- "Let the best click spammer win!",
- "SPARTAAAAAA",
- "I am actually level 9001",
- "Not an Elite Mob",
- "Poorly disguised Elite Mob",
- "Ah, fresh prey!",
- "The hunter becomes the hunted!",
- "Killing me crashes the server",
- "I'm actually a disguised player!",
- "I'm not going to drop any loot!",
- "Why can't we be friends?",
- "Sssssss",
- "This is my last day on the job!",
- "Stop right there criminal scum!",
- "Prepare to die!",
- "Praise the Sun!",
- "Git gud",
- "Alea jacta est!",
- "Facta, non verba!",
- "Skulls for the skull throne!",
- "Blood for the blood throne!",
- "A sacrifice for Herobrine!",
- "I shall pierce the heavens!",
- "Just who do you think I am!?",
- "A weakling! He's mine.",
- "Dibs on the weakling!",
- "Accio player!",
- "A duel to the death!",
- "I challenge you to a duel!",
- "Pika pika!",
- "Did you just call me an infernal",
- "What did you just call me?",
- "I know what you did you monster!",
- "This is how your story ends!",
- "Prepare for trouble!",
- "I've been preparing for this!",
- "I am prepared. Are you?",
- "A worthy foe!",
- "A worthy opponent!",
- "A newbie! It's my lucky day!",
- "Your stuff or your life!",
- "This is a robbery!",
- "It's you! You monster!",
- "So hungry, give me your flesh!",
- "There he is!",
- "Must've been my imagination",
- "Hi I'm Mr Meeseeks!",
- "I'm Mr Meeseeks, look at me!",
- "Your diamonds or your life!",
- "For king and country!",
- "Hit me with your best shot!",
- "Witness me!",
- "Witness me blood bag!",
- "I go all shiny and chrome!"));
-
- configuration.addDefault("Taunts.Damaged", Arrays.asList(
- "Ow!",
- "Oi!",
- "Stop that!",
- "Why?!",
- "You fight like a Dairy Farmer!",
- "You are a pain in the backside!",
- "En garde! Touche!",
- "Hacks!",
- "My health is bugged, unkillable!",
- "Your hits only make me stronger!",
- "Sticks and stones...",
- "'tis but a flesh wound!",
- "Emperor protects!",
- "Herobrine, aid me!",
- "Behind you! A creeper!",
- "I have made a terrible mistake.",
- "What doesn't kill me...",
- "Zombies dig scars",
- "I shall show you my true power!",
- "Prepare for my ultimate attack!",
- "My reinforcements are arriving!",
- "You're going to pay for that!",
- "That's going to leave a mark!",
- "An eye for an eye!",
- "Health insurance will cover that",
- "I felt that one in my bones",
- "'tis but a scratch",
- "What was that? A soft breeze?",
- "You'll never defeat me like that",
- "Pathetic.",
- "Weak.",
- "That didn't even dent my armor!",
- "This is going to be an easy one",
- "My grandchildren will feel that",
- "Are you even trying?",
- "An admin just fully healed me",
- "Haxxor!",
- "Me? Damaged? Hacks!",
- "I can't be defeated!",
- "Good thing I'm using hacks!",
- "Watch out! Herobrine behind you!",
- "My life for Aiur!",
- "Your home is getting griefed!",
- "Why can't we be friends?",
- "Valhalla!",
- "Notch save me!",
- "No retreat!",
- "Hit me with your best shot!"
- ));
-
- configuration.addDefault("Taunts.BowDamaged", Arrays.asList(
- "Fight me like a Player!",
- "Afraid to come up-close?",
- "I can smell your fear from here!",
- "Did you forget your sword?",
- "Coward! Bow are no fair!",
- "Bows? That's so 2011...",
- "Bows are for the weak of mind!",
- "Bows are for the weak of spirit!",
- "Bows are for the weak of heart!",
- "I thought we agreed no bows!",
- "Bows? You'll regret that",
-
- //regular hits
- "Ow!",
- "Oi!",
- "Stop that!",
- "Why?!",
- "You fight like a Dairy Farmer!",
- "You are a pain in the backside!",
- "En garde! Touche!",
- "Hacks!",
- "My health is bugged, unkillable!",
- "Your hits only make me stronger!",
- "Sticks and stones...",
- "'tis but a flesh wound!",
- "Emperor protects!",
- "Herobrine, aid me!",
- "Behind you! A creeper!",
- "I have made a terrible mistake.",
- "What doesn't kill me...",
- "Zombies dig scars",
- "I shall show you my true power!",
- "Prepare for my ultimate attack!",
- "My reinforcements are arriving!",
- "You're going to pay for that!",
- "That's going to leave a mark!",
- "An eye for an eye!",
- "Health insurance will cover that",
- "I felt that one in my bones",
- "'tis but a scratch",
- "What was that? A soft breeze?",
- "You'll never defeat me like that",
- "Pathetic.",
- "Weak.",
- "That didn't even dent my armor!",
- "This is going to be an easy one",
- "My grandchildren will feel that",
- "Are you even trying?",
- "An admin just fully healed me",
- "Haxxor!",
- "Me? Damaged? Hacks!",
- "I can't be defeated!",
- "Good thing I'm using hacks!",
- "Watch out! Herobrine behind you!",
- "My life for Aiur!",
- "Your home is getting griefed!",
- "Why can't we be friends?",
- "Valhalla!",
- "Notch save me!",
- "No retreat!",
- "Hit me with your best shot!"
- ));
-
- configuration.addDefault("Taunts.Hit", Arrays.asList(
- "A solid hit!",
- "He shoots, and he scores!",
- "You'll feel that in the morning!",
- "Victory approaches!",
- "Victory shall be mine!",
- "That was only half of my power!",
- "You came to the wrong hood!",
- "You messed with the wrong mob!",
- "Get ready to get mobbed on!",
- "This was your last mistake!",
- "Feel the burn!",
- "John Cena",
- "How are you still standing?",
- "Just give up already!",
- "Give up!",
- "I have the high ground!",
- "I will end you!",
- "Hope you came prepared for pain!",
- "The hunter becomes the hunted!",
- "Blood for the blood throne!",
- "Skulls for the skull throne!",
- "A good player is a dead player!",
- "Git gud!",
- "Praise the Sun!",
- "The end draws near!",
- "You are not prepared.",
- "Zug zug!",
- "Hardly worth my time!",
- "I thought this was a challenge?",
- "Pro tip: don't get hit",
- "Ima firin mah lazer bwooooooooo",
- "For the Emperor!",
- "Herobrine shall be pleased!",
- "This is the end for you!",
- "Are you even trying?",
- "Weakling!",
- "Pathetic.",
- "Maybe this will wake you up.",
- "This is just the beggining!",
- "We're just getting started!",
- "That was just a warm-up!",
- "You are no match for me!",
- "RKO out of nowhere!",
- "I can do this all night long!",
- "A fine punching bag!",
- "I am the night!",
- "I wonder what will break first",
- "Revenge for Steve! You monster!",
- "Join the mob side!",
- "Too easy, too easy!",
- "Too easy!",
- "You can't defeat me!",
- "Pikachuuuuuu",
- "Avada kedavra!",
- "Crucio!",
- "Jierda!",
- "A critical hit!",
- "This is what skills looks like!",
- "9001 damage!",
- "Still standing?",
- "Face your defeat!",
- "A taste of pain to come!",
- "I'll make you endangered!"
- ));
-
- configuration.addDefault("Taunts.Death", Arrays.asList(
- "Alas, poor Yorick!",
- "The rest is silence",
- "I shall return",
- "Unforgivable",
- "I live, I die, I live again!",
- "WITNESS ME",
- "I ride to valhalla!",
- "VALHALLA!",
- "VALHALLA! DELIVERANCE",
- "You win, this time",
- "A blight upon your land!",
- "A pox upon thee!",
- "You'll join me soon enough!",
- "This is not over",
- "Death is but a setback",
- "Not like this...",
- "I just wanted to go into space",
- "We could've been friends",
- "Your sins crawling on your back",
- "See you in a bit",
- "See you later",
- "I'll be waiting for you",
- "I will be avenged!",
- "I won't go gently into the night",
- "Should've gotten life insurance",
- "It was my last day on the job",
- "It was my last day here",
- "Et tu, Brute?",
- "RIP",
- "x.x",
- "(x.x)",
- "xox",
- "Fainted",
- "GG, WP",
- "GG",
- "WP",
- "GG no RE",
- "HAX",
- "Hacker",
- "Not fair I was lagging",
- "You win, this time",
- "You monster...",
- "Mediocre..."
- ));
-
- configuration.addDefault("ZombieFriends.Friend 1", "BFF #1");
- configuration.addDefault("ZombieFriends.Friend 2", "BFF #2");
-
- configuration.addDefault("ZombieFriends.DeathMessage", Arrays.asList(
- "Noooo!",
- "Mediocre!",
- "Zacharias!",
- "He's deader than before!"
- ));
-
- configuration.addDefault("ZombieFriends.ZombieDialog", Arrays.asList(
- "Let's play ZombieCraft later!",
- "Feel the power of friendship!",
- "El pueblo, unido!",
- "I called my friends over!",
- "BFF power!",
- "One for all!",
- "Get him!",
- "Screw you guys, I'm going home!"
- ));
-
- configuration.addDefault("ZombieFriends.FriendDialog", Arrays.asList(
- "Don't mess with our friends!",
- "We got your back Zach!",
- "Backup has arrived!",
- "One for all, one for all!",
- "This is going to be easy!",
- "Give up we have the high ground!",
- "You wanna go bruv?",
- "Worldstaaaaaaaaar!",
- "What are you doing to our friend",
- "Feel the power of friendship!",
- "Friendship power at 100%!",
- "Zombies, assemble!",
- "We got your back mate!",
- "Together we are better!",
- "The more the merrier!",
- "I got you fam!",
- "All for one!"
- ));
-
- configuration.addDefault("ZombieNecronomicon.Summoned zombie", "Summoned Zombie");
- configuration.addDefault("ZombieNecronomicon.Summoned skeleton", "Summoned Skeleton");
- configuration.addDefault("ZombieNecronomicon.Summoning chant", "Nor is it to be thought..." +
- "that man is either the oldest " +
- "or the last of earth's masters, or that the common bulk of life and substance walks alone. The Old Ones" +
- " were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them, they " +
- "walk serene and primal, undimensioned and to us unseen. Yog-Sothoth knows the gate. Yog-Sothoth is the " +
- "gate. Yog-Sothoth is the key and guardian of the gate. Past, present, future, all are one in Yog-Sothoth. " +
- "He knows where the Old Ones broke through of old, and where They shall break through again. He knows " +
- "where They had trod earth's fields, and where They still tread them, and why no one can behold Them as " +
- "They tread. By Their smell can men sometimes know Them near, but of Their semblance can no man know, " +
- "saving only in the features of those They have begotten on mankind; and of those are there many sorts, " +
- "differing in likeness from man's truest eidolon to that shape without sight or substance which is Them. " +
- "They walk unseen and foul in lonely places where the Words have been spoken and the Rites howled through " +
- "at their Seasons. The wind gibbers with Their voices, and the earth mutters with Their consciousness. " +
- "They bend the forest and crush the city, yet may not forest or city behold the hand that smites. Kadath " +
- "in the cold waste hath known Them, and what man knows Kadath? The ice desert of the South and the sunken " +
- "isles of Ocean hold stones whereon Their seal is engraver, but who hath seen the deep frozen city or the " +
- "sealed tower long garlanded with seaweed and barnacles? Great Cthulhu is Their cousin, yet can he spy " +
- "Them only dimly. Iä! Shub-Niggurath! As a foulness shall ye know Them. Their hand is at your throats, " +
- "yet ye see Them not; and Their habitation is even one with your guarded threshold. Yog-Sothoth is the " +
- "key to the gate, whereby the spheres meet. Man rules now where They ruled once; They shall soon rule " +
- "where man rules now. After summer is winter, after winter summer. They wait patient and potent, for " +
- "here shall They reign again.");
-
- configuration.addDefault("ZombieTeamRocket.Intro", Arrays.asList(
- "Prepare for trouble!",
- "Make it double!",
- "To protect the world",
- "from devastation!",
- "To unite all people",
- "within our nation!",
- "To denounce the evils",
- "of truth and love!",
- "To extend our reach",
- "to the stars above!",
- "Jesse!",
- "James!",
- "Team Rocket blasts off",
- "at the speed of light!",
- "Surrender now",
- "or prepare to fight!",
- "Meowth! That's right!"
- ));
-
- configuration.addDefault("ZombieTeamRocket.Jesse name", "Jesse");
- configuration.addDefault("ZombieTeamRocket.James name", "James");
- configuration.addDefault("ZombieTeamRocket.Meowth name", "Meowth");
- configuration.addDefault("ZombieTeamRocket.DeathMessage", "Team rocket blasts off again!");
-
- configuration.addDefault("ZombieParents.Dad Name", "Zombie's Dad");
- configuration.addDefault("ZombieParents.Mom Name", "Zombie's Mom");
-
- configuration.addDefault("ZombieParents.DeathMessage", Arrays.asList(
- "You monster!",
- "My baby!",
- "What have you done!?",
- "Revenge!",
- "Nooooo!",
- "You will pay for that!",
- "Eh, he was adopted",
- "He's dead! Again!",
- "He's deader than before!",
- "You broke him!"
- ));
-
- configuration.addDefault("ZombieParents.ZombieDialog", Arrays.asList(
- "You're embarrassing me!",
- "He's bullying me!",
- "He's the one picking on me!",
- "I can deal with this alone!",
- "Leave me alone, I got this!",
- "Stop following me around!",
- "God this is so embarassing!",
- "He took my lunch money!",
- "He's bullying me!"
- ));
-
- configuration.addDefault("ZombieParents.ZombieDadDialog", Arrays.asList(
- "Get away from my son!",
- "Stand up for yourself son!",
- "I'll deal with him!",
- "Stop picking on my son!",
- "Why are you doing this?",
- "I'll talk to your parents!",
- "You go kiddo!",
- "Show him who's boss kiddo!",
- "Nice punch kiddo!"
- ));
-
- configuration.addDefault("ZombieParents.ZombieMomDialog", Arrays.asList(
- "Hands off my child!",
- "Are you hurt sweety?",
- "Did he hurt you sweety?",
- "Let me see that booboo sweety",
- "I'll talk to his parents!",
- "You forgot your jacket sweety!",
- "Posture, sweetheart",
- "Break it up!",
- "Stop this!",
- "Did you take out the garbage?"
- ));
-
- configuration.options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java b/src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java
deleted file mode 100644
index d239f2545..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/UnusedNodeHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.magmaguy.elitemobs.config;
-
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.Configuration;
-
-public class UnusedNodeHandler {
-
- public static Configuration clearNodes(Configuration configuration) {
-
- for (String actual : configuration.getKeys(false)) {
-
- boolean keyExists = false;
-
- for (String defaults : configuration.getDefaults().getKeys(true)) {
-
- if (actual.equals(defaults)) {
-
- keyExists = true;
-
- }
-
- }
-
- if (!keyExists) {
-
- configuration.set(actual, null);
- Bukkit.getLogger().warning(actual);
- Bukkit.getLogger().info("[EliteMobs] Deleting unused config values.");
-
- }
-
- }
-
- return configuration;
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ValidMobsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidMobsConfig.java
deleted file mode 100644
index 1bbef23a4..000000000
--- a/src/main/java/com/magmaguy/elitemobs/config/ValidMobsConfig.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
-
-import org.bukkit.configuration.Configuration;
-
-public class ValidMobsConfig {
-
- public static final String CONFIG_NAME = "ValidMobs.yml";
- public static final String ALLOW_AGGRESSIVE_ELITEMOBS = "Allow aggressive EliteMobs";
- public static final String ALLOW_PASSIVE_SUPERMOBS = "Allow Passive SuperMobs";
- public static final String VALID_SUPERMOBS = "Valid Super Mobs.";
- public static final String CHICKEN = VALID_SUPERMOBS + "CHICKEN";
- public static final String COW = VALID_SUPERMOBS + "COW";
- public static final String MUSHROOM_COW = VALID_SUPERMOBS + "MUSHROOM_COW";
- public static final String PIG = VALID_SUPERMOBS + "PIG";
- public static final String SHEEP = VALID_SUPERMOBS + "SHEEP";
- public static final String VALID_AGGRESSIVE_ELITEMOBS = "Valid aggressive EliteMobs.";
- public static final String BLAZE = VALID_AGGRESSIVE_ELITEMOBS + "BLAZE";
- public static final String CAVE_SPIDER = VALID_AGGRESSIVE_ELITEMOBS + "CAVE_SPIDER";
- public static final String CREEPER = VALID_AGGRESSIVE_ELITEMOBS + "CREEPER";
- public static final String ENDERMAN = VALID_AGGRESSIVE_ELITEMOBS + "ENDERMAN";
- public static final String ENDERMITE = VALID_AGGRESSIVE_ELITEMOBS + "ENDERMITE";
- public static final String HUSK = VALID_AGGRESSIVE_ELITEMOBS + "HUSK";
- public static final String IRON_GOLEM = VALID_AGGRESSIVE_ELITEMOBS + "IRON_GOLEM";
- public static final String PIG_ZOMBIE = VALID_AGGRESSIVE_ELITEMOBS + "PIG_ZOMBIE";
- public static final String POLAR_BEAR = VALID_AGGRESSIVE_ELITEMOBS + "POLAR_BEAR";
- public static final String SILVERFISH = VALID_AGGRESSIVE_ELITEMOBS + "SILVERFISH";
- public static final String STRAY = VALID_AGGRESSIVE_ELITEMOBS + "STRAY";
- public static final String SKELETON = VALID_AGGRESSIVE_ELITEMOBS + "SKELETON";
- public static final String WITHER_SKELETON = VALID_AGGRESSIVE_ELITEMOBS + "WITHER_SKELETON";
- public static final String SPIDER = VALID_AGGRESSIVE_ELITEMOBS + "SPIDER";
- public static final String VEX = VALID_AGGRESSIVE_ELITEMOBS + "VEX";
- public static final String VINDICATOR = VALID_AGGRESSIVE_ELITEMOBS + "VINDICATOR";
- public static final String WITCH = VALID_AGGRESSIVE_ELITEMOBS + "WITCH";
- public static final String ZOMBIE = VALID_AGGRESSIVE_ELITEMOBS + "ZOMBIE";
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
-
- public void initializeConfig() {
-
- configuration.addDefault(ALLOW_AGGRESSIVE_ELITEMOBS, true);
- configuration.addDefault(BLAZE, true);
- configuration.addDefault(CAVE_SPIDER, true);
- configuration.addDefault(CREEPER, true);
- configuration.addDefault(ENDERMAN, true);
- configuration.addDefault(ENDERMITE, true);
- configuration.addDefault(HUSK, true);
- configuration.addDefault(IRON_GOLEM, true);
- configuration.addDefault(PIG_ZOMBIE, true);
- configuration.addDefault(POLAR_BEAR, true);
- configuration.addDefault(SILVERFISH, true);
- configuration.addDefault(SKELETON, true);
- configuration.addDefault(WITHER_SKELETON, true);
- configuration.addDefault(SPIDER, true);
- configuration.addDefault(STRAY, true);
- configuration.addDefault(VEX, true);
- configuration.addDefault(VINDICATOR, true);
- configuration.addDefault(WITCH, true);
- configuration.addDefault(ZOMBIE, true);
- configuration.addDefault(ALLOW_PASSIVE_SUPERMOBS, true);
- configuration.addDefault(CHICKEN, true);
- configuration.addDefault(COW, true);
- configuration.addDefault(MUSHROOM_COW, true);
- configuration.addDefault(PIG, true);
- configuration.addDefault(SHEEP, true);
-
-
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
-
- }
-
-}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java
index b9918237d..fe1a8dc9e 100644
--- a/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java
+++ b/src/main/java/com/magmaguy/elitemobs/config/ValidWorldsConfig.java
@@ -1,43 +1,45 @@
-/*
- * 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 com.magmaguy.elitemobs.config;
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.World;
-import org.bukkit.configuration.Configuration;
+import org.bukkit.configuration.ConfigurationSection;
-public class ValidWorldsConfig {
+import java.util.ArrayList;
+import java.util.List;
- public static final String CONFIG_NAME = "ValidWorlds.yml";
- CustomConfigLoader customConfigLoader = new CustomConfigLoader();
- private Configuration configuration = customConfigLoader.getCustomConfig(CONFIG_NAME);
+public class ValidWorldsConfig extends ConfigurationFile {
+ @Getter
+ private static final List validWorlds = new ArrayList<>();
+ @Getter
+ private static ValidWorldsConfig instance;
- public void initializeConfig() {
+ public ValidWorldsConfig() {
+ super("ValidWorlds.yml");
+ instance = this;
+ }
- for (World world : Bukkit.getWorlds()) {
+ public static void addWorld(String worldName) {
+ if (instance.fileConfiguration.getKeys(true).contains("Valid worlds." + worldName)) return;
- configuration.addDefault("Valid worlds." + world.getName(), true);
+ ConfigurationEngine.setBoolean(
+ List.of("Sets if elites will spawn in this world."),
+ instance.fileConfiguration, "Valid worlds." + worldName, true);
+ ConfigurationEngine.fileSaverOnlyDefaults(instance.fileConfiguration, instance.file);
+ validWorlds.add(worldName);
+ }
- }
+ @Override
+ public void initializeValues() {
- customConfigLoader.getCustomConfig(CONFIG_NAME).options().copyDefaults(true);
- UnusedNodeHandler.clearNodes(configuration);
- customConfigLoader.saveDefaultCustomConfig(CONFIG_NAME);
- customConfigLoader.saveCustomConfig(CONFIG_NAME);
+ for (World world : Bukkit.getWorlds())
+ ConfigurationEngine.setBoolean(fileConfiguration, "Valid worlds." + world.getName(), true);
- }
+ ConfigurationSection validWorldsSection = fileConfiguration.getConfigurationSection("Valid worlds");
+ for (String key : validWorldsSection.getKeys(false))
+ if (validWorldsSection.getBoolean(key))
+ validWorlds.add(key);
+ }
}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java
new file mode 100644
index 000000000..3eb1a4150
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/WormholesConfig.java
@@ -0,0 +1,42 @@
+package com.magmaguy.elitemobs.config;
+
+import com.magmaguy.magmacore.config.ConfigurationFile;
+import lombok.Getter;
+
+import java.util.List;
+
+public class WormholesConfig extends ConfigurationFile {
+ @Getter
+ private static String dungeonNotInstalledMessage;
+ @Getter
+ private static String defaultPortalMissingMessage;
+ @Getter
+ private static boolean reducedParticlesMode;
+ @Getter
+ private static boolean noParticlesMode;
+ @Getter
+ private static String insufficientCurrencyForWormholeMessage;
+
+ public WormholesConfig() {
+ super("Wormholes.yml");
+ }
+
+ @Override
+ public void initializeValues() {
+ dungeonNotInstalledMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when a teleport is used for a dungeon that is not installed."),
+ file, fileConfiguration, "dungeonNotInstalledMessage", "&8[EliteMobs] &cDungeon $dungeonID &cis not installed! This teleport will not work.", true);
+ defaultPortalMissingMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that appears when a wormhole is used for a dungeon that is not installed."),
+ file, fileConfiguration, "defaultPortalMissingMessage", "&8[EliteMobs] &cThis portal doesn't seem to lead anywhere!", true);
+ reducedParticlesMode = ConfigurationEngine.setBoolean(
+ List.of("Sets if the reduced particles mode for wormholes is used. This is especially recommended if you are allowing bedrock clients in."),
+ fileConfiguration, "reducedParticlesMode", true);
+ noParticlesMode = ConfigurationEngine.setBoolean(
+ List.of("Sets if wormholes don't use particles at all. Not recommended, but might be necessary for really bad bedrock clients."),
+ fileConfiguration, "noParticlesMode", false);
+ insufficientCurrencyForWormholeMessage = ConfigurationEngine.setString(
+ List.of("Sets the message that is sent when a player tries to use a wormhole but does not have enough currency to use it."),
+ file, fileConfiguration, "insufficientCurrencyForWormholeMessage", "&8[EliteMobs] &cInsufficient currency! You need $amount to use this wormhole!", true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java b/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java
new file mode 100644
index 000000000..ce53ee642
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfig.java
@@ -0,0 +1,46 @@
+package com.magmaguy.elitemobs.config.commands;
+
+import com.magmaguy.elitemobs.config.ConfigurationEngine;
+import com.magmaguy.elitemobs.config.commands.premade.CheckTierConfig;
+import com.magmaguy.elitemobs.config.commands.premade.CheckTierOthersConfig;
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class CommandsConfig {
+
+ private static final ArrayList commandsConfigFields = new ArrayList<>(new ArrayList<>(List.of(
+ new CheckTierConfig(),
+ new CheckTierOthersConfig()
+ )));
+
+ private CommandsConfig() {
+
+ }
+
+ public static void initializeConfigs() {
+ //Checks if the directory doesn't exist
+ for (CommandsConfigFields commandsConfigFields : commandsConfigFields)
+ initializeConfiguration(commandsConfigFields);
+ }
+
+ /**
+ * Initializes a single instance of a premade configuration using the default values.
+ *
+ * @param commandsConfigFields
+ * @return
+ */
+ private static FileConfiguration initializeConfiguration(CommandsConfigFields commandsConfigFields) {
+
+ File file = ConfigurationEngine.fileCreator("commands", commandsConfigFields.getFileName());
+ FileConfiguration fileConfiguration = ConfigurationEngine.fileConfigurationCreator(file);
+ commandsConfigFields.generateConfigDefaults(file, fileConfiguration);
+ ConfigurationEngine.fileSaverOnlyDefaults(fileConfiguration, file);
+
+ return fileConfiguration;
+
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfigFields.java
new file mode 100644
index 000000000..7395f5b74
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/commands/CommandsConfigFields.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.config.commands;
+
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.io.File;
+
+public class CommandsConfigFields {
+
+ private String fileName;
+
+ public CommandsConfigFields(String fileName) {
+ this.fileName = fileName + ".yml";
+ }
+
+ public CommandsConfigFields(FileConfiguration configuration) {
+
+ }
+
+ public void generateConfigDefaults(File file, FileConfiguration fileConfiguration) {
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/commands/premade/CheckTierConfig.java b/src/main/java/com/magmaguy/elitemobs/config/commands/premade/CheckTierConfig.java
new file mode 100644
index 000000000..aac1cae31
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/commands/premade/CheckTierConfig.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.config.commands.premade;
+
+import com.magmaguy.elitemobs.config.ConfigurationEngine;
+import com.magmaguy.elitemobs.config.commands.CommandsConfigFields;
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.io.File;
+
+public class CheckTierConfig extends CommandsConfigFields {
+ public static String message1, message2, message3, noPermMessage;
+
+ public CheckTierConfig() {
+ super("check_tier");
+ }
+
+ @Override
+ public void generateConfigDefaults(File file, FileConfiguration fileConfiguration) {
+ message1 = ConfigurationEngine.setString(file, fileConfiguration, "message1", "&7[EM] Your combat tier is $tier", true);
+ message2 = ConfigurationEngine.setString(file, fileConfiguration, "message2", "&7[EM] Your guild tier bonus is $tier", true);
+ message3 = ConfigurationEngine.setString(file, fileConfiguration, "message3", "&7[EM] &aYour total threat tier is $tier", true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/commands/premade/CheckTierOthersConfig.java b/src/main/java/com/magmaguy/elitemobs/config/commands/premade/CheckTierOthersConfig.java
new file mode 100644
index 000000000..5fb50b118
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/commands/premade/CheckTierOthersConfig.java
@@ -0,0 +1,23 @@
+package com.magmaguy.elitemobs.config.commands.premade;
+
+import com.magmaguy.elitemobs.config.ConfigurationEngine;
+import com.magmaguy.elitemobs.config.commands.CommandsConfigFields;
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.io.File;
+
+public class CheckTierOthersConfig extends CommandsConfigFields {
+ public static String message1, message2, message3, noPermMessage;
+
+ public CheckTierOthersConfig() {
+ super("check_tier_others");
+ }
+
+ @Override
+ public void generateConfigDefaults(File file, FileConfiguration fileConfiguration) {
+ message1 = ConfigurationEngine.setString(file, fileConfiguration, "message1", "&7[EM] $player's combat tier is $tier", true);
+ message2 = ConfigurationEngine.setString(file, fileConfiguration, "message2", "&7[EM] $player's guild tier bonus is $tier", true);
+ message3 = ConfigurationEngine.setString(file, fileConfiguration, "message3", "&7[EM] &a$player's total threat tier is $tier", true);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java
new file mode 100644
index 000000000..ec86cfb9c
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfig.java
@@ -0,0 +1,26 @@
+package com.magmaguy.elitemobs.config.customarenas;
+
+import com.magmaguy.elitemobs.instanced.arena.ArenaInstance;
+import com.magmaguy.magmacore.config.CustomConfig;
+
+import java.util.HashMap;
+
+public class CustomArenasConfig extends CustomConfig {
+
+ private static HashMap customArenas;
+
+ public CustomArenasConfig() {
+ super("customarenas", "com.magmaguy.elitemobs.config.customarenas.premade", CustomArenasConfigFields.class);
+ customArenas = new HashMap<>();
+ for (String key : super.getCustomConfigFieldsHashMap().keySet())
+ if (super.getCustomConfigFieldsHashMap().get(key).isEnabled()) {
+ customArenas.put(key, (CustomArenasConfigFields) super.getCustomConfigFieldsHashMap().get(key));
+ ArenaInstance.initializeArena((CustomArenasConfigFields) super.getCustomConfigFieldsHashMap().get(key));
+ }
+ }
+
+ public static CustomArenasConfigFields getCustomArena(String string) {
+ return customArenas.get(string);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java
new file mode 100644
index 000000000..2ae2f1f42
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/customarenas/CustomArenasConfigFields.java
@@ -0,0 +1,91 @@
+package com.magmaguy.elitemobs.config.customarenas;
+
+import com.magmaguy.elitemobs.config.CustomConfigFields;
+import com.magmaguy.elitemobs.items.customloottable.CustomLootTable;
+import lombok.Getter;
+import lombok.Setter;
+import org.bukkit.Location;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CustomArenasConfigFields extends CustomConfigFields {
+
+ @Getter
+ @Setter
+ private String arenaName;
+ @Getter
+ @Setter
+ private String corner1;
+ @Getter
+ @Setter
+ private String corner2;
+ @Getter
+ @Setter
+ private String startLocation;
+ @Getter
+ @Setter
+ private String exitLocation;
+ @Getter
+ @Setter
+ private int waveCount;
+ @Getter
+ @Setter
+ private int delayBetweenWaves;
+ @Getter
+ @Setter
+ private List spawnPoints = new ArrayList<>();
+ @Getter
+ @Setter
+ private List bossList = new ArrayList<>();
+ @Getter
+ @Setter
+ private List rawArenaRewards = new ArrayList<>();
+ @Getter
+ @Setter
+ private CustomLootTable arenaRewards;
+ @Getter
+ @Setter
+ private int minimumPlayerCount = 1;
+ @Getter
+ @Setter
+ private int maximumPlayerCount;
+ @Getter
+ @Setter
+ private List arenaMessages = new ArrayList<>();
+ @Getter
+ @Setter
+ private boolean cylindricalArena = false;
+ @Getter
+ @Setter
+ private String permission = null;
+ @Getter
+ private Location teleportLocation = null;
+
+ public CustomArenasConfigFields(String filename, boolean isEnabled) {
+ super(filename, isEnabled);
+ }
+
+ @Override
+ public void processConfigFields() {
+ this.isEnabled = processBoolean("isEnabled", isEnabled, true, true);
+ this.arenaName = translatable(filename, "arenaName", processString("arenaName", arenaName, "Default name", false));
+ this.corner1 = processString("corner1", corner1, null, false);
+ this.corner2 = processString("corner2", corner2, null, false);
+ this.startLocation = processString("startLocation", startLocation, null, false);
+ this.exitLocation = processString("exitLocation", exitLocation, null, false);
+ this.waveCount = processInt("waveCount", waveCount, 0, false);
+ this.delayBetweenWaves = processInt("delayBetweenWaves", delayBetweenWaves, 0, false);
+ this.spawnPoints = processStringList("spawnPoints", spawnPoints, new ArrayList<>(), false);
+ this.bossList = processStringList("bossList", bossList, new ArrayList<>(), false);
+ this.rawArenaRewards = processStringList("rawArenaReward", rawArenaRewards, new ArrayList<>(), false);
+ arenaRewards = new CustomLootTable(this);
+ this.minimumPlayerCount = processInt("minimumPlayerCount", minimumPlayerCount, 1, false);
+ this.maximumPlayerCount = processInt("maximumPlayerCount", maximumPlayerCount, 100, false);
+ this.arenaMessages = translatable(filename, "arenaMessages", processStringList("arenaMessages", arenaMessages, new ArrayList<>(), false));
+ this.cylindricalArena = processBoolean("cylindricalArena", cylindricalArena, false, false);
+ this.permission = processString("permission", permission, null, false);
+ this.teleportLocation = processLocation("teleportLocation", teleportLocation, null, false);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java b/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java
new file mode 100644
index 000000000..e8a03f797
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/customarenas/premade/WoodLeagueArena.java
@@ -0,0 +1,814 @@
+package com.magmaguy.elitemobs.config.customarenas.premade;
+
+import com.magmaguy.elitemobs.config.customarenas.CustomArenasConfigFields;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class WoodLeagueArena extends CustomArenasConfigFields {
+ public WoodLeagueArena() {
+ super("wood_league", true);
+ super.setArenaName("Wood League");
+ super.setCorner1("em_adventurers_guild,257,69,333,0,0");
+ super.setCorner2("em_adventurers_guild,181,91,257,0,0");
+ super.setStartLocation("em_adventurers_guild,219.5,70,295.5,0,0");
+ super.setExitLocation("em_adventurers_guild,242.5,92,269.5,84,0");
+ super.setWaveCount(50);
+ super.setBossList(new ArrayList<>(List.of(
+ "wave=1:spawnPoint=north:boss=wood_league_wave_1_melee.yml",
+ "wave=1:spawnPoint=north:boss=wood_league_wave_1_melee.yml",
+ "wave=1:spawnPoint=north:boss=wood_league_wave_1_ranged.yml",
+
+ "wave=2:spawnPoint=north:boss=wood_league_wave_2_melee.yml",
+ "wave=2:spawnPoint=north:boss=wood_league_wave_2_melee.yml",
+ "wave=2:spawnPoint=north:boss=wood_league_wave_2_ranged.yml",
+ "wave=2:spawnPoint=south:boss=wood_league_wave_2_melee.yml",
+ "wave=2:spawnPoint=south:boss=wood_league_wave_2_melee.yml",
+ "wave=2:spawnPoint=south:boss=wood_league_wave_2_ranged.yml",
+
+ "wave=3:spawnPoint=north:boss=wood_league_wave_3_melee.yml",
+ "wave=3:spawnPoint=north:boss=wood_league_wave_3_melee.yml",
+ "wave=3:spawnPoint=north:boss=wood_league_wave_3_ranged.yml",
+ "wave=3:spawnPoint=south:boss=wood_league_wave_3_melee.yml",
+ "wave=3:spawnPoint=south:boss=wood_league_wave_3_melee.yml",
+ "wave=3:spawnPoint=south:boss=wood_league_wave_3_ranged.yml",
+
+ "wave=4:spawnPoint=north:boss=wood_league_wave_4_melee.yml",
+ "wave=4:spawnPoint=north:boss=wood_league_wave_4_melee.yml",
+ "wave=4:spawnPoint=north:boss=wood_league_wave_4_ranged.yml",
+ "wave=4:spawnPoint=south:boss=wood_league_wave_4_melee.yml",
+ "wave=4:spawnPoint=south:boss=wood_league_wave_4_melee.yml",
+ "wave=4:spawnPoint=south:boss=wood_league_wave_4_ranged.yml",
+
+ "wave=5:spawnPoint=center:boss=wood_league_wave_5_miniboss.yml",
+
+ "wave=6:spawnPoint=north:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=north:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=north:boss=wood_league_wave_6_ranged.yml",
+ "wave=6:spawnPoint=south:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=south:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=south:boss=wood_league_wave_6_ranged.yml",
+ "wave=6:spawnPoint=east:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=east:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=east:boss=wood_league_wave_6_ranged.yml",
+ "wave=6:spawnPoint=west:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=west:boss=wood_league_wave_6_melee.yml",
+ "wave=6:spawnPoint=west:boss=wood_league_wave_6_ranged.yml",
+
+ "wave=7:spawnPoint=north:boss=wood_league_wave_7_melee.yml",
+ "wave=7:spawnPoint=north:boss=wood_league_wave_7_melee.yml",
+ "wave=7:spawnPoint=north:boss=wood_league_wave_7_ranged.yml",
+ "wave=7:spawnPoint=south:boss=wood_league_wave_7_melee.yml",
+ "wave=7:spawnPoint=south:boss=wood_league_wave_7_melee.yml",
+ "wave=7:spawnPoint=south:boss=wood_league_wave_7_ranged.yml",
+
+ "wave=8:spawnPoint=north:boss=wood_league_wave_8_melee.yml",
+ "wave=8:spawnPoint=north:boss=wood_league_wave_8_melee.yml",
+ "wave=8:spawnPoint=north:boss=wood_league_wave_8_melee.yml",
+ "wave=8:spawnPoint=south:boss=wood_league_wave_8_melee.yml",
+ "wave=8:spawnPoint=south:boss=wood_league_wave_8_melee.yml",
+ "wave=8:spawnPoint=south:boss=wood_league_wave_8_melee.yml",
+
+ "wave=9:spawnPoint=north:boss=wood_league_wave_9_ranged.yml",
+ "wave=9:spawnPoint=north:boss=wood_league_wave_9_ranged.yml",
+ "wave=9:spawnPoint=north:boss=wood_league_wave_9_ranged.yml",
+ "wave=9:spawnPoint=south:boss=wood_league_wave_9_ranged.yml",
+ "wave=9:spawnPoint=south:boss=wood_league_wave_9_ranged.yml",
+ "wave=9:spawnPoint=south:boss=wood_league_wave_9_ranged.yml",
+
+ "wave=10:spawnPoint=center:boss=wood_league_wave_10_boss.yml",
+
+ "wave=11:spawnPoint=north:boss=wood_league_wave_11_melee.yml",
+ "wave=11:spawnPoint=north:boss=wood_league_wave_11_melee.yml",
+ "wave=11:spawnPoint=north:boss=wood_league_wave_11_ranged.yml",
+ "wave=11:spawnPoint=south:boss=wood_league_wave_11_melee.yml",
+ "wave=11:spawnPoint=south:boss=wood_league_wave_11_melee.yml",
+ "wave=11:spawnPoint=south:boss=wood_league_wave_11_ranged.yml",
+
+ "wave=12:spawnPoint=north:boss=wood_league_wave_12_melee.yml",
+ "wave=12:spawnPoint=north:boss=wood_league_wave_12_melee.yml",
+ "wave=12:spawnPoint=north:boss=wood_league_wave_12_ranged.yml",
+ "wave=12:spawnPoint=south:boss=wood_league_wave_12_melee.yml",
+ "wave=12:spawnPoint=south:boss=wood_league_wave_12_melee.yml",
+ "wave=12:spawnPoint=south:boss=wood_league_wave_12_ranged.yml",
+ "wave=12:spawnPoint=east:boss=wood_league_wave_12_melee.yml",
+ "wave=12:spawnPoint=east:boss=wood_league_wave_12_melee.yml",
+ "wave=12:spawnPoint=east:boss=wood_league_wave_12_ranged.yml",
+
+ "wave=13:spawnPoint=north:boss=wood_league_wave_13_melee.yml",
+ "wave=13:spawnPoint=north:boss=wood_league_wave_13_melee.yml",
+ "wave=13:spawnPoint=north:boss=wood_league_wave_13_ranged.yml",
+ "wave=13:spawnPoint=south:boss=wood_league_wave_13_melee.yml",
+ "wave=13:spawnPoint=south:boss=wood_league_wave_13_melee.yml",
+ "wave=13:spawnPoint=south:boss=wood_league_wave_13_ranged.yml",
+ "wave=13:spawnPoint=east:boss=wood_league_wave_13_melee.yml",
+ "wave=13:spawnPoint=east:boss=wood_league_wave_13_melee.yml",
+ "wave=13:spawnPoint=east:boss=wood_league_wave_13_ranged.yml",
+
+ "wave=14:spawnPoint=north:boss=wood_league_wave_14_melee.yml",
+ "wave=14:spawnPoint=north:boss=wood_league_wave_14_melee.yml",
+ "wave=14:spawnPoint=north:boss=wood_league_wave_14_ranged.yml",
+ "wave=14:spawnPoint=south:boss=wood_league_wave_14_melee.yml",
+ "wave=14:spawnPoint=south:boss=wood_league_wave_14_melee.yml",
+ "wave=14:spawnPoint=south:boss=wood_league_wave_14_ranged.yml",
+ "wave=14:spawnPoint=east:boss=wood_league_wave_14_melee.yml",
+ "wave=14:spawnPoint=east:boss=wood_league_wave_14_melee.yml",
+ "wave=14:spawnPoint=east:boss=wood_league_wave_14_ranged.yml",
+
+ "wave=15:spawnPoint=center:boss=wood_league_wave_15_miniboss.yml",
+
+ "wave=16:spawnPoint=north:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=north:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=north:boss=wood_league_wave_16_ranged.yml",
+ "wave=16:spawnPoint=south:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=south:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=south:boss=wood_league_wave_16_ranged.yml",
+ "wave=16:spawnPoint=east:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=east:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=east:boss=wood_league_wave_16_ranged.yml",
+ "wave=16:spawnPoint=west:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=west:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=west:boss=wood_league_wave_16_ranged.yml",
+ "wave=16:spawnPoint=northeast:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=northeast:boss=wood_league_wave_16_melee.yml",
+ "wave=16:spawnPoint=northeast:boss=wood_league_wave_16_ranged.yml",
+
+ "wave=17:spawnPoint=north:boss=wood_league_wave_17_melee.yml",
+ "wave=17:spawnPoint=north:boss=wood_league_wave_17_melee.yml",
+ "wave=17:spawnPoint=north:boss=wood_league_wave_17_ranged.yml",
+ "wave=17:spawnPoint=south:boss=wood_league_wave_17_melee.yml",
+ "wave=17:spawnPoint=south:boss=wood_league_wave_17_melee.yml",
+ "wave=17:spawnPoint=south:boss=wood_league_wave_17_ranged.yml",
+ "wave=17:spawnPoint=east:boss=wood_league_wave_17_melee.yml",
+ "wave=17:spawnPoint=east:boss=wood_league_wave_17_melee.yml",
+ "wave=17:spawnPoint=east:boss=wood_league_wave_17_ranged.yml",
+
+ "wave=18:spawnPoint=north:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=north:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=north:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=south:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=south:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=south:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=east:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=east:boss=wood_league_wave_18_melee.yml",
+ "wave=18:spawnPoint=east:boss=wood_league_wave_18_melee.yml",
+
+ "wave=19:spawnPoint=north:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=north:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=north:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=south:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=south:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=south:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=east:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=east:boss=wood_league_wave_19_ranged.yml",
+ "wave=19:spawnPoint=east:boss=wood_league_wave_19_ranged.yml",
+
+ "wave=20:spawnPoint=center:boss=wood_league_wave_20_boss.yml",
+
+ "wave=21:spawnPoint=north:boss=wood_league_wave_21_melee.yml",
+ "wave=21:spawnPoint=north:boss=wood_league_wave_21_melee.yml",
+ "wave=21:spawnPoint=north:boss=wood_league_wave_21_ranged.yml",
+ "wave=21:spawnPoint=south:boss=wood_league_wave_21_melee.yml",
+ "wave=21:spawnPoint=south:boss=wood_league_wave_21_melee.yml",
+ "wave=21:spawnPoint=south:boss=wood_league_wave_21_ranged.yml",
+ "wave=21:spawnPoint=east:boss=wood_league_wave_21_melee.yml",
+ "wave=21:spawnPoint=east:boss=wood_league_wave_21_melee.yml",
+ "wave=21:spawnPoint=east:boss=wood_league_wave_21_ranged.yml",
+
+ "wave=22:spawnPoint=north:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=north:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=north:boss=wood_league_wave_22_ranged.yml",
+ "wave=22:spawnPoint=south:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=south:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=south:boss=wood_league_wave_22_ranged.yml",
+ "wave=22:spawnPoint=east:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=east:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=east:boss=wood_league_wave_22_ranged.yml",
+ "wave=22:spawnPoint=west:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=west:boss=wood_league_wave_22_melee.yml",
+ "wave=22:spawnPoint=west:boss=wood_league_wave_22_ranged.yml",
+
+ "wave=23:spawnPoint=north:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=north:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=north:boss=wood_league_wave_23_ranged.yml",
+ "wave=23:spawnPoint=south:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=south:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=south:boss=wood_league_wave_23_ranged.yml",
+ "wave=23:spawnPoint=east:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=east:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=east:boss=wood_league_wave_23_ranged.yml",
+ "wave=23:spawnPoint=west:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=west:boss=wood_league_wave_23_melee.yml",
+ "wave=23:spawnPoint=west:boss=wood_league_wave_23_ranged.yml",
+
+ "wave=24:spawnPoint=north:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=north:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=north:boss=wood_league_wave_24_ranged.yml",
+ "wave=24:spawnPoint=south:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=south:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=south:boss=wood_league_wave_24_ranged.yml",
+ "wave=24:spawnPoint=east:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=east:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=east:boss=wood_league_wave_24_ranged.yml",
+ "wave=24:spawnPoint=west:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=west:boss=wood_league_wave_24_melee.yml",
+ "wave=24:spawnPoint=west:boss=wood_league_wave_24_ranged.yml",
+
+ "wave=25:spawnPoint=center:boss=wood_league_wave_25_miniboss.yml",
+
+ "wave=26:spawnPoint=north:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=north:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=north:boss=wood_league_wave_26_ranged.yml",
+ "wave=26:spawnPoint=south:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=south:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=south:boss=wood_league_wave_26_ranged.yml",
+ "wave=26:spawnPoint=east:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=east:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=east:boss=wood_league_wave_26_ranged.yml",
+ "wave=26:spawnPoint=west:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=west:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=west:boss=wood_league_wave_26_ranged.yml",
+ "wave=26:spawnPoint=northeast:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=northeast:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=northeast:boss=wood_league_wave_26_ranged.yml",
+ "wave=26:spawnPoint=southwest:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=southwest:boss=wood_league_wave_26_melee.yml",
+ "wave=26:spawnPoint=southwest:boss=wood_league_wave_26_ranged.yml",
+
+ "wave=27:spawnPoint=north:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=north:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=north:boss=wood_league_wave_27_ranged.yml",
+ "wave=27:spawnPoint=south:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=south:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=south:boss=wood_league_wave_27_ranged.yml",
+ "wave=27:spawnPoint=east:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=east:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=east:boss=wood_league_wave_27_ranged.yml",
+ "wave=27:spawnPoint=west:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=west:boss=wood_league_wave_27_melee.yml",
+ "wave=27:spawnPoint=west:boss=wood_league_wave_27_ranged.yml",
+
+ "wave=28:spawnPoint=north:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=north:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=north:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=south:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=south:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=south:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=east:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=east:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=east:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=west:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=west:boss=wood_league_wave_28_melee.yml",
+ "wave=28:spawnPoint=west:boss=wood_league_wave_28_melee.yml",
+
+ "wave=29:spawnPoint=north:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=north:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=north:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=south:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=south:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=south:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=east:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=east:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=east:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=west:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=west:boss=wood_league_wave_29_ranged.yml",
+ "wave=29:spawnPoint=west:boss=wood_league_wave_29_ranged.yml",
+
+ "wave=30:spawnPoint=center:boss=wood_league_wave_30_boss.yml",
+
+ "wave=31:spawnPoint=north:boss=wood_league_wave_31_ranged.yml",
+ "wave=31:spawnPoint=north:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=north:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=south:boss=wood_league_wave_31_ranged.yml",
+ "wave=31:spawnPoint=south:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=south:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=east:boss=wood_league_wave_31_ranged.yml",
+ "wave=31:spawnPoint=east:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=east:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=west:boss=wood_league_wave_31_ranged.yml",
+ "wave=31:spawnPoint=west:boss=wood_league_wave_31_melee.yml",
+ "wave=31:spawnPoint=west:boss=wood_league_wave_31_melee.yml",
+
+ "wave=32:spawnPoint=north:boss=wood_league_wave_32_ranged.yml",
+ "wave=32:spawnPoint=north:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=north:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=south:boss=wood_league_wave_32_ranged.yml",
+ "wave=32:spawnPoint=south:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=south:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=east:boss=wood_league_wave_32_ranged.yml",
+ "wave=32:spawnPoint=east:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=east:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=west:boss=wood_league_wave_32_ranged.yml",
+ "wave=32:spawnPoint=west:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=west:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=northeast:boss=wood_league_wave_32_ranged.yml",
+ "wave=32:spawnPoint=northeast:boss=wood_league_wave_32_melee.yml",
+ "wave=32:spawnPoint=northeast:boss=wood_league_wave_32_melee.yml",
+
+ "wave=33:spawnPoint=north:boss=wood_league_wave_33_ranged.yml",
+ "wave=33:spawnPoint=north:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=north:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=south:boss=wood_league_wave_33_ranged.yml",
+ "wave=33:spawnPoint=south:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=south:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=east:boss=wood_league_wave_33_ranged.yml",
+ "wave=33:spawnPoint=east:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=east:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=west:boss=wood_league_wave_33_ranged.yml",
+ "wave=33:spawnPoint=west:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=west:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=northeast:boss=wood_league_wave_33_ranged.yml",
+ "wave=33:spawnPoint=northeast:boss=wood_league_wave_33_melee.yml",
+ "wave=33:spawnPoint=northeast:boss=wood_league_wave_33_melee.yml",
+
+ "wave=34:spawnPoint=north:boss=wood_league_wave_34_ranged.yml",
+ "wave=34:spawnPoint=north:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=north:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=south:boss=wood_league_wave_34_ranged.yml",
+ "wave=34:spawnPoint=south:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=south:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=east:boss=wood_league_wave_34_ranged.yml",
+ "wave=34:spawnPoint=east:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=east:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=west:boss=wood_league_wave_34_ranged.yml",
+ "wave=34:spawnPoint=west:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=west:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=northeast:boss=wood_league_wave_34_ranged.yml",
+ "wave=34:spawnPoint=northeast:boss=wood_league_wave_34_melee.yml",
+ "wave=34:spawnPoint=northeast:boss=wood_league_wave_34_melee.yml",
+
+ "wave=35:spawnPoint=center:boss=wood_league_wave_35_miniboss.yml",
+
+ "wave=36:spawnPoint=north:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=north:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=north:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=south:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=south:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=south:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=east:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=east:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=east:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=west:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=west:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=west:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=northeast:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=northeast:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=northeast:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=southwest:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=southwest:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=southwest:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=southeast:boss=wood_league_wave_36_ranged.yml",
+ "wave=36:spawnPoint=southeast:boss=wood_league_wave_36_melee.yml",
+ "wave=36:spawnPoint=southeast:boss=wood_league_wave_36_melee.yml",
+
+ "wave=37:spawnPoint=north:boss=wood_league_wave_37_ranged.yml",
+ "wave=37:spawnPoint=north:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=north:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=south:boss=wood_league_wave_37_ranged.yml",
+ "wave=37:spawnPoint=south:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=south:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=east:boss=wood_league_wave_37_ranged.yml",
+ "wave=37:spawnPoint=east:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=east:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=west:boss=wood_league_wave_37_ranged.yml",
+ "wave=37:spawnPoint=west:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=west:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=northeast:boss=wood_league_wave_37_ranged.yml",
+ "wave=37:spawnPoint=northeast:boss=wood_league_wave_37_melee.yml",
+ "wave=37:spawnPoint=northeast:boss=wood_league_wave_37_melee.yml",
+
+ "wave=38:spawnPoint=north:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=north:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=north:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=south:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=south:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=south:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=east:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=east:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=east:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=west:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=west:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=west:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=northeast:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=northeast:boss=wood_league_wave_38_melee.yml",
+ "wave=38:spawnPoint=northeast:boss=wood_league_wave_38_melee.yml",
+
+ "wave=39:spawnPoint=north:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=north:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=north:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=south:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=south:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=south:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=east:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=east:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=east:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=west:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=west:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=west:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=northeast:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=northeast:boss=wood_league_wave_39_ranged.yml",
+ "wave=39:spawnPoint=northeast:boss=wood_league_wave_39_ranged.yml",
+
+ "wave=40:spawnPoint=center:boss=wood_league_wave_40_boss.yml",
+
+ "wave=41:spawnPoint=north:boss=wood_league_wave_41_ranged.yml",
+ "wave=41:spawnPoint=north:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=north:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=south:boss=wood_league_wave_41_ranged.yml",
+ "wave=41:spawnPoint=south:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=south:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=east:boss=wood_league_wave_41_ranged.yml",
+ "wave=41:spawnPoint=east:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=east:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=west:boss=wood_league_wave_41_ranged.yml",
+ "wave=41:spawnPoint=west:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=west:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=northeast:boss=wood_league_wave_41_ranged.yml",
+ "wave=41:spawnPoint=northeast:boss=wood_league_wave_41_melee.yml",
+ "wave=41:spawnPoint=northeast:boss=wood_league_wave_41_melee.yml",
+
+ "wave=42:spawnPoint=north:boss=wood_league_wave_42_ranged.yml",
+ "wave=42:spawnPoint=north:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=north:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=north:boss=wood_league_wave_42_healer.yml",
+ "wave=42:spawnPoint=south:boss=wood_league_wave_42_ranged.yml",
+ "wave=42:spawnPoint=south:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=south:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=south:boss=wood_league_wave_42_healer.yml",
+ "wave=42:spawnPoint=east:boss=wood_league_wave_42_ranged.yml",
+ "wave=42:spawnPoint=east:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=east:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=east:boss=wood_league_wave_42_healer.yml",
+ "wave=42:spawnPoint=west:boss=wood_league_wave_42_ranged.yml",
+ "wave=42:spawnPoint=west:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=west:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=west:boss=wood_league_wave_42_healer.yml",
+ "wave=42:spawnPoint=northeast:boss=wood_league_wave_42_ranged.yml",
+ "wave=42:spawnPoint=northeast:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=northeast:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=northeast:boss=wood_league_wave_42_healer.yml",
+ "wave=42:spawnPoint=southwest:boss=wood_league_wave_42_ranged.yml",
+ "wave=42:spawnPoint=southwest:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=southwest:boss=wood_league_wave_42_melee.yml",
+ "wave=42:spawnPoint=southwest:boss=wood_league_wave_42_healer.yml",
+
+ "wave=43:spawnPoint=north:boss=wood_league_wave_43_ranged.yml",
+ "wave=43:spawnPoint=north:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=north:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=north:boss=wood_league_wave_43_healer.yml",
+ "wave=43:spawnPoint=south:boss=wood_league_wave_43_ranged.yml",
+ "wave=43:spawnPoint=south:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=south:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=south:boss=wood_league_wave_43_healer.yml",
+ "wave=43:spawnPoint=east:boss=wood_league_wave_43_ranged.yml",
+ "wave=43:spawnPoint=east:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=east:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=east:boss=wood_league_wave_43_healer.yml",
+ "wave=43:spawnPoint=west:boss=wood_league_wave_43_ranged.yml",
+ "wave=43:spawnPoint=west:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=west:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=west:boss=wood_league_wave_43_healer.yml",
+ "wave=43:spawnPoint=northeast:boss=wood_league_wave_43_ranged.yml",
+ "wave=43:spawnPoint=northeast:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=northeast:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=northeast:boss=wood_league_wave_43_healer.yml",
+ "wave=43:spawnPoint=southwest:boss=wood_league_wave_43_ranged.yml",
+ "wave=43:spawnPoint=southwest:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=southwest:boss=wood_league_wave_43_melee.yml",
+ "wave=43:spawnPoint=southwest:boss=wood_league_wave_43_healer.yml",
+
+ "wave=44:spawnPoint=north:boss=wood_league_wave_44_ranged.yml",
+ "wave=44:spawnPoint=north:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=north:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=north:boss=wood_league_wave_44_healer.yml",
+ "wave=44:spawnPoint=south:boss=wood_league_wave_44_ranged.yml",
+ "wave=44:spawnPoint=south:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=south:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=south:boss=wood_league_wave_44_healer.yml",
+ "wave=44:spawnPoint=east:boss=wood_league_wave_44_ranged.yml",
+ "wave=44:spawnPoint=east:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=east:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=east:boss=wood_league_wave_44_healer.yml",
+ "wave=44:spawnPoint=west:boss=wood_league_wave_44_ranged.yml",
+ "wave=44:spawnPoint=west:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=west:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=west:boss=wood_league_wave_44_healer.yml",
+ "wave=44:spawnPoint=northeast:boss=wood_league_wave_44_ranged.yml",
+ "wave=44:spawnPoint=northeast:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=northeast:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=northeast:boss=wood_league_wave_44_healer.yml",
+ "wave=44:spawnPoint=southwest:boss=wood_league_wave_44_ranged.yml",
+ "wave=44:spawnPoint=southwest:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=southwest:boss=wood_league_wave_44_melee.yml",
+ "wave=44:spawnPoint=southwest:boss=wood_league_wave_44_healer.yml",
+
+ "wave=45:spawnPoint=center:boss=wood_league_wave_45_miniboss.yml",
+
+ "wave=46:spawnPoint=north:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=north:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=north:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=north:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=south:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=south:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=south:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=south:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=east:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=east:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=east:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=east:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=west:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=west:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=west:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=west:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=northeast:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=northeast:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=northeast:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=northeast:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=southwest:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=southwest:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=southwest:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=southwest:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=northwest:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=northwest:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=northwest:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=northwest:boss=wood_league_wave_46_healer.yml",
+ "wave=46:spawnPoint=southeast:boss=wood_league_wave_46_ranged.yml",
+ "wave=46:spawnPoint=southeast:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=southeast:boss=wood_league_wave_46_melee.yml",
+ "wave=46:spawnPoint=southeast:boss=wood_league_wave_46_healer.yml",
+
+ "wave=47:spawnPoint=north:boss=wood_league_wave_47_ranged.yml",
+ "wave=47:spawnPoint=north:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=north:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=north:boss=wood_league_wave_47_healer.yml",
+ "wave=47:spawnPoint=south:boss=wood_league_wave_47_ranged.yml",
+ "wave=47:spawnPoint=south:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=south:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=south:boss=wood_league_wave_47_healer.yml",
+ "wave=47:spawnPoint=east:boss=wood_league_wave_47_ranged.yml",
+ "wave=47:spawnPoint=east:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=east:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=east:boss=wood_league_wave_47_healer.yml",
+ "wave=47:spawnPoint=west:boss=wood_league_wave_47_ranged.yml",
+ "wave=47:spawnPoint=west:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=west:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=west:boss=wood_league_wave_47_healer.yml",
+ "wave=47:spawnPoint=northeast:boss=wood_league_wave_47_ranged.yml",
+ "wave=47:spawnPoint=northeast:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=northeast:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=northeast:boss=wood_league_wave_47_healer.yml",
+ "wave=47:spawnPoint=southwest:boss=wood_league_wave_47_ranged.yml",
+ "wave=47:spawnPoint=southwest:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=southwest:boss=wood_league_wave_47_melee.yml",
+ "wave=47:spawnPoint=southwest:boss=wood_league_wave_47_healer.yml",
+
+ "wave=48:spawnPoint=north:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=north:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=north:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=north:boss=wood_league_wave_48_healer.yml",
+ "wave=48:spawnPoint=south:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=south:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=south:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=south:boss=wood_league_wave_48_healer.yml",
+ "wave=48:spawnPoint=east:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=east:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=east:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=east:boss=wood_league_wave_48_healer.yml",
+ "wave=48:spawnPoint=west:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=west:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=west:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=west:boss=wood_league_wave_48_healer.yml",
+ "wave=48:spawnPoint=northeast:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=northeast:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=northeast:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=northeast:boss=wood_league_wave_48_healer.yml",
+ "wave=48:spawnPoint=southwest:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=southwest:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=southwest:boss=wood_league_wave_48_melee.yml",
+ "wave=48:spawnPoint=southwest:boss=wood_league_wave_48_healer.yml",
+
+ "wave=49:spawnPoint=north:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=north:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=north:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=north:boss=wood_league_wave_49_healer.yml",
+ "wave=49:spawnPoint=south:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=south:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=south:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=south:boss=wood_league_wave_49_healer.yml",
+ "wave=49:spawnPoint=east:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=east:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=east:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=east:boss=wood_league_wave_49_healer.yml",
+ "wave=49:spawnPoint=west:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=west:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=west:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=west:boss=wood_league_wave_49_healer.yml",
+ "wave=49:spawnPoint=northeast:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=northeast:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=northeast:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=northeast:boss=wood_league_wave_49_healer.yml",
+ "wave=49:spawnPoint=southwest:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=southwest:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=southwest:boss=wood_league_wave_49_ranged.yml",
+ "wave=49:spawnPoint=southwest:boss=wood_league_wave_49_healer.yml",
+
+ "wave=50:spawnPoint=center:boss=wood_league_wave_50_boss.yml"
+ )));
+ super.setSpawnPoints(new ArrayList<>(List.of(
+ "name=north:location=em_adventurers_guild,219.5,71,273.5",
+ "name=south:location=em_adventurers_guild,219.5,71,316.5",
+ "name=west:location=em_adventurers_guild,197.5,71,295.5",
+ "name=east:location=em_adventurers_guild,240.5,71,295.5",
+ "name=center:location=em_adventurers_guild,219.5,71,295.5",
+ "name=northeast:location=em_adventurers_guild,233.5,71,281.5",
+ "name=southeast:location=em_adventurers_guild,233.5,71,309.5",
+ "name=northwest:location=em_adventurers_guild,205.5,71,281.5",
+ "name=southwest:location=em_adventurers_guild,205.5,71,309.5")));
+
+ super.setDelayBetweenWaves(5);
+ super.setRawArenaRewards(new ArrayList<>(List.of(
+ "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=10:chance=0.01",
+ "filename=enchanted_book_damage_all.yml:wave=10:chance=0.01",
+ "filename=enchanted_book_arrow_damage.yml:wave=10:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=20:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=20:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=20:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=20:chance=0.01",
+ "filename=enchanted_book_damage_all.yml:wave=20:chance=0.01",
+ "filename=enchanted_book_arrow_damage.yml:wave=20:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=30:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=30:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=30:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=30:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=30:chance=0.01",
+ "filename=enchanted_book_arrow_damage.yml:wave=30:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=40:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=40:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=40:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=40:chance=0.01",
+ "filename=enchanted_book_damage_all.yml:wave=40:chance=0.01",
+ "filename=enchanted_book_arrow_damage.yml:wave=40:chance=0.01",
+ "filename=enchanted_book_protection_environmental.yml:wave=50:chance=0.1",
+ "filename=enchanted_book_protection_environmental.yml:wave=50:chance=0.1",
+ "filename=enchanted_book_protection_environmental.yml:wave=50:chance=0.1",
+ "filename=enchanted_book_protection_environmental.yml:wave=50:chance=0.1",
+ "filename=enchanted_book_damage_all.yml:wave=50:chance=0.1",
+ "filename=enchanted_book_arrow_damage.yml:wave=50:chance=0.1",
+
+ "filename=elite_scrap_tiny.yml:wave=5:chance=1:amount=5",
+ "filename=elite_scrap_tiny.yml:wave=10:chance=1:amount=5",
+ "filename=elite_scrap_small.yml:wave=15:chance=1:amount=5",
+ "filename=elite_scrap_small.yml:wave=20:chance=1:amount=5",
+ "filename=elite_scrap_small.yml:wave=25:chance=1:amount=5",
+ "filename=elite_scrap_large.yml:wave=30:chance=1:amount=5",
+ "filename=elite_scrap_large.yml:wave=35:chance=1:amount=5",
+ "filename=elite_scrap_large.yml:wave=40:chance=1:amount=5",
+ "filename=elite_scrap_large.yml:wave=45:chance=1:amount=5",
+ "filename=elite_scrap_huge.yml:wave=50:chance=1:amount=5",
+
+ "currencyAmount=2:wave=1",
+ "currencyAmount=5:wave=2",
+ "currencyAmount=10:wave=3",
+ "currencyAmount=15:wave=4",
+ "currencyAmount=20:wave=5",
+ "currencyAmount=25:wave=6",
+ "currencyAmount=30:wave=7",
+ "currencyAmount=35:wave=8",
+ "currencyAmount=40:wave=9",
+ "currencyAmount=45:wave=10",
+ "currencyAmount=50:wave=11",
+ "currencyAmount=55:wave=12",
+ "currencyAmount=60:wave=13",
+ "currencyAmount=65:wave=14",
+ "currencyAmount=70:wave=15",
+ "currencyAmount=75:wave=16",
+ "currencyAmount=80:wave=17",
+ "currencyAmount=85:wave=18",
+ "currencyAmount=90:wave=19",
+ "currencyAmount=95:wave=20",
+ "currencyAmount=100:wave=21",
+ "currencyAmount=105:wave=22",
+ "currencyAmount=110:wave=23",
+ "currencyAmount=115:wave=24",
+ "currencyAmount=120:wave=25",
+ "currencyAmount=125:wave=26",
+ "currencyAmount=130:wave=27",
+ "currencyAmount=135:wave=28",
+ "currencyAmount=140:wave=29",
+ "currencyAmount=145:wave=30",
+ "currencyAmount=150:wave=31",
+ "currencyAmount=155:wave=32",
+ "currencyAmount=160:wave=33",
+ "currencyAmount=165:wave=34",
+ "currencyAmount=170:wave=35",
+ "currencyAmount=175:wave=36",
+ "currencyAmount=180:wave=37",
+ "currencyAmount=185:wave=38",
+ "currencyAmount=190:wave=39",
+ "currencyAmount=195:wave=40",
+ "currencyAmount=200:wave=41",
+ "currencyAmount=205:wave=42",
+ "currencyAmount=210:wave=43",
+ "currencyAmount=215:wave=44",
+ "currencyAmount=220:wave=45",
+ "currencyAmount=225:wave=46",
+ "currencyAmount=230:wave=47",
+ "currencyAmount=235:wave=48",
+ "currencyAmount=240:wave=49",
+ "currencyAmount=250:wave=50",
+
+ "level=10:filename=summon_merchant_scroll.yml:wave=10",
+
+ "filename=invictus_sword.yml:itemlevel=50:wave=50:chance=0.2",
+ "filename=invictus_helmet.yml:itemlevel=50:wave=50:chance=0.2",
+ "filename=invictus_chestplate.yml:itemlevel=50:wave=50:chance=0.2",
+ "filename=invictus_leggings.yml:itemlevel=50:wave=50:chance=0.2",
+ "filename=invictus_boots.yml:itemlevel=50:wave=50:chance=0.2",
+ "filename=invictus_pickaxe.yml:itemlevel=50:wave=50:chance=0.1",
+ "filename=invictus_shovel.yml:itemlevel=50:wave=50:chance=0.1",
+
+ "filename=challengers_sword.yml:itemlevel=40:wave=40:chance=0.2",
+ "filename=challengers_helmet.yml:itemlevel=40:wave=40:chance=0.2",
+ "filename=challengers_chestplate.yml:itemlevel=40:wave=40:chance=0.2",
+ "filename=challengers_leggings.yml:itemlevel=40:wave=40:chance=0.2",
+ "filename=challengers_boots.yml:itemlevel=40:wave=40:chance=0.2",
+
+ "filename=veterans_sword.yml:itemlevel=30:wave=30:chance=0.2",
+ "filename=veterans_helmet.yml:itemlevel=30:wave=30:chance=0.2",
+ "filename=veterans_chestplate.yml:itemlevel=30:wave=30:chance=0.2",
+ "filename=veterans_leggings.yml:itemlevel=30:wave=30:chance=0.2",
+ "filename=veterans_boots.yml:itemlevel=30:wave=30:chance=0.2",
+
+ "filename=grunts_sword.yml:itemlevel=20:wave=20:chance=0.2",
+ "filename=grunts_helmet.yml:itemlevel=20:wave=20:chance=0.2",
+ "filename=grunts_chestplate.yml:itemlevel=20:wave=20:chance=0.2",
+ "filename=grunts_leggings.yml:itemlevel=20:wave=20:chance=0.2",
+ "filename=grunts_boots.yml:itemlevel=20:wave=20:chance=0.2",
+
+ "filename=novices_sword.yml:itemlevel=10:wave=10:chance=0.2",
+ "filename=novices_helmet.yml:itemlevel=10:wave=10:chance=0.2",
+ "filename=novices_chestplate.yml:itemlevel=10:wave=10:chance=0.2",
+ "filename=novices_leggings.yml:itemlevel=10:wave=10:chance=0.2",
+ "filename=novices_boots.yml:itemlevel=10:wave=10:chance=0.2"
+
+ )));
+ super.setArenaMessages(new ArrayList<>(new ArrayList<>(List.of(
+ "wave=1:message=&8[Gladius] &fToday's main event! A legendary fighter came all the way to the arena to test his might against the toughest monsters from all the land! But before that, here's a rookie fighting some zombies.",
+ "wave=2:message=&8[Gladius] &fWould you look at that, they at least know how to wave their arms! That was just the warmup, let's start putting on some pressure!",
+ "wave=3:message=&8[Gladius] &fSo you think you know how to fight? Well this wave will put the &cheat &fon! Ha ha ha ha ha!",
+ "wave=4:message=&8[Gladius] &fAlright I guess they can take the heat! Ladies and gentlemen, strap on, we might be in for a show!",
+ "wave=5:message=&8[Gladius] &fI found this &cweird creature &foutside, and I thought putting it in the arena would be funny!",
+ "wave=6:message=&8[Gladius] &fSeems like you can handle small groups of enemies just fine, &clet's try scaling that up!",
+ "wave=7:message=&8[Gladius] &fSo you think you can truly challenge the arena? We shall see...",
+ "wave=8:message=&8[Gladius] &fNot bad, but what if every enemy is a &cmelee &fenemy?",
+ "wave=9:message=&8[Gladius] &fNice, nice, but what if they're all &cranged &finstead?",
+ "wave=10:message=&8[Gladius] &fCareful now, a &cbad doggo &fseems to have wandered into the arena! Where did it even come from?",
+ "wave=11:message=&8[Gladius] &fAlright folks we got animal control to deal with the bad doggos, we're back in business!",
+ "wave=12:message=&8[Gladius] &fIt seems like the audience is clamoring for &cmore&f! Well, let's give it to them!",
+ "wave=13:message=&8[Gladius] &fSeems like the custodians got bored and gave the arena creatures &2poison&f! Let's see where this goes...",
+ "wave=14:message=&8[Gladius] &fWell that was... boring! Whoever gave those guys poison is fired! Come up with something better next time!",
+ "wave=15:message=&8[Gladius] &fAnd here we have this year's prize-winning &4hog&f! It got first place for ugliness and meanness! Everyone give a round of applause for &4Mr. Oinkers&f!",
+ "wave=16:message=&8[Gladius] &fMr. Oinkers is now bacon! Here comes &cMr. Oinker's fans&f, flooding the arena to get their revenge!",
+ "wave=17:message=&8[Gladius] &fIt would seem as though our arena challenger thinks they have a shot! But can they deal with even more &cpowerful &ffoes?",
+ "wave=18:message=&8[Gladius] &fThe &cfencing club &fand the &carchery club &fare having a contest! Let's see which one does better!",
+ "wave=19:message=&8[Gladius] &fThe fencing club didn't so so hot, let's see what the &carchery club&f has for us!",
+ "wave=20:message=&8[Gladius] &fSeems like the archery club didn't do so hot either! It seems like our challenger has begun attracting the attention of some of our top gladiators! Introducing &2Zoltan, the Pride of the Zombies&f!",
+ "wave=21:message=&8[Gladius] &fUnbelievable! Seems like this rookie defeated Zoltan! Do we have a potential new champion in our hands?",
+ "wave=22:message=&8[Gladius] &fSpectators are starting to place their bets! How far can today's contestant go?",
+ "wave=23:message=&8[Gladius] &fDon't look away now, this wave's enemies all have &cwithering &fattacks!",
+ "wave=24:message=&8[Gladius] &fSeems like some pretty big arena names are starting to arrive to stop this challenger! Stay tuned!",
+ "wave=25:message=&8[Gladius] &fHere comes &bAgdluak&f, the archer from the Great North! Beware of its &bfrost&f!",
+ "wave=26:message=&8[Gladius] &fThat was a pretty cool fight! I am &cswarming &fwith excitement to see what's next!",
+ "wave=27:message=&8[Gladius] &fI've been told the arena grows harder! &cZombies immune to arrows, skeletons that freeze their opponents &f- what will they think of next!?",
+ "wave=28:message=&8[Gladius] &fIt's time to show off those &cfencing &fskills! Remember, it's all about the legwork!",
+ "wave=29:message=&8[Gladius] &fAnd now, let's have some &ctarget practice&f! The challenger is the target!",
+ "wave=30:message=&8[Gladius] &fA true arena champion approaches! The &2Southern Viper &fonce again seeks to &cpoison &ftheir enemies to death with his &cthousand poisons&f!",
+ "wave=31:message=&8[Gladius] &fThe Southern Viper has fallen! The crowd goes wild! What a day, ladies and gentlemen, what a day!",
+ "wave=32:message=&8[Gladius] &fI have been told that the arena custodians are done messing around and are staring to let loose! Can our challenger survive this?",
+ "wave=33:message=&8[Gladius] &fSeems like some enemies got their hands on some of Southern Viper's &cpoisons&f! You do not want to get hit by those, ladies and gentlemen!",
+ "wave=34:message=&8[Gladius] &fBobby, make sure you put 1,000 Elite Coins on these contestants dying for me - no, no, 1,000 Elite Coins - wait was this thing on? I mean, onwards to the next wave!",
+ "wave=35:message=&8[Gladius] &fLadies and gentlemen, what a rare treat! It would seems as the very &aWood League Jester &fhas stepped up to fight! What delightful &2tricks &fdoes he have for us today?",
+ "wave=36:message=&8[Gladius] &fWhat a lovely show ladies and gentlemen, give it up for &aThe Jester&f!",
+ "wave=37:message=&8[Gladius] &fBobby, how is my bet doing? What do you mean 10,000 Elite Coins, I told you to put 1,000 on there! Uh, pump them, &cpump the powers up&f!",
+ "wave=38:message=&8[Gladius] &fBobby you're killing me here! Uh, dump some &cswordsmen &fon there, I need to deal with something real quick...",
+ "wave=39:message=&8[Gladius] &fWhat do you mean no refunds? I didn't even want to - ahem, I mean, a legion of &carchers &fhave come from far to show off their skills!",
+ "wave=40:message=&8[Gladius] &fLadies an gentlemen, for, uh, random reasons, I have invited the strongest fighter I can summon! Meet &4Crucios, the Bearer of Curses&f!",
+ "wave=41:message=&8[Gladius] &fCrucios has been defeated!? What has the world come to?",
+ "wave=42:message=&8[Gladius] &fA wealthy for now patron has decided to throw in free healthcare to arena enemies! Will they do better with &2healing&f?",
+ "wave=43:message=&8[Gladius] &f&cWither&f, &cpoison, &cfire&f throw in everything you have! Do you even know how much is on the line!?",
+ "wave=44:message=&8[Gladius] &fThis is clearly not working, let me think of something...",
+ "wave=45:message=&8[Gladius] &fHere is one of the top gladiators of the Wood League Arena! &cThousand Blades &fapproaches once again with his &cinnumerable projectiles&f! He better win!",
+ "wave=46:message=&8[Gladius] &fThousand Blades has fallen! It just seems like you can't get competent gladiators these days! That's fine, you'll see! You'll all see! &cRelease the swarm!",
+ "wave=47:message=&8[Gladius] &fIf swarms don't work, throw in &cmore powers&f! Throw in all of the powers!",
+ "wave=48:message=&8[Gladius] &fWe are starting to run out of options here! Are these all of the &cswordsmen &fwe have left?",
+ "wave=49:message=&8[Gladius] &fAlright send all we have left, we have no other options! Move forth, &carchers&f!",
+ "wave=50:message=&8[Gladius] &fI guess this is it for me... I have no option but to declare - wait, who is that in the distance? Is that &4Uther, the Champion of the Wood League Arena&f? Ladies and gentlemen, match set and over, our contestant has no chance of winning here! They shall be &csmitten &fby our champion!",
+ "wave=51:message=&8[Gladius the Destitute] &fUnbelievable, Uther has been defeated! We have a new arena champion! I would be incredibly excited if I wasn't so terribly in debt now!"
+ ))));
+ setMaximumPlayerCount(5);
+ setCylindricalArena(true);
+ }
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java
new file mode 100644
index 000000000..b48e83ecc
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfig.java
@@ -0,0 +1,59 @@
+package com.magmaguy.elitemobs.config.custombosses;
+
+import com.magmaguy.elitemobs.mobconstructor.custombosses.InstancedBossEntity;
+import com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity;
+import com.magmaguy.magmacore.config.CustomConfig;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class CustomBossesConfig extends CustomConfig {
+
+ private static HashMap customBosses = new HashMap<>();
+
+ public CustomBossesConfig() {
+ super("custombosses", "com.magmaguy.elitemobs.config.custombosses.premade", CustomBossesConfigFields.class);
+ customBosses = new HashMap<>();
+ for (String key : super.getCustomConfigFieldsHashMap().keySet())
+ if (super.getCustomConfigFieldsHashMap().get(key).isEnabled()) {
+ CustomBossesConfigFields customBossesConfigFields = (CustomBossesConfigFields) super.getCustomConfigFieldsHashMap().get(key);
+ customBosses.put(key, customBossesConfigFields);
+ }
+ //This one initializes mobs, which require all mobs to be initialized for phases / reinforcements
+ for (CustomBossesConfigFields customBossesConfigFields : customBosses.values()) {
+ if (customBossesConfigFields.isRegionalBoss()) {
+ //Instanced regional bosses don't actually get initialized alongside normal Regional Bosses
+ if (customBossesConfigFields.isInstanced()) {
+ //Initialize the regional bosses in the world
+ List locations = customBossesConfigFields.processStringList("spawnLocations", new ArrayList<>(), new ArrayList<>(), false);
+// if (locations.isEmpty() && !customBossesConfigFields.isRemoveAfterDeath())
+// Logger.info(customBossesConfigFields.getFilename() + " does not have a set location yet! It will not spawn. Did you install its minidungeon?");
+ for (String string : locations)
+ InstancedBossEntity.add(string, customBossesConfigFields);
+ continue;
+ }
+
+ CustomBossesConfigFields.getRegionalElites().put(customBossesConfigFields.getFilename(), customBossesConfigFields);
+ //Reinforcement elites are only temporary and situational, don't initialize them
+ if (!customBossesConfigFields.isReinforcement()) {
+ //Initialize the regional bosses in the world
+ List locations = customBossesConfigFields.processStringList("spawnLocations", new ArrayList<>(), new ArrayList<>(), false);
+// if (locations.isEmpty() && !customBossesConfigFields.isRemoveAfterDeath())
+// Logger.info(customBossesConfigFields.getFilename() + " does not have a set location yet! It will not spawn. Did you install its minidungeon?");
+ for (String string : locations)
+ new RegionalBossEntity(customBossesConfigFields, string).initialize();
+ }
+ }
+ }
+ }
+
+ public static HashMap getCustomBosses() {
+ return customBosses;
+ }
+
+ public static CustomBossesConfigFields getCustomBoss(String fileName) {
+ return customBosses.get(fileName);
+ }
+
+}
diff --git a/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java
new file mode 100644
index 000000000..d8fe6319a
--- /dev/null
+++ b/src/main/java/com/magmaguy/elitemobs/config/custombosses/CustomBossesConfigFields.java
@@ -0,0 +1,487 @@
+package com.magmaguy.elitemobs.config.custombosses;
+
+import com.magmaguy.elitemobs.config.ConfigurationEngine;
+import com.magmaguy.elitemobs.config.CustomConfigFields;
+import com.magmaguy.elitemobs.config.MobCombatSettingsConfig;
+import com.magmaguy.elitemobs.items.customloottable.CustomLootTable;
+import com.magmaguy.elitemobs.mobconstructor.BossType;
+import com.magmaguy.elitemobs.mobconstructor.mobdata.aggressivemobs.EliteMobProperties;
+import com.magmaguy.elitemobs.powers.scripts.caching.EliteScriptBlueprint;
+import com.magmaguy.elitemobs.thirdparty.custommodels.CustomModel;
+import com.magmaguy.magmacore.util.ChatColorConverter;
+import com.magmaguy.magmacore.util.Logger;
+import lombok.Getter;
+import lombok.Setter;
+import org.bukkit.Material;
+import org.bukkit.configuration.ConfigurationSection;
+import org.bukkit.entity.EntityType;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.*;
+
+public class CustomBossesConfigFields extends CustomConfigFields {
+
+ @Getter
+ private static final Map regionalElites = new HashMap<>();
+ @Getter
+ private CustomLootTable customLootTable = null;
+ @Getter
+ @Setter
+ private EntityType entityType = EntityType.ZOMBIE;
+ @Setter
+ private String name = "Default Name";
+ @Setter
+ private String level = "dynamic";
+ @Getter
+ @Setter
+ private boolean isPersistent = false;
+ @Getter
+ @Setter
+ private double healthMultiplier = 1;
+ @Getter
+ @Setter
+ private double damageMultiplier = 1;
+ @Getter
+ @Setter
+ private boolean frozen = false;
+ @Getter
+ @Setter
+ private boolean reinforcement = false;
+ @Getter
+ @Setter
+ private List onDeathCommands = null;
+ @Getter
+ @Setter
+ private List onSpawnCommands = null;
+ @Getter
+ @Setter
+ private List onCombatEnterCommands = null;
+ @Getter
+ @Setter
+ private List onCombatLeaveCommands = null;
+ @Getter
+ @Setter
+ private List