diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index c9085e9d..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,36 +0,0 @@ -# How to contribute to EcoEnchants - -## Codestyle - -1. The EcoEnchants checkstyle is in /config/checkstyle.xml - -- The pull request must not have any checkstyle issues. -- Every method and field must have a javadoc attached. - -2. Use lombok wherever possible. - -- As of 6.0.0, EcoEnchants is now built with lombok. -- @Getter, @Setter, @ToString, @EqualsAndHashCode, @UtilityClass are the most important. - -3. Use JetBrains annotations - -- Every parameter should be annotated with @NotNull or @Nullable -- Use @NotNull over lombok @NonNull - -4. Imports - -- No group (*) imports. -- No static imports. - -## Dependency Injection - -- EcoEnchants uses Dependency Injection since 6.0.0. -- Any calls to AbstractEcoPlugin#getInstance are code smells and should never be used unless **absolutely necessary**. -- NamespacedKeys, FixedMetadataValues, Runnables, and Schedules should be managed using EcoEnchantsPlugin through DI. -- Any DI class should extend PluginDependent where possible. If the class extends another, then you **must** store the - plugin instance in a private final variable called **plugin** with a private or protected getter. - -## Other - -- All drops **must** be sent through a DropQueue - calls to World#dropItem will get your PR rejected. -- Any non-plugin-specific changes **must** be made to eco-util, or core-proxy, rather than core-plugin. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index 0a74fe45..6b111d16 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -2,52 +2,71 @@ 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. +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 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. +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. +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. +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. +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. +(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. +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. +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 +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. +The precise terms and conditions for copying, distribution and +modification follow. TERMS AND CONDITIONS @@ -55,106 +74,142 @@ The precise terms and conditions for copying, distribution and modification foll "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. +"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 +"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. +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. +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 "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. +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. +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. +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. +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 +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. +(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" 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 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. +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. +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. +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. +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. +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. +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 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. +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: +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. @@ -177,17 +232,22 @@ code under the terms of section 4, provided that you also meet all of these cond 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. +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: +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 @@ -230,55 +290,77 @@ machine-readable Corresponding Source under the terms of this License, in one of 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 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. +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. +"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). +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. +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. +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. +"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. +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: +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 @@ -303,182 +385,251 @@ the copyright holders of that material) supplement the terms of this License wit 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. +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. +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. +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). +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. +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. +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. +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 +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. +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. +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. +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" 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. +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. +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. +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 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. +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. +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. +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. +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. +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. +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 +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. +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. +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. +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. +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. +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. +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. +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) @@ -498,21 +649,26 @@ to where the full notice is found. 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: +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". +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 +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 +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/build.gradle b/build.gradle index 64c7dd25..4b1cd78c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,18 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10" + } +} + plugins { id 'java-library' id 'com.github.johnrengelman.shadow' version '7.0.0' id 'maven-publish' id 'java' - id 'checkstyle' } dependencies { @@ -11,6 +20,7 @@ dependencies { } allprojects { + apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'maven-publish' apply plugin: 'com.github.johnrengelman.shadow' @@ -20,26 +30,8 @@ allprojects { mavenLocal() maven { url 'https://jitpack.io' } maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } - maven { url 'https://repo.codemc.org/repository/nms/' } - maven { url 'https://repo.codemc.org/repository/maven-public' } - maven { url "https://oss.sonatype.org/content/repositories/snapshots" } - maven { url 'https://oss.sonatype.org/content/groups/public/' } - maven { url 'https://maven.enginehub.org/repo/' } - maven { url 'https://repo.essentialsx.net/releases/' } - maven { url 'https://ci.ender.zone/plugin/repository/project/' } - maven { url 'https://ci.ender.zone/plugin/repository/everything/' } - maven { url 'https://repo.md-5.net/content/repositories/snapshots/' } - maven { url 'https://repo.dmulloy2.net/nexus/repository/public/' } maven { url 'https://papermc.io/repo/repository/maven-public/' } - maven { url 'https://repo.maven.apache.org/maven2/' } - maven { url 'https://repo.dustplanet.de/artifactory/ext-release-local/' } - maven { url 'https://libraries.minecraft.net/' } - maven { url 'https://repo.spongepowered.org/maven/' } - maven { url 'https://org.kitteh.pastegg' } - maven { url 'https://repo.mikeprimm.com/' } - maven { url 'https://maven.enginehub.org/repo/' } - maven { url 'https://github.com/factions-site/repo/raw/public/' } - maven { url 'https://mvn.lumine.io/repository/maven-public/' } + maven { url 'https://repo.essentialsx.net/releases/' } } jar { @@ -51,20 +43,15 @@ allprojects { relocate('org.joml', 'com.willfp.ecoenchants.libreforge.joml') } - compileJava { - onlyIf { !sourceSets.main.allSource.files.isEmpty() } - } - dependencies { - compileOnly 'com.willfp:eco:6.37.2' + compileOnly 'com.willfp:eco:6.38.0' + implementation 'com.willfp:libreforge:3.90.0' + implementation 'org.joml:joml:1.10.4' - compileOnly 'org.jetbrains:annotations:22.0.0' + compileOnly 'org.jetbrains:annotations:23.0.0' + compileOnly 'com.github.ben-manes.caffeine:caffeine:3.0.6' - compileOnly 'org.projectlombok:lombok:1.18.22' - annotationProcessor 'org.projectlombok:lombok:1.18.22' - - testCompileOnly 'org.projectlombok:lombok:1.18.22' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.22' + compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.7.10' } tasks.withType(JavaCompile) { @@ -73,11 +60,18 @@ allprojects { } processResources { - filesNotMatching(["**/*.png", "**/models/**", "**/textures/**"]) { + filesNotMatching(["**/*.png", "**/models/**", "**/textures/**", "**enchants.yml", "**lang.yml"]) { expand projectVersion: project.version } } + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { + kotlinOptions { + jvmTarget = "17" + freeCompilerArgs += ["-Xjvm-default=all"] + } + } + java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 @@ -85,7 +79,6 @@ allprojects { compileJava.dependsOn clean build.dependsOn shadowJar - build.dependsOn check } tasks.withType(Jar) { @@ -108,15 +101,7 @@ group = 'com.willfp' archivesBaseName = project.name version = findProperty("version") -compileJava.options.encoding = 'UTF-8' - -publishing { - publications { - maven(MavenPublication) { - from(components.java) - } - } -} +build.dependsOn shadowJar task buyThePlugins { dependsOn subprojects.build diff --git a/config/checkstyle/suppression.xml b/config/checkstyle/suppression.xml index 4821bb6e..12c9ad42 100644 --- a/config/checkstyle/suppression.xml +++ b/config/checkstyle/suppression.xml @@ -5,27 +5,6 @@ "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/eco-core/build.gradle b/eco-core/build.gradle index 2fa30c94..2f7415f3 100644 --- a/eco-core/build.gradle +++ b/eco-core/build.gradle @@ -1,9 +1,2 @@ group 'com.willfp' version rootProject.version - -subprojects { - dependencies { - implementation 'com.willfp:libreforge:3.89.0' - implementation 'org.joml:joml:1.10.4' - } -} diff --git a/eco-core/core-nms/build.gradle b/eco-core/core-nms/build.gradle deleted file mode 100644 index 4aa1efc1..00000000 --- a/eco-core/core-nms/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -group 'com.willfp' -version rootProject.version - -subprojects { - dependencies { - compileOnly project(':eco-core:core-proxy') - compileOnly project(':eco-core:core-plugin') - } -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_17_R1/build.gradle b/eco-core/core-nms/v1_17_R1/build.gradle deleted file mode 100644 index e732641e..00000000 --- a/eco-core/core-nms/v1_17_R1/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantmentManager.java b/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantmentManager.java deleted file mode 100644 index 857034f1..00000000 --- a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantmentManager.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_17_R1; - -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments; -import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy; -import com.willfp.ecoenchants.proxy.v1_17_R1.enchants.EcoCraftEnchantment; -import net.minecraft.core.IRegistry; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_17_R1.util.CraftNamespacedKey; - -import java.util.Map; - -public final class EcoCraftEnchantmentManager implements EcoCraftEnchantmentManagerProxy { - @Override - public void registerNewCraftEnchantments() { - Map metadataMap = VanillaEnchantments.getMetadataMap(); - - for (Enchantment enchantment : IRegistry.X) { - NamespacedKey key = CraftNamespacedKey.fromMinecraft(IRegistry.X.getKey(enchantment)); - VanillaEnchantmentMetadata metadata = metadataMap.get(org.bukkit.enchantments.Enchantment.getByKey(key)); - new EcoCraftEnchantment(enchantment, metadata).register(); - } - } -} diff --git a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/OpenInventory.java b/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/OpenInventory.java deleted file mode 100644 index f5e5db80..00000000 --- a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_17_R1; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().bV; - } -} diff --git a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java deleted file mode 100644 index e9f4ec23..00000000 --- a/eco-core/core-nms/v1_17_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_17_R1/enchants/EcoCraftEnchantment.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_17_R1.enchants; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.craftbukkit.v1_17_R1.enchantments.CraftEnchantment; -import org.jetbrains.annotations.NotNull; - -public class EcoCraftEnchantment extends CraftEnchantment { - private final VanillaEnchantmentMetadata metadata; - - public EcoCraftEnchantment(@NotNull final Enchantment target, - @NotNull final VanillaEnchantmentMetadata metadata) { - super(target); - this.metadata = metadata; - } - - @Override - public int getMaxLevel() { - return metadata.maxLevel() == null ? this.getHandle().getMaxLevel() : metadata.maxLevel(); - } - - @Override - public boolean conflictsWith(@NotNull final org.bukkit.enchantments.Enchantment other) { - if (other instanceof EcoEnchant) { - return other.conflictsWith(this); - } - - return metadata.conflicts() == null ? super.conflictsWith(other) : metadata.conflicts().contains(other.getKey()); - } - - public void register() { - EnchantmentUtils.register(this); - } -} diff --git a/eco-core/core-nms/v1_18_R1/build.gradle b/eco-core/core-nms/v1_18_R1/build.gradle deleted file mode 100644 index 2aa928f6..00000000 --- a/eco-core/core-nms/v1_18_R1/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.18-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantmentManager.java b/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantmentManager.java deleted file mode 100644 index bb3877dd..00000000 --- a/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantmentManager.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_18_R1; - -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments; -import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy; -import com.willfp.ecoenchants.proxy.v1_18_R1.enchants.EcoCraftEnchantment; -import net.minecraft.core.IRegistry; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_18_R1.util.CraftNamespacedKey; - -import java.util.Map; - -public final class EcoCraftEnchantmentManager implements EcoCraftEnchantmentManagerProxy { - @Override - public void registerNewCraftEnchantments() { - Map metadataMap = VanillaEnchantments.getMetadataMap(); - - for (Enchantment enchantment : IRegistry.Y) { - NamespacedKey key = CraftNamespacedKey.fromMinecraft(IRegistry.Y.b(enchantment)); - VanillaEnchantmentMetadata metadata = metadataMap.get(org.bukkit.enchantments.Enchantment.getByKey(key)); - new EcoCraftEnchantment(enchantment, metadata).register(); - } - } -} diff --git a/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/OpenInventory.java b/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/OpenInventory.java deleted file mode 100644 index e5704fe5..00000000 --- a/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_18_R1; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().bW; - } -} diff --git a/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/enchants/EcoCraftEnchantment.java deleted file mode 100644 index 3b661b90..00000000 --- a/eco-core/core-nms/v1_18_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R1/enchants/EcoCraftEnchantment.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_18_R1.enchants; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.craftbukkit.v1_18_R1.enchantments.CraftEnchantment; -import org.jetbrains.annotations.NotNull; - -public class EcoCraftEnchantment extends CraftEnchantment { - private final VanillaEnchantmentMetadata metadata; - - public EcoCraftEnchantment(@NotNull final Enchantment target, - @NotNull final VanillaEnchantmentMetadata metadata) { - super(target); - this.metadata = metadata; - } - - @Override - public int getMaxLevel() { - return metadata.maxLevel() == null ? this.getHandle().a() : metadata.maxLevel(); - } - - @Override - public boolean conflictsWith(@NotNull final org.bukkit.enchantments.Enchantment other) { - if (other instanceof EcoEnchant) { - return other.conflictsWith(this); - } - - return metadata.conflicts() == null ? super.conflictsWith(other) : metadata.conflicts().contains(other.getKey()); - } - - public void register() { - EnchantmentUtils.register(this); - } -} diff --git a/eco-core/core-nms/v1_18_R2/build.gradle b/eco-core/core-nms/v1_18_R2/build.gradle deleted file mode 100644 index fb2d9471..00000000 --- a/eco-core/core-nms/v1_18_R2/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantmentManager.java b/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantmentManager.java deleted file mode 100644 index 7d65e414..00000000 --- a/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantmentManager.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_18_R2; - -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments; -import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy; -import com.willfp.ecoenchants.proxy.v1_18_R2.enchants.EcoCraftEnchantment; -import net.minecraft.core.IRegistry; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_18_R2.util.CraftNamespacedKey; - -import java.util.Map; - -public final class EcoCraftEnchantmentManager implements EcoCraftEnchantmentManagerProxy { - @Override - public void registerNewCraftEnchantments() { - Map metadataMap = VanillaEnchantments.getMetadataMap(); - - for (Enchantment enchantment : IRegistry.V) { - NamespacedKey key = CraftNamespacedKey.fromMinecraft(IRegistry.V.b(enchantment)); - VanillaEnchantmentMetadata metadata = metadataMap.get(org.bukkit.enchantments.Enchantment.getByKey(key)); - new EcoCraftEnchantment(enchantment, metadata).register(); - } - } -} diff --git a/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/OpenInventory.java b/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/OpenInventory.java deleted file mode 100644 index 8db2bf14..00000000 --- a/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_18_R2; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().bV; - } -} diff --git a/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/enchants/EcoCraftEnchantment.java deleted file mode 100644 index d9cc44bc..00000000 --- a/eco-core/core-nms/v1_18_R2/src/main/java/com/willfp/ecoenchants/proxy/v1_18_R2/enchants/EcoCraftEnchantment.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_18_R2.enchants; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.craftbukkit.v1_18_R2.enchantments.CraftEnchantment; -import org.jetbrains.annotations.NotNull; - -public class EcoCraftEnchantment extends CraftEnchantment { - private final VanillaEnchantmentMetadata metadata; - - public EcoCraftEnchantment(@NotNull final Enchantment target, - @NotNull final VanillaEnchantmentMetadata metadata) { - super(target); - this.metadata = metadata; - } - - @Override - public int getMaxLevel() { - return metadata.maxLevel() == null ? this.getHandle().a() : metadata.maxLevel(); - } - - @Override - public boolean conflictsWith(@NotNull final org.bukkit.enchantments.Enchantment other) { - if (other instanceof EcoEnchant) { - return other.conflictsWith(this); - } - - return metadata.conflicts() == null ? super.conflictsWith(other) : metadata.conflicts().contains(other.getKey()); - } - - public void register() { - EnchantmentUtils.register(this); - } -} diff --git a/eco-core/core-nms/v1_19_R1/build.gradle b/eco-core/core-nms/v1_19_R1/build.gradle deleted file mode 100644 index 05e27d11..00000000 --- a/eco-core/core-nms/v1_19_R1/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot:1.19-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantmentManager.java b/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantmentManager.java deleted file mode 100644 index c9dd2f49..00000000 --- a/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantmentManager.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_19_R1; - -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments; -import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy; -import com.willfp.ecoenchants.proxy.v1_19_R1.enchants.EcoCraftEnchantment; -import net.minecraft.core.IRegistry; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_19_R1.util.CraftNamespacedKey; - -import java.util.Map; - -public final class EcoCraftEnchantmentManager implements EcoCraftEnchantmentManagerProxy { - @Override - public void registerNewCraftEnchantments() { - Map metadataMap = VanillaEnchantments.getMetadataMap(); - - for (Enchantment enchantment : IRegistry.W) { - NamespacedKey key = CraftNamespacedKey.fromMinecraft(IRegistry.W.b(enchantment)); - VanillaEnchantmentMetadata metadata = metadataMap.get(org.bukkit.enchantments.Enchantment.getByKey(key)); - new EcoCraftEnchantment(enchantment, metadata).register(); - } - } -} diff --git a/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/OpenInventory.java b/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/OpenInventory.java deleted file mode 100644 index 7b5dedd6..00000000 --- a/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/OpenInventory.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_19_R1; - -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public final class OpenInventory implements OpenInventoryProxy { - @Override - public Object getOpenInventory(@NotNull final Player player) { - return ((CraftPlayer) player).getHandle().bU; - } -} diff --git a/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/enchants/EcoCraftEnchantment.java b/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/enchants/EcoCraftEnchantment.java deleted file mode 100644 index 555b20ea..00000000 --- a/eco-core/core-nms/v1_19_R1/src/main/java/com/willfp/ecoenchants/proxy/v1_19_R1/enchants/EcoCraftEnchantment.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.proxy.v1_19_R1.enchants; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantmentMetadata; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import net.minecraft.world.item.enchantment.Enchantment; -import org.bukkit.craftbukkit.v1_19_R1.enchantments.CraftEnchantment; -import org.jetbrains.annotations.NotNull; - -public class EcoCraftEnchantment extends CraftEnchantment { - private final VanillaEnchantmentMetadata metadata; - - public EcoCraftEnchantment(@NotNull final Enchantment target, - @NotNull final VanillaEnchantmentMetadata metadata) { - super(target); - this.metadata = metadata; - } - - @Override - public int getMaxLevel() { - return metadata.maxLevel() == null ? this.getHandle().a() : metadata.maxLevel(); - } - - @Override - public boolean conflictsWith(@NotNull final org.bukkit.enchantments.Enchantment other) { - if (other instanceof EcoEnchant) { - return other.conflictsWith(this); - } - - return metadata.conflicts() == null ? super.conflictsWith(other) : metadata.conflicts().contains(other.getKey()); - } - - public void register() { - EnchantmentUtils.register(this); - } -} diff --git a/eco-core/core-plugin/build.gradle b/eco-core/core-plugin/build.gradle index cddf13e1..01e398b7 100644 --- a/eco-core/core-plugin/build.gradle +++ b/eco-core/core-plugin/build.gradle @@ -2,14 +2,17 @@ group 'com.willfp' version rootProject.version dependencies { - compileOnly project(":eco-core:core-proxy") - compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT' - compileOnly 'commons-io:commons-io:2.8.0' - compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.0-SNAPSHOT' - compileOnly 'net.essentialsx:EssentialsX:2.19.0' - compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT' - compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT' - compileOnly 'io.lumine:Mythic:5.0.1' - compileOnly 'com.github.ben-manes.caffeine:caffeine:3.0.5' compileOnly fileTree(dir: '../../lib', include: ['*.jar']) + compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT' + compileOnly 'net.essentialsx:EssentialsX:2.19.0' +} + +build.dependsOn publishToMavenLocal + +publishing { + publications { + maven(MavenPublication) { + from(components.java) + } + } } \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java deleted file mode 100644 index 60c46d72..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/EcoEnchantsPlugin.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.willfp.ecoenchants; - -import com.willfp.eco.core.command.impl.PluginCommand; -import com.willfp.eco.core.display.DisplayModule; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.core.integrations.IntegrationLoader; -import com.willfp.eco.util.TelekinesisUtils; -import com.willfp.ecoenchants.command.CommandEcoEnchants; -import com.willfp.ecoenchants.command.CommandEnchantinfo; -import com.willfp.ecoenchants.config.CustomEnchantsYml; -import com.willfp.ecoenchants.config.RarityYml; -import com.willfp.ecoenchants.config.TargetYml; -import com.willfp.ecoenchants.config.VanillaEnchantsYml; -import com.willfp.ecoenchants.display.EnchantDisplay; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchantRequirementListeners; -import com.willfp.ecoenchants.enchantments.custom.CustomEnchantEnableListeners; -import com.willfp.ecoenchants.enchantments.custom.CustomEnchantLookup; -import com.willfp.ecoenchants.enchantments.support.merging.anvil.AnvilListeners; -import com.willfp.ecoenchants.enchantments.support.merging.grindstone.GrindstoneListeners; -import com.willfp.ecoenchants.enchantments.support.obtaining.EnchantingListeners; -import com.willfp.ecoenchants.enchantments.support.obtaining.LootGenerateListeners; -import com.willfp.ecoenchants.enchantments.support.obtaining.VillagerListeners; -import com.willfp.ecoenchants.enchantments.util.ItemConversions; -import com.willfp.ecoenchants.enchantments.util.LazyHealthFixListener; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import com.willfp.ecoenchants.enchantments.util.WatcherTriggers; -import com.willfp.ecoenchants.integrations.mythicmobs.MythicMobsManager; -import com.willfp.ecoenchants.integrations.mythicmobs.plugins.IntegrationMythicMobs; -import com.willfp.ecoenchants.integrations.registration.RegistrationManager; -import com.willfp.ecoenchants.integrations.registration.plugins.IntegrationCMI; -import com.willfp.ecoenchants.integrations.registration.plugins.IntegrationEssentials; -import com.willfp.libreforge.LibReforgePlugin; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -@SuppressWarnings("unused") -public class EcoEnchantsPlugin extends LibReforgePlugin { - /** - * Instance of the plugin. - */ - private static EcoEnchantsPlugin instance; - - /** - * Rarity.yml. - */ - private final RarityYml rarityYml; - - /** - * Target.yml. - */ - private final TargetYml targetYml; - - /** - * VanillaEnchants.yml. - */ - private final VanillaEnchantsYml vanillaEnchantsYml; - - /** - * CustomEnchants.yml. - */ - private final CustomEnchantsYml customEnchantsYml; - - /** - * Internal constructor called by bukkit on plugin load. - */ - public EcoEnchantsPlugin() { - instance = this; - - rarityYml = new RarityYml(this); - targetYml = new TargetYml(this); - vanillaEnchantsYml = new VanillaEnchantsYml(this); - customEnchantsYml = new CustomEnchantsYml(this); - - this.registerJavaHolderProvider(player -> new ArrayList<>(CustomEnchantLookup.provideLevels(player))); - } - - @Override - public void handleEnableAdditional() { - this.getLogger().info(EcoEnchants.values().size() + " Enchantments Loaded"); - - TelekinesisUtils.registerTest(player -> FastItemStack.wrap(player.getInventory().getItemInMainHand()).getEnchantmentLevel(EcoEnchants.TELEKINESIS, false) > 0); - } - - @Override - public void handleReloadAdditional() { - this.getDisplayModule().update(); - for (EcoEnchant enchant : EcoEnchants.values()) { - HandlerList.unregisterAll(enchant); - this.getScheduler().runLater(() -> { - if (enchant.isEnabled()) { - this.getEventManager().registerListener(enchant); - - if (enchant instanceof TimedRunnable) { - this.getScheduler().syncRepeating((TimedRunnable) enchant, 5, ((TimedRunnable) enchant).getTime()); - } - } - }, 1); - } - this.getScheduler().runTimer(() -> { - for (EcoEnchant enchant : EcoEnchants.values()) { - enchant.clearCachedRequirements(); - } - }, 300, 300); - } - - @Override - @NotNull - public List loadAdditionalIntegrations() { - return Arrays.asList( - new IntegrationLoader("Essentials", () -> RegistrationManager.register(new IntegrationEssentials())), - new IntegrationLoader("CMI", () -> RegistrationManager.register(new IntegrationCMI())), - new IntegrationLoader("MythicMobs", () -> MythicMobsManager.register(new IntegrationMythicMobs())) - ); - } - - @Override - protected List loadPluginCommands() { - return Arrays.asList( - new CommandEnchantinfo(this), - new CommandEcoEnchants(this) - ); - } - - @Override - protected List loadListeners() { - return Arrays.asList( - new EnchantingListeners(this), - new GrindstoneListeners(this), - new AnvilListeners(this), - new WatcherTriggers(this), - new VillagerListeners(this), - new ItemConversions(this), - new CustomEnchantEnableListeners(this), - new CustomEcoEnchantRequirementListeners(this), - new LazyHealthFixListener(this), - new LootGenerateListeners(this) - ); - } - - @Override - @Nullable - protected DisplayModule createDisplayModule() { - return new EnchantDisplay(this); - } - - @Override - @NotNull - public EnchantDisplay getDisplayModule() { - return (EnchantDisplay) Objects.requireNonNull(super.getDisplayModule()); - } - - @NotNull - @Override - public String getMinimumEcoVersion() { - return "6.37.1"; - } - - /** - * Get the instance of EcoEnchants. - *

- * Bad practice to use this. - * - * @return The instance. - */ - public static EcoEnchantsPlugin getInstance() { - return instance; - } - - /** - * Get rarity.yml. - * - * @return rarity.yml. - */ - public RarityYml getRarityYml() { - return this.rarityYml; - } - - /** - * Get target.yml. - * - * @return target.yml. - */ - public TargetYml getTargetYml() { - return this.targetYml; - } - - /** - * Get vanillaenchants.yml. - * - * @return vanillaenchants.yml. - */ - public VanillaEnchantsYml getVanillaEnchantsYml() { - return this.vanillaEnchantsYml; - } - - /** - * Get customenchants.yml - * - * @return customenchants.yml. - */ - public CustomEnchantsYml getCustomEnchantsYml() { - return customEnchantsYml; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandDebug.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandDebug.java deleted file mode 100644 index d24479fb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandDebug.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -@SuppressWarnings("deprecation") -public class CommandDebug extends Subcommand { - /** - * Instantiate a new /ecoenchants debug command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandDebug(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "debug", "ecoenchants.command.debug", true); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - Player player = (Player) sender; - player.sendMessage("Held Item: " + player.getInventory().getItemInMainHand()); - player.sendMessage("Lore: "); - Bukkit.getLogger().info(""); - - Bukkit.getLogger().info("Held Item: " + player.getInventory().getItemInMainHand()); - Bukkit.getLogger().info("Lore: "); - ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta(); - if (meta != null) { - for (String s : new ArrayList<>(meta.hasLore() ? meta.getLore() : new ArrayList<>())) { - Bukkit.getLogger().info(s); - player.sendMessage(s); - } - } - Bukkit.getLogger().info(""); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java deleted file mode 100644 index e18ac68f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEcoEnchants.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.PluginCommand; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class CommandEcoEnchants extends PluginCommand { - /** - * Instantiate a new /ecoenchants command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandEcoEnchants(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "ecoenchants", "ecoenchants.command.ecoenchants", false); - - this.addSubcommand(new CommandDebug(plugin)) - .addSubcommand(new CommandReload(plugin)) - .addSubcommand(new CommandGiverandombook(plugin)) - .addSubcommand(new CommandRandomenchant(plugin)) - .addSubcommand(new CommandLocale(plugin)) - .addSubcommand(new CommandToggleDescriptions(plugin)); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-command")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java deleted file mode 100644 index a13add06..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandEnchantinfo.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.impl.PluginCommand; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import org.apache.commons.lang.WordUtils; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.command.CommandSender; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -public class CommandEnchantinfo extends PluginCommand { - /** - * Instantiate a new /enchantinfo command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandEnchantinfo(@NotNull final EcoPlugin plugin) { - super(plugin, "enchantinfo", "ecoenchants.command.enchantinfo", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - if (args.isEmpty()) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("missing-enchant")); - return; - } - StringBuilder nameBuilder = new StringBuilder(); - - args.forEach(arg -> nameBuilder.append(arg).append(" ")); - String searchName = nameBuilder.toString(); - searchName = searchName.substring(0, searchName.length() - 1); - - EcoEnchant enchantment = EcoEnchants.getByName(searchName); - - if (enchantment == null) { - String finalSearchName = searchName; - enchantment = EcoEnchants.values().stream().filter(ecoEnchant -> ChatColor.stripColor(ecoEnchant.getDisplayName()).equalsIgnoreCase(finalSearchName)).findFirst().orElse(null); - } - - if (enchantment == null || !enchantment.isEnabled()) { - String message = this.getPlugin().getLangYml().getMessage("not-found").replace("%name%", searchName); - sender.sendMessage(message); - return; - } - - Set conflictNames = new HashSet<>(); - - Set conflicts = enchantment.getConflicts(); - - new HashSet<>(conflicts).forEach(enchantment1 -> { - if (enchantment1 instanceof EcoEnchant ecoEnchant) { - if (!ecoEnchant.isEnabled()) { - conflicts.remove(enchantment1); - } - } - }); - - conflicts.forEach((enchantment1 -> { - if (enchantment1 instanceof EcoEnchant enchant) { - conflictNames.add(enchant.getDisplayName()); - } else { - conflictNames.add(this.getPlugin().getLangYml().getFormattedString("enchantments." + enchantment1.getKey().getKey() + ".name")); - } - })); - - StringBuilder conflictNamesBuilder = new StringBuilder(); - conflictNames.forEach(name1 -> conflictNamesBuilder.append(name1).append(", ")); - String allConflicts = conflictNamesBuilder.toString(); - if (allConflicts.length() >= 2) { - allConflicts = allConflicts.substring(0, allConflicts.length() - 2); - } else { - allConflicts = this.getPlugin().getLangYml().getFormattedString("no-conflicts"); - } - - Set targets = enchantment.getTargetMaterials(); - - Set applicableItemsSet = new HashSet<>(); - - if (this.getPlugin().getConfigYml().getBool("commands.enchantinfo.show-target-group")) { - enchantment.getTargets().forEach(target -> { - String targetName = target.getName(); - targetName = targetName.toLowerCase(); - targetName = targetName.replace("_", " "); - targetName = WordUtils.capitalize(targetName); - applicableItemsSet.add(targetName); - }); - } else { - targets.forEach(material -> { - String matName = material.toString(); - matName = matName.toLowerCase(); - matName = matName.replace("_", " "); - matName = WordUtils.capitalize(matName); - applicableItemsSet.add(matName); - }); - } - - StringBuilder targetNamesBuilder = new StringBuilder(); - applicableItemsSet.forEach(name1 -> targetNamesBuilder.append(name1).append(", ")); - String allTargets = targetNamesBuilder.toString(); - if (allTargets.length() >= 2) { - allTargets = allTargets.substring(0, allTargets.length() - 2); - } else { - allTargets = this.getPlugin().getLangYml().getFormattedString("no-targets"); - } - - String maxLevel = String.valueOf(enchantment.getMaxLevel()); - - final String finalName = EnchantmentCache.getEntry(enchantment).getName(); - final String finalDescription = EnchantmentCache.getEntry(enchantment).getStringDescription(1); - final EnchantmentRarity finalRarity = enchantment.getEnchantmentRarity(); - final String finalTargets = allTargets; - final String finalConflicts = allConflicts; - final String finalMaxLevel = maxLevel; - Arrays.asList(this.getPlugin().getLangYml().getMessage("enchantinfo").split("\\r?\\n")).forEach((string -> { - string = string.replace("%name%", finalName) - .replace("%description%", finalDescription) - .replace("%rarity%", finalRarity.getName()) - .replace("%target%", finalTargets) - .replace("%conflicts%", finalConflicts) - .replace("%maxlevel%", finalMaxLevel); - sender.sendMessage(string); - })); - } - - @Override - public List tabComplete(@NotNull final CommandSender sender, - @NotNull final List args) { - List completions = new ArrayList<>(); - - List names = EcoEnchants.values().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getDisplayName).map(ChatColor::stripColor).toList(); - - if (args.isEmpty()) { - // Currently, this case is not ever reached - return names; - } - - StringUtil.copyPartialMatches(String.join(" ", args), names, completions); - - if (args.size() > 1) { // Remove all previous words from the candidate of completions - ArrayList finishedArgs = new ArrayList<>(args); - finishedArgs.remove(args.size() - 1); - - String prefix = String.join(" ", finishedArgs); - completions = completions.stream().map(enchantName -> StringUtils.removePrefix(enchantName, prefix).trim()).collect(Collectors.toList()); - } - - Collections.sort(completions); - return completions; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandGiverandombook.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandGiverandombook.java deleted file mode 100644 index c07ca62b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandGiverandombook.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.eco.core.items.builder.EnchantedBookBuilder; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class CommandGiverandombook extends Subcommand { - /** - * The cached enchantment names. - */ - private static final List RARITY_NAMES = EnchantmentRarity.values().stream().map(EnchantmentRarity::getName).collect(Collectors.toList()); - - /** - * The cached type names. - */ - private static final List TYPE_NAMES = EnchantmentType.values().stream().map(EnchantmentType::getName).collect(Collectors.toList()); - - /** - * Instantiate a new command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandGiverandombook(@NotNull final EcoPlugin plugin) { - super(plugin, "giverandombook", "ecoenchants.command.giverandombook", false); - } - - /** - * Called on /reload. - */ - @ConfigUpdater - public static void reload() { - RARITY_NAMES.clear(); - RARITY_NAMES.addAll(EnchantmentRarity.values().stream().map(EnchantmentRarity::getName).toList()); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - if (args.isEmpty()) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("requires-player")); - return; - } - Player player = Bukkit.getServer().getPlayer(args.get(0)); - - EnchantmentRarity rarity = args.size() >= 2 ? EnchantmentRarity.getByName(args.get(1).toLowerCase()) : null; - - EnchantmentType type = rarity == null && args.size() >= 2 ? EnchantmentType.getByName(args.get(1).toLowerCase()) : null; - - - if (player == null) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player")); - return; - } - - List allowed = Arrays.stream(Enchantment.values()).filter(enchantment -> { - if (enchantment instanceof EcoEnchant) { - return ((EcoEnchant) enchantment).isEnabled(); - } - return true; - }).filter(enchantment -> { - if (rarity != null) { - if (!(enchantment instanceof EcoEnchant ecoEnchant)) { - return false; - } - return ecoEnchant.getEnchantmentRarity().equals(rarity); - } else if (type != null) { - if (!(enchantment instanceof EcoEnchant ecoEnchant)) { - return false; - } - return ecoEnchant.getType().equals(type); - } - return true; - }).toList(); - - Enchantment enchantment = allowed.get(NumberUtils.randInt(0, allowed.size() - 1)); - int level = NumberUtils.randInt(1, enchantment.getMaxLevel()); - - ItemStack itemStack = new EnchantedBookBuilder() - .addStoredEnchantment(enchantment, level) - .build(); - - for (ItemStack stack : player.getInventory().addItem(itemStack).values()) { - player.getWorld().dropItem(player.getLocation(), stack); - } - - String message = this.getPlugin().getLangYml().getMessage("gave-random-book"); - message = message.replace("%enchantment%", EnchantmentCache.getEntry(enchantment).getName() + " " + NumberUtils.toNumeral(level) + "§r"); - sender.sendMessage(message); - - String message2 = this.getPlugin().getLangYml().getMessage("received-random-book"); - message2 = message2.replace("%enchantment%", EnchantmentCache.getEntry(enchantment).getName() + " " + NumberUtils.toNumeral(level) + "§r"); - player.sendMessage(message2); - } - - @Override - public List tabComplete(@NotNull final CommandSender sender, - @NotNull final List args) { - List completions = new ArrayList<>(); - - List playerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()); - - if (args.isEmpty()) { - // Currently, this case is not ever reached - return playerNames; - } - - if (args.size() == 1) { - StringUtil.copyPartialMatches(String.join(" ", args.get(0)), playerNames, completions); - } - - if (args.size() == 2) { - StringUtil.copyPartialMatches(String.join(" ", args.get(1)), RARITY_NAMES, completions); - StringUtil.copyPartialMatches(String.join(" ", args.get(1)), TYPE_NAMES, completions); - } - - Collections.sort(completions); - return completions; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocale.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocale.java deleted file mode 100644 index 5d8ef4ce..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocale.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class CommandLocale extends Subcommand { - /** - * Instantiate a new /ecoenchants locale command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandLocale(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "locale", "ecoenchants.command.locale", false); - - this.addSubcommand(new CommandLocaleExport(plugin)) - .addSubcommand(new CommandLocaleDownload(plugin)); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-locale-subcommand")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleDownload.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleDownload.java deleted file mode 100644 index a8a0c60c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleDownload.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.eco.core.config.ConfigType; -import com.willfp.eco.core.config.TransientConfig; -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.eco.core.web.Paste; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.List; - -public class CommandLocaleDownload extends Subcommand { - /** - * Instantiate a new /ecoenchants locale download command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandLocaleDownload(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "download", "ecoenchants.command.locale.download", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - if (args.isEmpty()) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-locale")); - return; - } - - Paste paste = Paste.getFromHastebin(args.get(0)); - if (paste == null) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-locale")); - return; - } - - String contents = paste.getContents(); - Config configuration = new TransientConfig(contents, ConfigType.YAML); - - for (String key : configuration.getKeys(true)) { - this.getPlugin().getLangYml().set(key, configuration.get(key)); - } - - try { - this.getPlugin().getLangYml().save(); - - for (EcoEnchant value : EcoEnchants.values()) { - value.getConfig().loadFromLang(); - value.getConfig().save(); - } - } catch (IOException e) { - e.printStackTrace(); - } - - sender.sendMessage(this.getPlugin().getLangYml().getMessage("downloaded-locale")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleExport.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleExport.java deleted file mode 100644 index c9dc7b9a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandLocaleExport.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.eco.core.web.Paste; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.YamlConfiguration; -import org.jetbrains.annotations.NotNull; - -import java.io.StringReader; -import java.util.List; - -public class CommandLocaleExport extends Subcommand { - /** - * Instantiate a new /ecoenchants locale export command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandLocaleExport(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "export", "ecoenchants.command.locale.export", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - YamlConfiguration configuration = YamlConfiguration.loadConfiguration(new StringReader(this.getPlugin().getLangYml().toPlaintext())); - for (EcoEnchant enchant : EcoEnchants.values()) { - configuration.set("enchantments." + enchant.getKey().getKey() + ".name", enchant.getConfig().getHandle().getString("name")); - configuration.set("enchantments." + enchant.getKey().getKey() + ".description", enchant.getConfig().getHandle().getString("description")); - } - - Paste paste = new Paste(configuration.saveToString()); - - paste.getHastebinToken(token -> { - if (token.length() > 15) { - sender.sendMessage( - this.getPlugin().getLangYml().getMessage("export-failed") - ); - } else { - sender.sendMessage( - this.getPlugin().getLangYml().getMessage("link-to-locale").replace( - "%token%", token - ) - ); - } - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java deleted file mode 100644 index fc203209..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandRandomenchant.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.command.CommandSender; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.util.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class CommandRandomenchant extends Subcommand { - /** - * Instantiate a new /ecoreload command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandRandomenchant(@NotNull final EcoPlugin plugin) { - super(plugin, "randomenchant", "ecoenchants.command.randomenchant", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - Player player; - - if ((args.isEmpty() && sender instanceof Player) || !sender.hasPermission("ecoenchants.command.randomenchant.others")) { - player = (Player) sender; - } else if (!args.isEmpty()) { - player = Bukkit.getServer().getPlayer(args.get(0)); - } else { - player = null; - } - - if (player == null) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player")); - return; - } - - ItemStack itemStack = player.getInventory().getItemInMainHand(); - ItemMeta meta = itemStack.getItemMeta(); - - if (itemStack.getType() == Material.AIR || meta == null || !EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - if (player.equals(sender)) { - player.sendMessage(this.getPlugin().getLangYml().getMessage("must-hold-item")); - } else { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("must-hold-item-other")); - } - return; - } - - List ecoEnchants = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(ecoEnchants); - EcoEnchant enchant = null; - - List onItem = new ArrayList<>(); - - if (meta instanceof EnchantmentStorageMeta) { - onItem.addAll(((EnchantmentStorageMeta) meta).getStoredEnchants().keySet()); - } else { - onItem.addAll(meta.getEnchants().keySet()); - } - - for (EcoEnchant ecoEnchant : ecoEnchants) { - if (ecoEnchant.canEnchantItem(itemStack)) { - if (!ecoEnchant.conflictsWithAny(onItem)) { - if (ecoEnchant.isEnabled()) { - if (onItem.stream().noneMatch(enchantment -> enchantment.conflictsWith(ecoEnchant))) { - if (!onItem.contains(ecoEnchant)) { - boolean conflicts = false; - for (Enchantment enchantment : onItem) { - if (enchantment instanceof EcoEnchant ecoEnchantOnItem) { - if (ecoEnchantOnItem.getType().equals(ecoEnchant.getType()) && ecoEnchantOnItem.getType().isSingular()) { - conflicts = true; - } - } - } - if (this.getPlugin().getConfigYml().getBool("anvil.hard-cap.enabled") - && !player.hasPermission("ecoenchants.command.randomenchant.bypasshardcap") - && onItem.size() >= this.getPlugin().getConfigYml().getInt("anvil.hard-cap.cap")) { - conflicts = true; - } - if (!conflicts) { - enchant = ecoEnchant; - } - } - } - } - } - } - } - - if (enchant == null) { - player.sendMessage(this.getPlugin().getLangYml().getMessage("no-enchants-available")); - return; - } - - if (meta instanceof EnchantmentStorageMeta) { - ((EnchantmentStorageMeta) meta).addStoredEnchant(enchant, enchant.getMaxLevel(), true); - } else { - meta.addEnchant(enchant, enchant.getMaxLevel(), true); - } - - itemStack.setItemMeta(meta); - String message = this.getPlugin().getLangYml().getMessage("applied-random-enchant"); - message = message.replace("%enchantment%", EnchantmentCache.getEntry(enchant).getName() + "§r"); - player.sendMessage(message); - } - - @Override - public List tabComplete(@NotNull final CommandSender sender, - @NotNull final List args) { - List completions = new ArrayList<>(); - - List playerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()); - - if (args.isEmpty() || !sender.hasPermission("ecoenchants.command.randomenchant.others")) { - // Currently, this case is not ever reached - return playerNames; - } - - if (args.size() == 1) { - StringUtil.copyPartialMatches(String.join(" ", args), playerNames, completions); - Collections.sort(completions); - return completions; - } - - return new ArrayList<>(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java deleted file mode 100644 index 42e6dc7f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandReload.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.eco.util.NumberUtils; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import org.bukkit.command.CommandSender; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class CommandReload extends Subcommand { - /** - * Instantiate a new command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandReload(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "reload", "ecoenchants.command.reload", false); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS) - .replace("%time%", NumberUtils.format(this.getPlugin().reloadWithTime()))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java deleted file mode 100644 index 2cb95ad9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/command/CommandToggleDescriptions.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.command; - -import com.willfp.eco.core.command.impl.Subcommand; -import com.willfp.eco.core.data.PlayerProfile; -import com.willfp.eco.core.data.keys.PersistentDataKey; -import com.willfp.eco.core.data.keys.PersistentDataKeyType; -import com.willfp.eco.util.NamespacedKeyUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class CommandToggleDescriptions extends Subcommand { - /** - * Persistent data key for descriptions. - */ - public static final PersistentDataKey DESCRIPTIONS_KEY = new PersistentDataKey<>( - NamespacedKeyUtils.create("ecoenchants", "descriptions_enabled"), - PersistentDataKeyType.BOOLEAN, - true - ).player(); - - /** - * Instantiate a new command handler. - * - * @param plugin The plugin for the commands to listen for. - */ - public CommandToggleDescriptions(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin, "toggledescriptions", "ecoenchants.command.toggledescriptions", true); - } - - @Override - public void onExecute(@NotNull final CommandSender sender, - @NotNull final List args) { - if (!((EcoEnchantsPlugin) this.getPlugin()).getDisplayModule().getOptions().getDescriptionOptions().isEnabled()) { - sender.sendMessage(this.getPlugin().getLangYml().getMessage("descriptions-disabled")); - return; - } - Player player = (Player) sender; - PlayerProfile profile = PlayerProfile.load(player); - boolean currentStatus = profile.read(DESCRIPTIONS_KEY); - currentStatus = !currentStatus; - profile.write(DESCRIPTIONS_KEY, currentStatus); - if (currentStatus) { - player.sendMessage(this.getPlugin().getLangYml().getMessage("enabled-descriptions")); - } else { - player.sendMessage(this.getPlugin().getLangYml().getMessage("disabled-descriptions")); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/CustomEnchantsYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/CustomEnchantsYml.java deleted file mode 100644 index eaf5720b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/CustomEnchantsYml.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.config; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.BaseConfig; -import com.willfp.eco.core.config.ConfigType; -import org.jetbrains.annotations.NotNull; - -public class CustomEnchantsYml extends BaseConfig { - /** - * Instantiate target.yml. - * - * @param plugin Instance of EcoEnchants. - */ - public CustomEnchantsYml(@NotNull final EcoPlugin plugin) { - super("customenchants", plugin, true, ConfigType.YAML); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java deleted file mode 100644 index 95cdecfb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/RarityYml.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.willfp.ecoenchants.config; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.BaseConfig; -import com.willfp.eco.core.config.ConfigType; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class RarityYml extends BaseConfig { - /** - * Instantiate rarity.yml. - * - * @param plugin Instance of EcoEnchants. - */ - public RarityYml(@NotNull final EcoPlugin plugin) { - super("rarity", plugin, false, ConfigType.YAML); - } - - /** - * Get all rarity names. - * - * @return Set of all rarity names. - */ - public List getRarities() { - return this.getSubsection("rarities").getKeys(false); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java deleted file mode 100644 index dd62ed8f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/TargetYml.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.willfp.ecoenchants.config; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.BaseConfig; -import com.willfp.eco.core.config.ConfigType; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import org.bukkit.Material; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -public class TargetYml extends BaseConfig { - /** - * Instantiate target.yml. - * - * @param plugin Instance of EcoEnchants. - */ - public TargetYml(@NotNull final EcoPlugin plugin) { - super("target", plugin, false, ConfigType.YAML); - } - - /** - * Get all target names. - * - * @return Set of all names. - */ - public List getTargets() { - return this.getSubsection("targets").getKeys(false); - } - - /** - * Get all materials from a target name. - * - * @param target The name of the target. - * @return All materials. - */ - public Set getTargetMaterials(@NotNull final String target) { - Set materials = new HashSet<>(); - this.getStrings("targets." + target).forEach(materialName -> { - materials.add(Material.getMaterial(materialName.toUpperCase())); - }); - - materials.removeIf(Objects::isNull); - - return materials; - } - - /** - * Get the slot for a target name. - * - * @param target The target. - * @return The slot, or {@link com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget.Slot#ANY} - */ - public EnchantmentTarget.Slot getSlot(@NotNull final String target) { - for (String str : this.getStrings("targets." + target)) { - if (str.startsWith("slot:")) { - return EnchantmentTarget.Slot.valueOf( - str.replace("slot:", "").toUpperCase() - ); - } - } - - return EnchantmentTarget.Slot.ANY; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/VanillaEnchantsYml.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/VanillaEnchantsYml.java deleted file mode 100644 index cc71a265..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/VanillaEnchantsYml.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.config; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.BaseConfig; -import com.willfp.eco.core.config.ConfigType; -import org.jetbrains.annotations.NotNull; - -public class VanillaEnchantsYml extends BaseConfig { - /** - * Instantiate target.yml. - * - * @param plugin Instance of EcoEnchants. - */ - public VanillaEnchantsYml(@NotNull final EcoPlugin plugin) { - super("vanillaenchants", plugin, true, ConfigType.YAML); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/BaseEnchantmentConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/BaseEnchantmentConfig.java deleted file mode 100644 index 760ee7d8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/BaseEnchantmentConfig.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.config.configs; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.ConfigType; -import com.willfp.eco.core.config.ExtendableConfig; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class BaseEnchantmentConfig extends ExtendableConfig { - /** - * Instantiate a new config for an enchantment. - * - * @param name The name of the config. - * @param source The class in the jar where the config is contained. - * @param plugin The provider of the enchantment. - * @param enchant The enchantment. - */ - public BaseEnchantmentConfig(@NotNull final String name, - @NotNull final Class source, - @NotNull final EcoEnchant enchant, - @NotNull final EcoPlugin plugin) { - super(name, true, plugin, source, "enchants/" + enchant.getType().getName() + "/", ConfigType.YAML); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java deleted file mode 100644 index 9b467249..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/config/configs/EnchantmentConfig.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.willfp.ecoenchants.config.configs; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.eco.core.config.interfaces.LoadableConfig; -import com.willfp.eco.core.config.wrapper.ConfigWrapper; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import lombok.Getter; -import org.bukkit.Bukkit; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class EnchantmentConfig extends ConfigWrapper { - /** - * The name of the config. - */ - @Getter - private final String name; - - /** - * The enchantment. - */ - @Getter - private final EcoEnchant enchant; - - /** - * Instance of EcoEnchants. - */ - @Getter - private final EcoPlugin plugin; - - /** - * Instantiate a new config for an enchantment. - * - * @param handle The handle. - * @param name The config name. - * @param enchant The enchant. - * @param plugin Instance of EcoEnchants. - */ - public EnchantmentConfig(@NotNull final Config handle, - @NotNull final String name, - @NotNull final EcoEnchant enchant, - @NotNull final EcoPlugin plugin) { - super(handle); - this.name = name; - this.enchant = enchant; - this.plugin = plugin; - } - - /** - * Get a set of enchantments stored by key. - * - * @param path The location of the enchantments in the config. - * @return A set of all enchantments. - */ - public Set getEnchantments(@NotNull final String path) { - Set enchantments = new HashSet<>(); - List enchantmentKeys = this.getStrings(path); - for (String key : enchantmentKeys) { - if (Enchantment.getByKey(NamespacedKey.minecraft(key)) != null) { - enchantments.add(Enchantment.getByKey(NamespacedKey.minecraft(key))); - } - } - return enchantments; - } - - /** - * Get the rarity of the enchantment. - * - * @return The rarity, or null if invalid. - */ - public EnchantmentRarity getRarity() { - String rarityName = this.getString("obtaining.rarity"); - return EnchantmentRarity.getByName(rarityName); - } - - /** - * Get all applicable targets. - * - * @return The targets. - */ - public Set getTargets() { - List targetNames = this.getStrings(EcoEnchants.GENERAL_LOCATION + "targets"); - if (targetNames.isEmpty()) { - return new HashSet<>(); - } - Set targets = new HashSet<>(); - - targetNames.forEach((s -> { - if (EnchantmentTarget.getByName(s) == null) { - Bukkit.getLogger().warning("Target specified in " + name + " is invalid!"); - return; - } - targets.add(EnchantmentTarget.getByName(s)); - })); - - return targets; - } - - /** - * Load config values from lang.yml. - */ - public void loadFromLang() { - if (!this.getPlugin().getLangYml().has("enchantments." + this.getEnchant().getKey().getKey())) { - return; - } - - this.set("name", this.getPlugin().getLangYml().getString("enchantments." + this.getEnchant().getKey().getKey() + ".name")); - this.set("description", this.getPlugin().getLangYml().getString("enchantments." + this.getEnchant().getKey().getKey() + ".description")); - - this.getPlugin().getLangYml().set("enchantments." + this.getEnchant().getKey().getKey(), null); - - try { - this.save(); - this.getPlugin().getLangYml().save(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * Save if savable config. - */ - public void save() { - try { - if (this.getHandle() instanceof LoadableConfig loadableConfig) { - loadableConfig.save(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java deleted file mode 100644 index 60204743..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantDisplay.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.willfp.ecoenchants.display; - -import com.google.common.collect.Lists; -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.display.Display; -import com.willfp.eco.core.display.DisplayModule; -import com.willfp.eco.core.display.DisplayPriority; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.display.options.DisplayOptions; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.util.ItemConversionOptions; -import lombok.Getter; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * All methods and fields pertaining to showing players the enchantments on their items. - */ -@SuppressWarnings("DeprecatedIsStillUsed") -public class EnchantDisplay extends DisplayModule { - /** - * The meta key to hide enchantments in lore. - *

- * EcoEnchants packet lore implementation of HideEnchants. - */ - @Getter - private final NamespacedKey keySkip; - - /** - * The legacy V key. - *

- * Exists for backwards compatibility. - */ - @Getter - @Deprecated - private final NamespacedKey legacyV; - - /** - * The configurable options for displaying enchantments. - */ - @Getter - private final DisplayOptions options; - - /** - * Create EcoEnchants display module. - * - * @param plugin Instance of EcoEnchants. - */ - public EnchantDisplay(@NotNull final EcoPlugin plugin) { - super(plugin, DisplayPriority.LOW); - keySkip = this.getPlugin().getNamespacedKeyFactory().create("ecoenchantlore-skip"); - legacyV = this.getPlugin().getNamespacedKeyFactory().create("ecoenchantlore-v"); - options = new DisplayOptions(this.getPlugin()); - } - - /** - * Update config values. - */ - public void update() { - options.update(); - EnchantmentCache.update(); - } - - @Override - public void display(@NotNull final ItemStack itemStack, - @Nullable final Player player, - @NotNull final Object... args) { - if (options.isRequireTarget()) { - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return; - } - } - - FastItemStack fastItemStack = FastItemStack.wrap(itemStack); - - boolean hide = (boolean) args[0]; - - if (hide || fastItemStack.getPersistentDataContainer().has(keySkip, PersistentDataType.INTEGER)) { - fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS); - if (itemStack.getType() == Material.ENCHANTED_BOOK) { - fastItemStack.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - } - fastItemStack.getPersistentDataContainer().set(keySkip, PersistentDataType.INTEGER, 1); - return; - } - - List itemLore = fastItemStack.getLore(); - - List lore = new ArrayList<>(); - List requirementLore = new ArrayList<>(); - - LinkedHashMap enchantments = new LinkedHashMap<>(fastItemStack.getEnchants(true)); - - enchantments.entrySet().removeIf(enchantmentIntegerEntry -> enchantmentIntegerEntry.getValue().equals(0)); - - List unsorted = new ArrayList<>(); - enchantments.forEach((enchantment, integer) -> unsorted.add(enchantment)); - - Map tempEnchantments = new HashMap<>(enchantments); - - options.getSorter().sortEnchantments(unsorted); - - enchantments.clear(); - unsorted.forEach(enchantment -> enchantments.put(enchantment, tempEnchantments.get(enchantment))); - enchantments.forEach((enchantment, level) -> { - if (enchantment instanceof EcoEnchant ecoEnchant && ecoEnchant.hasFlag("hide-in-lore")) { - return; - } - - String name = player == null - ? EnchantmentCache.getEntry(enchantment).getNameWithLevel(level) - : EnchantmentCache.getEntry(enchantment).getNameWithLevel(level, player); - - lore.add(Display.PREFIX + name); - if (!options.getDescriptionOptions().isShowingAtBottom()) { - if (enchantments.size() <= options.getDescriptionOptions().getThreshold() - && options.getDescriptionOptions().isEnabled() - && options.getDescriptionOptions().enabledForPlayer(player) - ) { - if (options.getDescriptionOptions().isOnlyOnBooks() && itemStack.getType() != Material.ENCHANTED_BOOK) { - return; - } - - lore.addAll(EnchantmentCache.getEntry(enchantment).getDescription(level)); - } - } - - if (player != null && enchantment instanceof EcoEnchant ecoEnchant) { - if (ecoEnchant instanceof CustomEcoEnchant custom) { - requirementLore.addAll(custom.getLevel(level).getNotMetLines(player).stream().map(l -> Display.PREFIX + l).toList()); - } - - if (!ecoEnchant.areRequirementsMet(player)) { - requirementLore.addAll(StringUtils.formatList(EnchantmentCache.getEntry(enchantment).getRequirementLore(), player)); - } - } - }); - - if (options.getShrinkOptions().isEnabled() && (enchantments.size() > options.getShrinkOptions().getThreshold())) { - List> partitionedCombinedLoreList = Lists.partition(lore, options.getShrinkOptions().getShrinkPerLine()); - List newLore = new ArrayList<>(); - partitionedCombinedLoreList.forEach(list -> { - StringBuilder builder = new StringBuilder(); - for (String s : list) { - builder.append(s); - builder.append(", "); - } - String line = builder.toString(); - line = line.substring(0, line.length() - 2); - newLore.add(line); - }); - lore.clear(); - lore.addAll(newLore); - } - - if (options.getDescriptionOptions().isShowingAtBottom()) { - if (enchantments.size() <= options.getDescriptionOptions().getThreshold() - && options.getDescriptionOptions().isEnabled() - && options.getDescriptionOptions().enabledForPlayer(player) - ) { - for (Map.Entry entry : enchantments.entrySet()) { - lore.addAll(EnchantmentCache.getEntry(entry.getKey()).getDescription(entry.getValue())); - } - } - } - - if (!(itemStack.getType() == Material.ENCHANTED_BOOK && !options.isPrefixOnBooks())) { - if (!enchantments.isEmpty()) { - lore.addAll(0, options.getLorePrefix()); - lore.addAll(options.getLoreSuffix()); - } - } - - if (this.getOptions().isAboveLore()) { - lore.addAll(itemLore); - } else { - lore.addAll(0, itemLore); - } - lore.addAll(requirementLore); - - if (!lore.isEmpty()) { - fastItemStack.setLore(lore); - } - - if (itemStack.getType() == Material.ENCHANTED_BOOK) { - fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS); - } else { - fastItemStack.addItemFlags(ItemFlag.HIDE_ENCHANTS); - } - if (itemStack.getType() == Material.ENCHANTED_BOOK) { - fastItemStack.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - } - } - - @Override - public void revert(@NotNull final ItemStack itemStack) { - if (options.isRequireTarget()) { - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return; - } - } - - FastItemStack fastItemStack = FastItemStack.wrap(itemStack); - - PersistentDataContainer pdc = fastItemStack.getPersistentDataContainer(); - - // Fixes weird bug. Apparently nullable. - //noinspection ConstantConditions - if (pdc == null) { - return; - } - - pdc.remove(legacyV); - - if (!pdc.has(keySkip, PersistentDataType.INTEGER)) { - fastItemStack.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - fastItemStack.removeItemFlags(ItemFlag.HIDE_ENCHANTS); - } - - pdc.remove(keySkip); - } - - @Override - public Object[] generateVarArgs(@NotNull final ItemStack itemStack) { - if (options.isRequireTarget()) { - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return new Object[]{false}; - } - } - - FastItemStack fastItemStack = FastItemStack.wrap(itemStack); - - if (!itemStack.hasItemMeta()) { - return new Object[]{false}; - } - - boolean hideEnchants = fastItemStack.hasItemFlag(ItemFlag.HIDE_ENCHANTS) || fastItemStack.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS); - - if (fastItemStack.getPersistentDataContainer().has(legacyV, PersistentDataType.INTEGER)) { - hideEnchants = false; - } - - if (Display.isFinalized(itemStack)) { - hideEnchants = false; - } - - if (ItemConversionOptions.isUsingExperimentalHideFixer() && ItemConversionOptions.isUsingForceHideFixer()) { - hideEnchants = false; - } - - if (ItemConversionOptions.isUsingExperimentalHideFixer() && fastItemStack.hasItemFlag(ItemFlag.HIDE_ENCHANTS) && fastItemStack.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) { - hideEnchants = false; - } - - return new Object[]{hideEnchants}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java deleted file mode 100644 index cafc9bee..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/EnchantmentCache.java +++ /dev/null @@ -1,405 +0,0 @@ -package com.willfp.ecoenchants.display; - -import com.google.common.collect.ImmutableMap; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.eco.core.display.Display; -import com.willfp.eco.util.NumberUtils; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.options.NumbersOptions; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import lombok.Getter; -import lombok.ToString; -import lombok.experimental.UtilityClass; -import org.apache.commons.lang.WordUtils; -import org.bukkit.Bukkit; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.enchantments.EnchantmentWrapper; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.JProgressBar; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@UtilityClass -public class EnchantmentCache { - /** - * Instance of EcoEnchants. - */ - public static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance(); - - /** - * The physical cache. - */ - private static final Map CACHE = new HashMap<>(); - - /** - * Get the {@link CacheEntry} for a specific enchantment. - *

- * Returns a default "broken" cache entry if not cached. - * - * @param enchantment The enchantment to query. - * @return The found cache entry. - */ - public static CacheEntry getEntry(@NotNull final Enchantment enchantment) { - CacheEntry matching = CACHE.get(enchantment.getKey()); - if (matching != null) { - return matching; - } else { - updateEnchantment(enchantment); - Bukkit.getLogger().warning(enchantment.getKey() + " (from class " + enchantment.getClass() + ") was not cached! Trying to fix..."); - return getEntry(enchantment); - } - } - - /** - * Get the entire cache. - * - * @return An immutable map of the cache. - */ - public static Map getCache() { - return ImmutableMap.copyOf(CACHE); - } - - /** - * Update the cache. - */ - @ConfigUpdater - public static void update() { - CACHE.clear(); - Arrays.asList(Enchantment.values()).forEach(EnchantmentCache::updateEnchantment); - } - - private static void updateEnchantment(@NotNull final Enchantment enchantment) { - CACHE.remove(enchantment.getKey()); - - if (enchantment instanceof EnchantmentWrapper) { - Bukkit.getLogger().severe("Found erroneous enchantment registration!"); - Bukkit.getLogger().severe("Enchantment " + enchantment.getKey() - + " (Found in class " + enchantment.getClass().getName() + ", Path: " + enchantment.getClass().getProtectionDomain().getCodeSource().getLocation().getPath() + ")" - ); - Bukkit.getLogger().severe("Tell the author to lean how enchantments are stored internally."); - Bukkit.getLogger().severe("Hint: Extend Enchantment instead of EnchantmentWrapper."); - CACHE.put(enchantment.getKey(), new CacheEntry( - enchantment, - "&4INVALID ENCHANTMENT", - new HashMap<>(Map.of(1, Collections.singletonList(Display.PREFIX + "INVALID ENCHANTMENT: " + enchantment.getClass().getName()))), - EnchantmentType.NORMAL, - EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")), - "&7" - )); - return; - } - - String name; - String color; - EnchantmentType type; - EnchantmentRarity rarity; - List description; - if (enchantment instanceof EcoEnchant ecoEnchant) { - description = StringUtils.formatList(ecoEnchant.getWrappedDescription()); - name = ecoEnchant.getDisplayName(); - type = ecoEnchant.getType(); - rarity = ecoEnchant.getEnchantmentRarity(); - } else { - description = Arrays.asList( - WordUtils.wrap( - PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".description"), - PLUGIN.getConfigYml().getInt("lore.describe.wrap"), - "\n", false - ).split("\\r?\\n") - ); - name = PLUGIN.getLangYml().getString("enchantments." + enchantment.getKey().getKey().toLowerCase() + ".name"); - type = enchantment.isCursed() ? EnchantmentType.CURSE : EnchantmentType.NORMAL; - if (enchantment.isTreasure()) { - rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-treasure-rarity")); - } else { - rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")); - } - } - - color = type.getColor(); - - - if (rarity == null) { - rarity = EnchantmentRarity.getByName(PLUGIN.getConfigYml().getString("rarity.vanilla-rarity")); - } - - if (rarity.hasCustomColor() && type != EnchantmentType.CURSE) { - color = rarity.getCustomColor(); - } - - description.replaceAll(line -> line.replace("§r", "§r" + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor())); - description.replaceAll(line -> line.replace("&r", "&r" + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor())); - description.replaceAll(line -> Display.PREFIX + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor() + line); - - Map> levelDescription = new HashMap<>(); - - if (enchantment instanceof EcoEnchant ecoEnchant) { - for (int i = 1; i <= ecoEnchant.getMaxLevel(); i++) { - List levelDesc = new ArrayList<>(); - for (String s : description) { - levelDesc.add(s.replace("%value%", ecoEnchant.getPlaceholder(i))); - } - - levelDescription.put( - i, - levelDesc - ); - } - } else { - for (int i = 1; i <= enchantment.getMaxLevel(); i++) { - levelDescription.put(i, description); - } - } - CACHE.put(enchantment.getKey(), new CacheEntry(enchantment, name, levelDescription, type, rarity, color)); - } - - @ToString - public static final class CacheEntry { - /** - * The enchantment that this cache is for. - */ - @Getter - private final Enchantment enchantment; - - /** - * The name of the enchantment. - */ - private final String name; - - /** - * The default color of the enchantment. - */ - @Getter - private final String color; - - /** - * The description, line-wrapped. - */ - private final Map> description; - - /** - * The description, not line-wrapped or colorized. - */ - private final Map stringDescription; - - /** - * The type of the enchantment. - */ - @Getter - private final EnchantmentType type; - - /** - * The requirement lore. - */ - @Getter - private final List requirementLore; - - /** - * The rarity of the enchantment. - */ - @Getter - private final EnchantmentRarity rarity; - - private CacheEntry(@NotNull final Enchantment enchantment, - @NotNull final String name, - @NotNull final Map> description, - @NotNull final EnchantmentType type, - @NotNull final EnchantmentRarity rarity, - @NotNull final String color) { - this.enchantment = enchantment; - this.name = name; - this.description = description; - this.type = type; - this.rarity = rarity; - this.color = color; - this.stringDescription = new HashMap<>(); - this.requirementLore = new ArrayList<>(); - if (enchantment instanceof EcoEnchant ecoEnchant) { - for (String s : ecoEnchant.getRequirementLore()) { - requirementLore.add(Display.PREFIX + s); - } - } - - for (Integer level : description.keySet()) { - StringBuilder descriptionBuilder = new StringBuilder(); - - for (String s : description.get(level)) { - descriptionBuilder.append(s); - descriptionBuilder.append(" "); - } - - String processedStringDescription = descriptionBuilder.toString(); - processedStringDescription = processedStringDescription.replace(Display.PREFIX, ""); - stringDescription.put(level, processedStringDescription.replaceAll(PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor(), "")); - } - } - - /** - * Get the name with the level. - * - * @param level The level. - * @return The name with the level. - */ - public String getNameWithLevel(final int level) { - return getNameWithLevel(level, null); - } - - /** - * Get enchantment with level. - * - * @param level The level. - * @param player The player. - * @return The name with the level. - */ - public String getNameWithLevel(final int level, - @Nullable final Player player) { - StringBuilder builder = new StringBuilder(); - builder.append(name); - - if (enchantment instanceof EcoEnchant enchant && player != null) { - if (!enchant.areRequirementsMet(player)) { - builder.insert(0, PLUGIN.getDisplayModule().getOptions().getRequirementsOptions().getRequirementColor()); - } - } - - if (!(enchantment.getMaxLevel() == 1 && level == 1) && level != 0) { - StringBuilder numberString = new StringBuilder(); - numberString.append(" "); - - NumbersOptions numbersOptions = PLUGIN.getDisplayModule().getOptions().getNumbersOptions(); - - if (numbersOptions.isUseNumerals() && level < numbersOptions.getThreshold()) { - numberString.append(NumberUtils.toNumeral(level)); - } else { - numberString.append(level); - } - - if (level > enchantment.getMaxLevel() && PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().isReformatAboveMaxLevel()) { - if (PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().isNumbersOnly()) { - String aboveMaxLevel = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat(); - - builder.append(aboveMaxLevel) - .append(numberString); - } else { - String aboveMaxLevel = PLUGIN.getDisplayModule().getOptions().getMaxLevelOptions().getAboveMaxLevelFormat(); - builder.append(aboveMaxLevel) - .append(numberString); - } - } else { - builder.append(numberString); - } - } - - builder.insert(0, color); - return StringUtils.format(builder.toString(), StringUtils.FormatOption.WITHOUT_PLACEHOLDERS); - } - - /** - * Get the description of an enchantment at a certain level. - * - * @param level The level. - * @return The description, wrapped and formatted. - */ - public List getDescription(final int level) { - List description = this.description.get(level); - if (description == null) { - if (enchantment instanceof EcoEnchant enchant) { - List levelDesc = new ArrayList<>(); - List defDesc = enchant.getWrappedDescription(); - defDesc.replaceAll(line -> line.replace("&r", "&r" + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor())); - defDesc.replaceAll(line -> Display.PREFIX + PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor() + line); - for (String s : defDesc) { - levelDesc.add(s.replace("%value%", enchant.getPlaceholder(level))); - } - - this.description.put( - level, - StringUtils.formatList(levelDesc) - ); - } else { - List baseDesc = this.description.get(1); - this.description.put(level, baseDesc); - return baseDesc; - } - - return getDescription(level); - } else { - return description; - } - } - - /** - * Get the description of an enchantment at a certain level. - * - * @param level The level. - * @return The description, unwrapped and unformatted. - */ - public String getStringDescription(final int level) { - String stringDesc = this.stringDescription.get(level); - if (stringDesc == null) { - StringBuilder descriptionBuilder = new StringBuilder(); - - for (String s : description.get(level)) { - descriptionBuilder.append(s); - descriptionBuilder.append(" "); - } - - String processedStringDescription = descriptionBuilder.toString(); - processedStringDescription = processedStringDescription.replace(Display.PREFIX, ""); - stringDescription.put(level, processedStringDescription.replaceAll(PLUGIN.getDisplayModule().getOptions().getDescriptionOptions().getColor(), "")); - return getStringDescription(level); - } else { - return stringDesc; - } - } - - /** - * Get the description of an enchantment at level 1. - * - * @return The description, wrapped and formatted. - */ - @Deprecated - public List getDescription() { - return getDescription(1); - } - - /** - * Get the description of an enchantment at level 1. - * - * @return The description, unwrapped and unformatted. - */ - @Deprecated - public String getStringDescription() { - return getStringDescription(1); - } - - /** - * Get the unformatted name of the enchantment. - * - * @return The raw name. - */ - public String getRawName() { - return name; - } - - /** - * Get the formatted name of the enchantment. - * - * @return The name. - */ - public String getName() { - return getNameWithLevel(0); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java deleted file mode 100644 index b6a4fc46..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DescriptionOptions.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.data.PlayerProfile; -import com.willfp.ecoenchants.command.CommandToggleDescriptions; -import lombok.Getter; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class DescriptionOptions extends PluginDependent { - /** - * The threshold below which to describe enchantments. - */ - @Getter - private int threshold; - - /** - * If the options are enabled. - */ - @Getter - private boolean enabled; - - /** - * The description lines color. - */ - @Getter - private String color; - - /** - * If enchantment descriptions should be at the bottom of the enchantment lore rather than under each enchantment. - */ - @Getter - private boolean showingAtBottom; - - /** - * If descriptions should only be shown on books. - */ - @Getter - private boolean onlyOnBooks; - - /** - * Create new description options. - * - * @param plugin EcoEnchants. - */ - public DescriptionOptions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update the options. - */ - public void update() { - threshold = this.getPlugin().getConfigYml().getInt("lore.describe.before-lines"); - enabled = this.getPlugin().getConfigYml().getBool("lore.describe.enabled"); - color = this.getPlugin().getLangYml().getFormattedString("description-color"); - showingAtBottom = this.getPlugin().getConfigYml().getBool("lore.describe.at-bottom"); - onlyOnBooks = this.getPlugin().getConfigYml().getBool("lore.describe.only-on-books"); - } - - /** - * Get if descriptions are enabled for a player. - * - * @param player The player. - * @return If enabled. - */ - public boolean enabledForPlayer(@Nullable final Player player) { - if (player == null) { - return true; - } - - return PlayerProfile.load(player).read(CommandToggleDescriptions.DESCRIPTIONS_KEY); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java deleted file mode 100644 index e7f0c2f3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/DisplayOptions.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.display.Display; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import com.willfp.ecoenchants.display.options.sorting.SorterManager; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import lombok.Getter; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -public class DisplayOptions extends PluginDependent { - /** - * The description options being used. - */ - @Getter - private final DescriptionOptions descriptionOptions = new DescriptionOptions(this.getPlugin()); - /** - * The enchantment level options being used. - */ - @Getter - private final NumbersOptions numbersOptions = new NumbersOptions(this.getPlugin()); - /** - * The shrink options being used. - */ - @Getter - private final ShrinkOptions shrinkOptions = new ShrinkOptions(this.getPlugin()); - /** - * The max level options being used. - */ - @Getter - private final MaxLevelOptions maxLevelOptions = new MaxLevelOptions(this.getPlugin()); - /** - * The requirements options being used. - */ - @Getter - private final RequirementsOptions requirementsOptions = new RequirementsOptions(this.getPlugin()); - /** - * The enchantment types, sorted according to config. - */ - @Getter - private final List sortedTypes = new ArrayList<>(); - /** - * The enchantment rarities, sorted according to config. - */ - @Getter - private final List sortedRarities = new ArrayList<>(); - /** - * The enchantment sorter being used. - */ - @Getter - private EnchantmentSorter sorter; - - /** - * If item must be a target. - */ - @Getter - private boolean requireTarget = true; - - /** - * If enchants should be displayed above lore. - */ - @Getter - private boolean aboveLore = true; - - /** - * Lore prefix (above enchantments). - */ - @Getter - private List lorePrefix; - - /** - * Lore suffix (below enchantments). - */ - @Getter - private List loreSuffix; - - /** - * If prefix/suffix should show on books. - */ - @Getter - private boolean prefixOnBooks; - - /** - * Instantiate new display options. - * - * @param plugin EcoEnchants. - */ - @ApiStatus.Internal - public DisplayOptions(@NotNull final EcoPlugin plugin) { - super(plugin); - update(); - } - - /** - * Update all options. - */ - public void update() { - descriptionOptions.update(); - numbersOptions.update(); - shrinkOptions.update(); - maxLevelOptions.update(); - requirementsOptions.update(); - - sortedTypes.clear(); - sortedTypes.addAll(this.getPlugin().getConfigYml().getStrings("lore.type-ordering").stream() - .map(typeName -> EnchantmentType.values().stream().filter(type -> type.getName().equalsIgnoreCase(typeName)).findFirst().orElse(null)) - .filter(Objects::nonNull).toList()); - sortedTypes.addAll(EnchantmentType.values().stream().filter(enchantmentType -> !sortedTypes.contains(enchantmentType)).toList()); - - sortedRarities.clear(); - sortedRarities.addAll(this.getPlugin().getConfigYml().getStrings("lore.rarity-ordering").stream() - .map(rarityName -> EnchantmentRarity.values().stream().filter(rarity -> rarity.getName().equalsIgnoreCase(rarityName)).findFirst().orElse(null)) - .filter(Objects::nonNull).toList()); - sortedRarities.addAll(EnchantmentRarity.values().stream().filter(enchantmentRarity -> !sortedRarities.contains(enchantmentRarity)).toList()); - - requireTarget = this.getPlugin().getConfigYml().getBool("lore.require-target"); - aboveLore = this.getPlugin().getConfigYml().getBool("lore.above-other-lore"); - - lorePrefix = this.getPlugin().getConfigYml().getFormattedStrings("lore.prefix").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList()); - loreSuffix = this.getPlugin().getConfigYml().getFormattedStrings("lore.suffix").stream().map(s -> Display.PREFIX + s).collect(Collectors.toList()); - prefixOnBooks = this.getPlugin().getConfigYml().getBool("lore.prefix-on-books"); - - boolean byType = this.getPlugin().getConfigYml().getBool("lore.sort-by-type"); - boolean byLength = this.getPlugin().getConfigYml().getBool("lore.sort-by-length"); - boolean byRarity = this.getPlugin().getConfigYml().getBool("lore.sort-by-rarity"); - Set params = new HashSet<>(); - if (byType) { - params.add(SortParameters.TYPE); - } - if (byLength) { - params.add(SortParameters.LENGTH); - } - if (byRarity) { - params.add(SortParameters.RARITY); - } - - sorter = SorterManager.getSorter(params.toArray(new SortParameters[]{})); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/MaxLevelOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/MaxLevelOptions.java deleted file mode 100644 index 4652f17f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/MaxLevelOptions.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -public class MaxLevelOptions extends PluginDependent { - - /** - * If enchantments should have a different format above max level. - */ - @Getter - private boolean reformatAboveMaxLevel; - - /** - * The above max level format. - */ - @Getter - private String aboveMaxLevelFormat; - - /** - * If only the numbers should be formatted. - */ - @Getter - private boolean numbersOnly; - - /** - * Create new description options. - * - * @param plugin EcoEnchants. - */ - public MaxLevelOptions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update the options. - */ - public void update() { - reformatAboveMaxLevel = this.getPlugin().getConfigYml().getBool("lore.above-max-level.reformat"); - numbersOnly = this.getPlugin().getConfigYml().getBool("lore.above-max-level.numbers-only"); - aboveMaxLevelFormat = this.getPlugin().getLangYml().getString("above-max-level-color"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java deleted file mode 100644 index cef528ba..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/NumbersOptions.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -public class NumbersOptions extends PluginDependent { - /** - * If numerals should be used. - *

- * If false then numbers will be used instead. - */ - @Getter - private boolean useNumerals; - - /** - * The threshold above which numbers will be used instead. - */ - @Getter - private int threshold; - - /** - * Create new numbers options. - * - * @param plugin EcoEnchants. - */ - public NumbersOptions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update the options. - */ - public void update() { - useNumerals = this.getPlugin().getConfigYml().getBool("lore.use-numerals"); - threshold = this.getPlugin().getConfigYml().getInt("lore.use-numbers-above-threshold"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/RequirementsOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/RequirementsOptions.java deleted file mode 100644 index 585530bd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/RequirementsOptions.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -public class RequirementsOptions extends PluginDependent { - /** - * If numerals should be used. - *

- * If false then numbers will be used instead. - */ - @Getter - private String requirementColor; - - /** - * Create new numbers options. - * - * @param plugin EcoEnchants. - */ - public RequirementsOptions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update the options. - */ - public void update() { - requirementColor = this.getPlugin().getLangYml().getString("missing-requirements-format"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java deleted file mode 100644 index c6139d10..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/ShrinkOptions.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.display.options; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; - -public class ShrinkOptions extends PluginDependent { - /** - * The threshold above which enchantments will be shrunk. - */ - @Getter - private int threshold; - - /** - * If shrinking is enabled. - */ - @Getter - private boolean enabled; - - /** - * The amount of enchantments to have per-line. - */ - @Getter - private int shrinkPerLine; - - /** - * Create new shrink options. - * - * @param plugin EcoEnchants. - */ - public ShrinkOptions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update the options. - */ - public void update() { - threshold = this.getPlugin().getConfigYml().getInt("lore.shrink.after-lines"); - enabled = this.getPlugin().getConfigYml().getBool("lore.shrink.enabled"); - shrinkPerLine = this.getPlugin().getConfigYml().getInt("lore.shrink.maximum-per-line"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java deleted file mode 100644 index 7a0a3a01..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/EnchantmentSorter.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting; - -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public interface EnchantmentSorter { - /** - * Sort list of enchantments. - *

- * All implementations must treat enchantments as final or effectively final. - * - * @param toSort The enchantments to sort. - */ - void sortEnchantments(@NotNull List toSort); - - /** - * Get the parameters that the sorter fulfills. - * - * @return Array of all parameters. - */ - SortParameters[] getParameters(); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java deleted file mode 100644 index cd357891..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SortParameters.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting; - -public enum SortParameters { - /** - * If the sorter should sort by type or if type should be ignored. - */ - TYPE, - - /** - * If the sorter should sort by rarity or if rarity should be ignored. - */ - RARITY, - - /** - * If the sorter should sort by length or alphabetically. - */ - LENGTH -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java deleted file mode 100644 index 6b2478a3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/SorterManager.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting; - -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.options.sorting.implementations.AlphabeticSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.LengthSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.RarityAlphabeticSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.RarityLengthSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.RarityTypeAlphabeticSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.RarityTypeLengthSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.TypeAlphabeticSorter; -import com.willfp.ecoenchants.display.options.sorting.implementations.TypeLengthSorter; -import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -@UtilityClass -public class SorterManager { - /** - * All registered enchantment sorters. - */ - private static final Set REGISTERED = new HashSet<>(); - - static { - EcoEnchantsPlugin instance = EcoEnchantsPlugin.getInstance(); // Really dirty and janky. - REGISTERED.add(new AlphabeticSorter(instance)); - REGISTERED.add(new LengthSorter(instance)); - REGISTERED.add(new TypeAlphabeticSorter(instance)); - REGISTERED.add(new TypeLengthSorter(instance)); - REGISTERED.add(new RarityAlphabeticSorter(instance)); - REGISTERED.add(new RarityLengthSorter(instance)); - REGISTERED.add(new RarityTypeAlphabeticSorter(instance)); - REGISTERED.add(new RarityTypeLengthSorter(instance)); - } - - /** - * Get a sorter based off of parameters. - *

- * Any combination of parameters is valid. - * - * @param parameters The parameters to find a sorter from. - * @return The matching sorter. - */ - public static EnchantmentSorter getSorter(@NotNull final SortParameters... parameters) { - return REGISTERED.stream() - .filter(enchantmentSorter -> Arrays.asList(enchantmentSorter.getParameters()).containsAll(Arrays.asList(parameters)) && enchantmentSorter.getParameters().length == parameters.length) - .findFirst() - .orElse(new AlphabeticSorter(EcoEnchantsPlugin.getInstance())); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/AlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/AlphabeticSorter.java deleted file mode 100644 index 17d053c4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/AlphabeticSorter.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class AlphabeticSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public AlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - toSort.sort(((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName()))); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[0]; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/LengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/LengthSorter.java deleted file mode 100644 index 635c97d8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/LengthSorter.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.Comparator; -import java.util.List; - -public class LengthSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public LengthSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - toSort.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length())); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.LENGTH}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java deleted file mode 100644 index f91b8396..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityAlphabeticSorter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class RarityAlphabeticSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public RarityAlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty() - || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) { - this.getPlugin().getDisplayModule().update(); - } - - List sorted = new ArrayList<>(); - - this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> { - List rarityEnchants = new ArrayList<>(); - for (Enchantment enchantment : toSort) { - if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) { - rarityEnchants.add(enchantment); - } - } - rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName())); - sorted.addAll(rarityEnchants); - }); - - toSort.clear(); - toSort.addAll(sorted); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.RARITY}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java deleted file mode 100644 index bb7d4311..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityLengthSorter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -public class RarityLengthSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public RarityLengthSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty() - || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) { - this.getPlugin().getDisplayModule().update(); - } - - List sorted = new ArrayList<>(); - this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> { - List rarityEnchants = new ArrayList<>(); - for (Enchantment enchantment : toSort) { - if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) { - rarityEnchants.add(enchantment); - } - } - rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length())); - sorted.addAll(rarityEnchants); - }); - - toSort.clear(); - toSort.addAll(sorted); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.RARITY, SortParameters.LENGTH}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java deleted file mode 100644 index 249f229c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeAlphabeticSorter.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class RarityTypeAlphabeticSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public RarityTypeAlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty() - || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) { - this.getPlugin().getDisplayModule().update(); - } - - List sorted = new ArrayList<>(); - this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> { - List typeEnchants = new ArrayList<>(); - for (Enchantment enchantment : toSort) { - if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) { - typeEnchants.add(enchantment); - } - } - typeEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName())); - - this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> { - List rarityEnchants = new ArrayList<>(); - for (Enchantment enchantment : typeEnchants) { - if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) { - rarityEnchants.add(enchantment); - } - } - rarityEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName())); - sorted.addAll(rarityEnchants); - }); - }); - - toSort.clear(); - toSort.addAll(sorted); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.RARITY, SortParameters.TYPE}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java deleted file mode 100644 index bfa0089b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/RarityTypeLengthSorter.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -public class RarityTypeLengthSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public RarityTypeLengthSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty() - || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) { - this.getPlugin().getDisplayModule().update(); - } - - List sorted = new ArrayList<>(); - this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> { - List typeEnchants = new ArrayList<>(); - for (Enchantment enchantment : toSort) { - if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) { - typeEnchants.add(enchantment); - } - } - - typeEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length())); - - this.getPlugin().getDisplayModule().getOptions().getSortedRarities().forEach(enchantmentRarity -> { - List rarityEnchants = new ArrayList<>(); - for (Enchantment enchantment : typeEnchants) { - if (EnchantmentCache.getEntry(enchantment).getRarity().equals(enchantmentRarity)) { - rarityEnchants.add(enchantment); - } - } - rarityEnchants.sort(Comparator.comparingInt(enchantment -> EnchantmentCache.getEntry(enchantment).getRawName().length())); - sorted.addAll(rarityEnchants); - }); - }); - - toSort.clear(); - toSort.addAll(sorted); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.RARITY, SortParameters.TYPE, SortParameters.LENGTH}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java deleted file mode 100644 index c8cfe183..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeAlphabeticSorter.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class TypeAlphabeticSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public TypeAlphabeticSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty() - || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) { - this.getPlugin().getDisplayModule().update(); - } - - List sorted = new ArrayList<>(); - this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> { - List typeEnchants = new ArrayList<>(); - for (Enchantment enchantment : toSort) { - if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) { - typeEnchants.add(enchantment); - } - } - - typeEnchants.sort((enchantment1, enchantment2) -> EnchantmentCache.getEntry(enchantment1).getRawName().compareToIgnoreCase(EnchantmentCache.getEntry(enchantment2).getRawName())); - sorted.addAll(typeEnchants); - }); - - toSort.clear(); - toSort.addAll(sorted); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.TYPE}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java deleted file mode 100644 index 608049ea..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/display/options/sorting/implementations/TypeLengthSorter.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.willfp.ecoenchants.display.options.sorting.implementations; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.display.options.sorting.EnchantmentSorter; -import com.willfp.ecoenchants.display.options.sorting.SortParameters; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class TypeLengthSorter extends PluginDependent implements EnchantmentSorter { - /** - * Instantiate sorter. - * - * @param plugin Instance of EcoEnchants. - */ - public TypeLengthSorter(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @Override - public void sortEnchantments(@NotNull final List toSort) { - if (this.getPlugin().getDisplayModule().getOptions().getSortedRarities().isEmpty() - || this.getPlugin().getDisplayModule().getOptions().getSortedTypes().isEmpty()) { - this.getPlugin().getDisplayModule().update(); - } - - List sorted = new ArrayList<>(); - this.getPlugin().getDisplayModule().getOptions().getSortedTypes().forEach(enchantmentType -> { - List typeEnchants = new ArrayList<>(); - for (Enchantment enchantment : toSort) { - if (EnchantmentCache.getEntry(enchantment).getType().equals(enchantmentType)) { - typeEnchants.add(enchantment); - } - } - - sorted.addAll(typeEnchants); - }); - - toSort.clear(); - toSort.addAll(sorted); - } - - @Override - public SortParameters[] getParameters() { - return new SortParameters[]{SortParameters.TYPE, SortParameters.LENGTH}; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java deleted file mode 100644 index b239ca28..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchant.java +++ /dev/null @@ -1,597 +0,0 @@ -package com.willfp.ecoenchants.enchantments; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.config.configs.BaseEnchantmentConfig; -import com.willfp.ecoenchants.config.configs.EnchantmentConfig; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentRarity; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.enchantments.util.Watcher; -import com.willfp.ecoenchants.enchantments.util.requirements.Requirement; -import com.willfp.ecoenchants.enchantments.util.requirements.Requirements; -import lombok.Getter; -import net.kyori.adventure.text.Component; -import org.apache.commons.lang.Validate; -import org.apache.commons.lang.WordUtils; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.World; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityCategory; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.inventory.EquipmentSlot; -import org.bukkit.inventory.ItemStack; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionDefault; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; - -@SuppressWarnings({"deprecation", "RedundantSuppression"}) -public abstract class EcoEnchant extends Enchantment implements Listener, Watcher { - /** - * Instance of EcoEnchants for enchantments to be able to access. - */ - @Getter - private final EcoEnchantsPlugin plugin = EcoEnchantsPlugin.getInstance(); - - /** - * The permission/config name of the enchantment. - */ - @Getter - private final String permissionName; - - /** - * The type of the enchantment. - */ - @Getter - private final EnchantmentType type; - - /** - * The enchantment's config. - */ - @Getter - private final EnchantmentConfig config; - - /** - * The targets of the enchantment. - */ - @Getter - private final Set targets = new HashSet<>(); - - /** - * The materials of the targets. - */ - @Getter - private final Set targetMaterials = new HashSet<>(); - - /** - * The names of the worlds that this enchantment is disabled in. - */ - @Getter - private final Set disabledWorldNames = new HashSet<>(); - - /** - * The worlds that this enchantment is disabled in. - */ - @Getter - private final List disabledWorlds = new ArrayList<>(); - - /** - * The display name of the enchantment. - */ - @Getter - private String displayName; - - /** - * The description of the enchantment. - */ - @Getter - private String description; - - /** - * If the enchantment can be removed in a grindstone. - */ - @Getter - private boolean grindstoneable; - - /** - * If the enchantment can be obtained from an enchanting table. - */ - @Getter - private boolean availableFromTable; - - /** - * If the enchantment can be obtained from a villager. - */ - @Getter - private boolean availableFromVillager; - - /** - * If the enchantment can be obtained from a loot chest. - */ - @Getter - private boolean availableFromLoot; - - /** - * The maximum level for the enchantment to be obtained naturally. - */ - private int maxLevel; - - /** - * The enchantments that conflict with this enchantment. - */ - @Getter - private Set conflicts; - - /** - * The rarity of the enchantment. - */ - @Getter - private EnchantmentRarity enchantmentRarity; - - /** - * If the enchantment is enabled. - */ - private boolean enabled; - - /** - * Custom option flags for the enchantment. - */ - private final List flags = new ArrayList<>(); - - /** - * All the requirements needed in order to use the enchantment. - */ - private final Map> requirements = new HashMap<>(); - - /** - * Cached players to see if they meet requirements. - */ - private final Map cachedRequirements = new HashMap<>(); - - /** - * The requirement lore shown if the player doesn't meet the requirements. - */ - @Getter - private final List requirementLore = new ArrayList<>(); - - protected EcoEnchant(@NotNull final String key, - @NotNull final EnchantmentType type, - @Nullable final Config overrideConfig, - @NotNull final Prerequisite... prerequisites) { - super(NamespacedKey.minecraft(key)); - - this.type = type; - this.permissionName = key.replace("_", ""); - this.config = new EnchantmentConfig( - Objects.requireNonNullElseGet(overrideConfig, () -> new BaseEnchantmentConfig( - this.permissionName, - this.getClass(), - this, - this.getPlugin() - )), - this.permissionName, - this, - this.getPlugin() - ); - - if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable." + permissionName) == null) { - Permission permission = new Permission( - "ecoenchants.fromtable." + permissionName, - "Allows getting " + permissionName + " from an Enchanting Table", - PermissionDefault.TRUE - ); - permission.addParent(Objects.requireNonNull(Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*")), true); - Bukkit.getPluginManager().addPermission(permission); - } - - if (type.getRequiredToExtend() != null && !type.getRequiredToExtend().isInstance(this) && !(this instanceof CustomEcoEnchant)) { - return; - } - - if (!Prerequisite.areMet(prerequisites)) { - return; - } - - enabled = Objects.requireNonNullElse(config.getBoolOrNull("enabled"), true); - - if (!this.isEnabled() && this.getPlugin().getConfigYml().getBool("advanced.hard-disable.enabled")) { - return; - } - - this.update(); - - EcoEnchants.addNewEcoEnchant(this); - } - - /** - * Create a new EcoEnchant. - * - * @param key The key name of the enchantment - * @param type The type of the enchantment - * @param prerequisites Optional {@link Prerequisite}s that must be met - */ - protected EcoEnchant(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final Prerequisite... prerequisites) { - this(key, type, null, prerequisites); - } - - /** - * Update the enchantment based off config values. - * This can be overridden but may lead to unexpected behavior. - */ - public void update() { - config.loadFromLang(); - enchantmentRarity = config.getRarity(); - Validate.notNull(enchantmentRarity, "Rarity specified in " + this.permissionName + " is invalid!"); - conflicts = config.getEnchantments(EcoEnchants.GENERAL_LOCATION + "conflicts"); - grindstoneable = config.getBool(EcoEnchants.GENERAL_LOCATION + "grindstoneable"); - availableFromTable = config.getBool(EcoEnchants.OBTAINING_LOCATION + "table"); - availableFromVillager = config.getBool(EcoEnchants.OBTAINING_LOCATION + "villager"); - availableFromLoot = config.getBool(EcoEnchants.OBTAINING_LOCATION + "loot"); - maxLevel = config.getInt(EcoEnchants.GENERAL_LOCATION + "maximum-level", 1); - displayName = config.getFormattedString("name"); - description = config.getString("description"); - disabledWorldNames.clear(); - disabledWorldNames.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "disabled-in-worlds")); - disabledWorlds.clear(); - List worldNames = new ArrayList<>(); - for (World world : Bukkit.getWorlds()) { - worldNames.add(world.getName().toLowerCase()); - } - List disabledExistingWorldNames = disabledWorldNames.stream().filter(s -> worldNames.contains(s.toLowerCase())).toList(); - disabledWorlds.addAll(Bukkit.getWorlds().stream().filter(world -> disabledExistingWorldNames.contains(world.getName().toLowerCase())).toList()); - targets.clear(); - targetMaterials.clear(); - targets.addAll(config.getTargets()); - targets.forEach(enchantmentTarget -> targetMaterials.addAll(enchantmentTarget.getMaterials())); - enabled = config.getBool("enabled"); - flags.clear(); - flags.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "flags")); - EnchantmentUtils.registerPlaceholders(this); - for (String req : config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.list")) { - List split = Arrays.asList(req.split(":")); - if (split.size() < 2) { - continue; - } - - Requirement requirement = Requirements.getByID(split.get(0).toLowerCase()); - - this.requirements.put(requirement, split.subList(1, split.size())); - } - requirementLore.clear(); - requirementLore.addAll(config.getStrings(EcoEnchants.GENERAL_LOCATION + "requirements.not-met-lore")); - - postUpdate(); - this.register(); - this.clearCachedRequirements(); - } - - protected void postUpdate() { - // Unused as some enchantments may have postUpdate tasks, however most won't. - } - - /** - * Register the enchantment with spigot. - * Only used internally. - */ - public void register() { - EnchantmentUtils.register(this); - } - - /** - * Clear requirements cache. - */ - public void clearCachedRequirements() { - this.cachedRequirements.clear(); - } - - /** - * Format the %value% placeholder in description lore. - * - * @param level The level of the enchantment. - * @return The placeholder. - */ - public String getPlaceholder(final int level) { - return "unknown"; - } - - /** - * Does the player meet the requirements to use this enchantment. - * - * @param entity The entity. - * @return If the requirements are met. - */ - public boolean areRequirementsMet(@NotNull final LivingEntity entity) { - if (!(entity instanceof Player player)) { - return true; - } - - if (cachedRequirements.containsKey(player.getUniqueId())) { - return cachedRequirements.get(player.getUniqueId()); - } - - for (Map.Entry> entry : requirements.entrySet()) { - if (!entry.getKey().isMetBy(player, entry.getValue())) { - cachedRequirements.put(player.getUniqueId(), false); - return false; - } - } - - cachedRequirements.put(player.getUniqueId(), true); - return true; - } - - /** - * Get description of enchantment line-wrapped. - * - * @return The description. - */ - public List getWrappedDescription() { - return Arrays.asList(WordUtils.wrap(description, this.getPlugin().getConfigYml().getInt("lore.describe.wrap"), "\n", false).split("\\r?\\n")); - } - - /** - * If enchantment conflicts with any enchantment in collection. - * - * @param enchantments The collection to test against. - * @return If there are any conflicts. - */ - public boolean conflictsWithAny(@NotNull final Collection enchantments) { - return conflicts.stream().anyMatch(enchantments::contains); - } - - /** - * If enchantment has specified flag. - * - * @param flag The flag. - * @return If the enchantment has the flag. - */ - public boolean hasFlag(@NotNull final String flag) { - return this.flags.contains(flag); - } - - /** - * If enchantment is enabled. - * - * @return If enabled. - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Get the internal name of the enchantment. - * - * @return The name. - * @deprecated Exists for parity. - */ - @NotNull - @Deprecated - public String getName() { - return this.getKey().getKey().toUpperCase(); - } - - /** - * Get max level of enchantment. - * - * @return The max level. - */ - @Override - public int getMaxLevel() { - return maxLevel; - } - - /** - * @return 1 - */ - @Override - public int getStartLevel() { - return 1; - } - - /** - * Do not use this method. - * Only here for compatibility with {@link Enchantment}. - * - * @return Returns {@link EnchantmentTarget#ALL}. Do not use. - * @deprecated {@link EnchantmentTarget} is not supported due to its lack of flexibility. Use {@link EcoEnchant#getTargets()} instead. - */ - @Override - @Deprecated - public @NotNull org.bukkit.enchantments.EnchantmentTarget getItemTarget() { - return org.bukkit.enchantments.EnchantmentTarget.ALL; - } - - /** - * Treasure enchantments do not exist in EcoEnchants. - * - * @return false. - * @see EnchantmentType#SPECIAL - * @deprecated Treasure enchantments do not exist. Use {@link EcoEnchant#getType()} instead. - */ - @Override - @Deprecated - public boolean isTreasure() { - return this.type.equals(EnchantmentType.SPECIAL); - } - - /** - * While this method works, it is not recommended to use it. - * - * @return Returns if enchantment is cursed. - * @see EnchantmentType#CURSE - * @deprecated Use {@link EcoEnchant#getType()} instead. - */ - @Override - @Deprecated - public boolean isCursed() { - return this.type.equals(EnchantmentType.CURSE); - } - - /** - * Get if enchantment conflicts with specified enchantment. - * - * @param enchantment The enchantment to test against. - * @return If conflicts. - */ - @Override - public boolean conflictsWith(@NotNull final Enchantment enchantment) { - if (enchantment instanceof EcoEnchant) { - return conflicts.contains(enchantment) || ((EcoEnchant) enchantment).conflicts.contains(this); - } - return conflicts.contains(enchantment); - } - - /** - * If enchantment can be applied to item. - * - * @param itemStack The {@link ItemStack} to test against. - * @return If can be applied. - */ - @Override - public boolean canEnchantItem(@NotNull final ItemStack itemStack) { - if (this.type.isSingular() && EcoEnchants.hasAnyOfType(itemStack, this.type)) { - return FastItemStack.wrap(itemStack).getEnchantmentLevel(this, true) > 0; - } - - if (itemStack.getType() == Material.BOOK || itemStack.getType() == Material.ENCHANTED_BOOK) { - return true; - } - - return targetMaterials.contains(itemStack.getType()); - } - - /** - * Paper parity. - *

- * You should use EnchantmentCache instead. - * - * @param level The level. - * @return The display name. - * @deprecated Use {@link EnchantmentCache#getEntry(Enchantment)} instead. - */ - @Deprecated - @Override - public @NotNull Component displayName(final int level) { - return StringUtils.toComponent(EnchantmentCache.getEntry(this).getNameWithLevel(level)); - } - - /** - * Paper parity. - *

- * You should use {@link EcoEnchant#isAvailableFromVillager()} instead. - * - * @return If tradeable. - * @deprecated Use {@link EcoEnchant#isAvailableFromVillager()} instead. - */ - @Deprecated - @Override - public boolean isTradeable() { - return this.isAvailableFromVillager(); - } - - /** - * Paper parity. - *

- * You should use {@link EcoEnchant#isAvailableFromLoot()} instead. - * - * @return If discoverable. - * @deprecated Use {@link EcoEnchant#isAvailableFromLoot()} instead. - */ - @Deprecated - @Override - public boolean isDiscoverable() { - return this.isAvailableFromLoot(); - } - - /** - * Paper parity. - *

- * EcoEnchants has its own systems for everything like this. Will always return 0. - * - * @param level The level. - * @param entityCategory The category. - * @return 0 - * @deprecated EcoEnchants has its own systems for this. - */ - @Deprecated - @Override - public float getDamageIncrease(final int level, - @NotNull final EntityCategory entityCategory) { - return 0; - } - - /** - * Paper parity. - *

- * EcoEnchants has its own systems for targets. - *

- * Use {@link EcoEnchant#getTargets()} instead. - * - * @return An empty set. - * @deprecated Use {@link EcoEnchant#getTargets()}. - */ - @Deprecated - @Override - public @NotNull Set getActiveSlots() { - return new HashSet<>(); - } - - /** - * Paper parity. - *

- * eco / EcoEnchants recodes display entirely. - * - * @return A translation key. - * @deprecated Useless method, all items will be display differently using eco. - */ - @Deprecated - @Override - public @NotNull String translationKey() { - return "ecoenchants:enchantment." + this.getKey().getKey(); - } - - /** - * Paper parity. - *

- * EcoEnchants has its own systems for rarity. - *

- * Use {@link EcoEnchant#getEnchantmentRarity()} instead. - * - * @return {@link io.papermc.paper.enchantments.EnchantmentRarity#COMMON}. - * @deprecated Use {@link EcoEnchant#getEnchantmentRarity()}. - */ - @Deprecated - @Override - public @NotNull io.papermc.paper.enchantments.EnchantmentRarity getRarity() { - return io.papermc.paper.enchantments.EnchantmentRarity.COMMON; - } - - @Override - public String toString() { - return "EcoEnchant{" + this.getKey() + "}"; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java deleted file mode 100644 index 886239cf..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/EcoEnchants.java +++ /dev/null @@ -1,609 +0,0 @@ -package com.willfp.ecoenchants.enchantments; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableList; -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.custom.CustomEcoEnchants; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AngerArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.AshArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CloudsArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CopperArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.CrimsonArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.DamageArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.DragonArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.DustArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.EmeraldArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.EnchantmentArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.EndArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.FireArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.GlowArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.HeartArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.HoneyArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.InkArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.LavaArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.LimeArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.MagicArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.MagmaArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.MusicArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.NautilusArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.NetherArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.RainArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.RedstoneArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SlimeArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SmokeArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SnowArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SoulArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SoulFireArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SparkArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SparkleArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SporeArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.SweepArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.TearArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.TotemArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.VillagerArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WarpedArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WaterArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WaxArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.WitchArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.artifact.ZapArtifact; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.BreaklessnessCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.CallingCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.DecayCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.FragilityCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.HarmlessnessCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.HungerCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.InaccuracyCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.MisfortuneCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.curse.PermanenceCurse; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Abattoir; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Abrasion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Aerial; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Aquatic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arachnid; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arborist; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Arcanic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Atmospheric; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Backstab; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Beheading; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BlastMining; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Bleed; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Blind; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BlockBreather; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.BossHunter; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Buckshot; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Butchering; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cerebral; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Chopless; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cleave; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Collateral; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Conclude; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Corrosive; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cranial; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Criticals; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Cubism; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Defender; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Deflection; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Defusion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dexterous; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Disable; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Disappear; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Diurnal; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Diverse; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dousing; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Drill; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dullness; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Dweller; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Economical; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Electroshock; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.EndInfusion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.EnderSlayer; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Enderism; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Evasion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Extinguishing; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Extract; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Famine; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Farmhand; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Fetching; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Finality; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Finishing; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.FireAffinity; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.FirstStrike; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Flinch; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Forcefield; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Freerunner; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Frozen; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Fury; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Goliath; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Graceful; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Grapple; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.GreenThumb; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Grit; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Hellish; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Hook; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Horde; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.IceShot; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Identify; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Ignite; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.IllusionAspect; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Impact; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Incandescence; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.InfernalTouch; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Inferno; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Infuriate; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Insecticide; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Instantaneous; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Introversion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Invigoration; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Kinetic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Launch; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Leeching; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Lesion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Levitate; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.LiquidShot; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.LuckyCatch; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Lumberjack; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Magnetic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Marking; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Marksman; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Necrotic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.NetherInfusion; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Netheric; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Nocturnal; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Optics; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Oxygenate; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Pacify; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Paladin; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Paralyze; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Parasitic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Parry; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Phantasm; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Plasmic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Protector; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Proximity; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Puncture; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Quadrilateralism; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Radiance; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rage; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rapid; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reaper; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rebounding; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reel; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reinforcement; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Rejuvenation; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Replenish; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Respirator; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Revenant; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Sating; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Serrated; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Settle; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Shockwave; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.ShotAssist; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Sickening; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Slaughter; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Slicing; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Spearfishing; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Spiked; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Splash; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Stab; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Stalwart; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Stamina; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.StoneSwitcher; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.StrayAspect; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Succession; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Supercritical; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Sycophant; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Tectonic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Telekinesis; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Thor; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Thrive; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Tornado; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Toxic; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Transfuse; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Tripleshot; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.VampireAspect; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Vein; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Venom; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.VoidAffinity; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Voltage; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.WaterAffinity; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.WaterAspect; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Weakening; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Wisdom; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.WoodSwitcher; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Wound; -import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Zeus; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Aiming; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Annihilate; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Bladed; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Bolt; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Carve; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Confusion; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Energizing; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Force; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Frenzy; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Harpoon; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Indestructibility; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Instability; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Intellect; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.LifeSteal; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Pentashot; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Preservation; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Prosperity; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Razor; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Repairing; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Spring; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Streamlining; -import com.willfp.ecoenchants.enchantments.ecoenchants.special.Volatile; -import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Ascend; -import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Charge; -import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Dynamite; -import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Missile; -import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Quake; -import com.willfp.ecoenchants.enchantments.ecoenchants.spell.Vitalize; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.support.vanilla.VanillaEnchantments; -import com.willfp.ecoenchants.integrations.registration.RegistrationManager; -import com.willfp.libreforge.chains.EffectChains; -import lombok.experimental.UtilityClass; -import org.bukkit.NamespacedKey; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.Optional; - -@UtilityClass -@SuppressWarnings({"unused", "checkstyle:JavadocVariable"}) -public class EcoEnchants { - public static final String CONFIG_LOCATION = "config."; - public static final String OBTAINING_LOCATION = "obtaining."; - public static final String GENERAL_LOCATION = "general-config."; - - private static final BiMap BY_KEY = HashBiMap.create(); - private static final BiMap BY_NAME = HashBiMap.create(); - - public static final EcoEnchant TELEKINESIS = new Telekinesis(); - public static final EcoEnchant MARKSMAN = new Marksman(); - public static final EcoEnchant INFERNAL_TOUCH = new InfernalTouch(); - public static final EcoEnchant SPRING = new Spring(); - public static final EcoEnchant STRAY_ASPECT = new StrayAspect(); - public static final EcoEnchant ILLUSION_ASPECT = new IllusionAspect(); - public static final EcoEnchant SLICING = new Slicing(); - public static final EcoEnchant DEXTEROUS = new Dexterous(); - public static final EcoEnchant BEHEADING = new Beheading(); - public static final EcoEnchant NECROTIC = new Necrotic(); - public static final EcoEnchant TECTONIC = new Tectonic(); - public static final EcoEnchant EVASION = new Evasion(); - public static final EcoEnchant SUCCESSION = new Succession(); - public static final EcoEnchant FARMHAND = new Farmhand(); - public static final EcoEnchant WISDOM = new Wisdom(); - public static final EcoEnchant LEECHING = new Leeching(); - public static final EcoEnchant VAMPIRE_ASPECT = new VampireAspect(); - public static final EcoEnchant INSTABILITY = new Instability(); - public static final EcoEnchant THRIVE = new Thrive(); - public static final EcoEnchant DRILL = new Drill(); - public static final EcoEnchant THOR = new Thor(); - public static final EcoEnchant STREAMLINING = new Streamlining(); - public static final EcoEnchant FIRST_STRIKE = new FirstStrike(); - public static final EcoEnchant FINISHING = new Finishing(); - public static final EcoEnchant CRITICALS = new Criticals(); - public static final EcoEnchant INCANDESCENCE = new Incandescence(); - public static final EcoEnchant SUPERCRITICAL = new Supercritical(); - public static final EcoEnchant ABRASION = new Abrasion(); - public static final EcoEnchant SPLASH = new Splash(); - public static final EcoEnchant EXTINGUISHING = new Extinguishing(); - public static final EcoEnchant GOLIATH = new Goliath(); - public static final EcoEnchant OPTICS = new Optics(); - public static final EcoEnchant DEFUSION = new Defusion(); - public static final EcoEnchant CEREBRAL = new Cerebral(); - public static final EcoEnchant GRIT = new Grit(); - public static final EcoEnchant BOSS_HUNTER = new BossHunter(); - public static final EcoEnchant INVIGORATION = new Invigoration(); - public static final EcoEnchant REJUVENATION = new Rejuvenation(); - public static final EcoEnchant FRAGILITY_CURSE = new FragilityCurse(); - public static final EcoEnchant TRIPLESHOT = new Tripleshot(); - public static final EcoEnchant RAPID = new Rapid(); - public static final EcoEnchant SATING = new Sating(); - public static final EcoEnchant REINFORCEMENT = new Reinforcement(); - public static final EcoEnchant SOULBOUND = new Soulbound(); - public static final EcoEnchant RAZOR = new Razor(); - public static final EcoEnchant PROSPERITY = new Prosperity(); - public static final EcoEnchant PRESERVATION = new Preservation(); - public static final EcoEnchant FRENZY = new Frenzy(); - public static final EcoEnchant BUTCHERING = new Butchering(); - public static final EcoEnchant PROXIMITY = new Proximity(); - public static final EcoEnchant ENDER_SLAYER = new EnderSlayer(); - public static final EcoEnchant PROTECTOR = new Protector(); - public static final EcoEnchant INDESTRUCTIBILITY = new Indestructibility(); - public static final EcoEnchant ENERGIZING = new Energizing(); - public static final EcoEnchant INTELLECT = new Intellect(); - public static final EcoEnchant DEFLECTION = new Deflection(); - public static final EcoEnchant LAUNCH = new Launch(); - public static final EcoEnchant PERMANENCE_CURSE = new PermanenceCurse(); - public static final EcoEnchant SPEARFISHING = new Spearfishing(); - public static final EcoEnchant NETHER_INFUSION = new NetherInfusion(); - public static final EcoEnchant REPLENISH = new Replenish(); - public static final EcoEnchant FLINCH = new Flinch(); - public static final EcoEnchant ELECTROSHOCK = new Electroshock(); - public static final EcoEnchant NOCTURNAL = new Nocturnal(); - public static final EcoEnchant CONFUSION = new Confusion(); - public static final EcoEnchant ARCANIC = new Arcanic(); - public static final EcoEnchant PENTASHOT = new Pentashot(); - public static final EcoEnchant LUMBERJACK = new Lumberjack(); - public static final EcoEnchant STONE_SWITCHER = new StoneSwitcher(); - public static final EcoEnchant MAGNETIC = new Magnetic(); - public static final EcoEnchant REPAIRING = new Repairing(); - public static final EcoEnchant CALLING_CURSE = new CallingCurse(); - public static final EcoEnchant BLAST_MINING = new BlastMining(); - public static final EcoEnchant LIQUID_SHOT = new LiquidShot(); - public static final EcoEnchant GRAPPLE = new Grapple(); - public static final EcoEnchant HEART_ARTIFACT = new HeartArtifact(); - public static final EcoEnchant SPARKLE_ARTIFACT = new SparkleArtifact(); - public static final EcoEnchant LAVA_ARTIFACT = new LavaArtifact(); - public static final EcoEnchant DRAGON_ARTIFACT = new DragonArtifact(); - public static final EcoEnchant ENCHANTMENT_ARTIFACT = new EnchantmentArtifact(); - public static final EcoEnchant SMOKE_ARTIFACT = new SmokeArtifact(); - public static final EcoEnchant FIRE_ARTIFACT = new FireArtifact(); - public static final EcoEnchant EMERALD_ARTIFACT = new EmeraldArtifact(); - public static final EcoEnchant NETHER_ARTIFACT = new NetherArtifact(); - public static final EcoEnchant END_ARTIFACT = new EndArtifact(); - public static final EcoEnchant WATER_ARTIFACT = new WaterArtifact(); - public static final EcoEnchant TOTEM_ARTIFACT = new TotemArtifact(); - public static final EcoEnchant REDSTONE_ARTIFACT = new RedstoneArtifact(); - public static final EcoEnchant ZAP_ARTIFACT = new ZapArtifact(); - public static final EcoEnchant MUSIC_ARTIFACT = new MusicArtifact(); - public static final EcoEnchant SNOW_ARTIFACT = new SnowArtifact(); - public static final EcoEnchant WITCH_ARTIFACT = new WitchArtifact(); - public static final EcoEnchant HONEY_ARTIFACT = new HoneyArtifact(); - public static final EcoEnchant DAMAGE_ARTIFACT = new DamageArtifact(); - public static final EcoEnchant CLOUDS_ARTIFACT = new CloudsArtifact(); - public static final EcoEnchant MAGIC_ARTIFACT = new MagicArtifact(); - public static final EcoEnchant DUST_ARTIFACT = new DustArtifact(); - public static final EcoEnchant MAGMA_ARTIFACT = new MagmaArtifact(); - public static final EcoEnchant INK_ARTIFACT = new InkArtifact(); - public static final EcoEnchant ZEUS = new Zeus(); - public static final EcoEnchant KINETIC = new Kinetic(); - public static final EcoEnchant FIRE_AFFINITY = new FireAffinity(); - public static final EcoEnchant PARASITIC = new Parasitic(); - public static final EcoEnchant PARRY = new Parry(); - public static final EcoEnchant AIMING = new Aiming(); - public static final EcoEnchant HOOK = new Hook(); - public static final EcoEnchant BLEED = new Bleed(); - public static final EcoEnchant WEAKENING = new Weakening(); - public static final EcoEnchant OXYGENATE = new Oxygenate(); - public static final EcoEnchant WATER_ASPECT = new WaterAspect(); - public static final EcoEnchant STAMINA = new Stamina(); - public static final EcoEnchant COLLATERAL = new Collateral(); - public static final EcoEnchant HUNGER_CURSE = new HungerCurse(); - public static final EcoEnchant PALADIN = new Paladin(); - public static final EcoEnchant SERRATED = new Serrated(); - public static final EcoEnchant BLADED = new Bladed(); - public static final EcoEnchant INFERNO = new Inferno(); - public static final EcoEnchant STAB = new Stab(); - public static final EcoEnchant TORNADO = new Tornado(); - public static final EcoEnchant EXTRACT = new Extract(); - public static final EcoEnchant AERIAL = new Aerial(); - public static final EcoEnchant FAMINE = new Famine(); - public static final EcoEnchant ANNIHILATE = new Annihilate(); - public static final EcoEnchant RADIANCE = new Radiance(); - public static final EcoEnchant HORDE = new Horde(); - public static final EcoEnchant VEIN = new Vein(); - public static final EcoEnchant ICE_SHOT = new IceShot(); - public static final EcoEnchant PUNCTURE = new Puncture(); - public static final EcoEnchant SHOCKWAVE = new Shockwave(); - public static final EcoEnchant VOLATILE = new Volatile(); - public static final EcoEnchant INSTANTANEOUS = new Instantaneous(); - public static final EcoEnchant FREERUNNER = new Freerunner(); - public static final EcoEnchant BOLT = new Bolt(); - public static final EcoEnchant DULLNESS = new Dullness(); - public static final EcoEnchant IGNITE = new Ignite(); - public static final EcoEnchant CLEAVE = new Cleave(); - public static final EcoEnchant CARVE = new Carve(); - public static final EcoEnchant TOXIC = new Toxic(); - public static final EcoEnchant WATER_AFFINITY = new WaterAffinity(); - public static final EcoEnchant FORCEFIELD = new Forcefield(); - public static final EcoEnchant SYCOPHANT = new Sycophant(); - public static final EcoEnchant CHOPLESS = new Chopless(); - public static final EcoEnchant GREEN_THUMB = new GreenThumb(); - public static final EcoEnchant SPIKED = new Spiked(); - public static final EcoEnchant HARPOON = new Harpoon(); - public static final EcoEnchant REEL = new Reel(); - public static final EcoEnchant SHOT_ASSIST = new ShotAssist(); - public static final EcoEnchant FROZEN = new Frozen(); - public static final EcoEnchant DISAPPEAR = new Disappear(); - public static final EcoEnchant HARMLESSNESS_CURSE = new HarmlessnessCurse(); - public static final EcoEnchant FURY = new Fury(); - public static final EcoEnchant LEVITATE = new Levitate(); - public static final EcoEnchant BREAKLESSNESS_CURSE = new BreaklessnessCurse(); - public static final EcoEnchant DECAY_CURSE = new DecayCurse(); - public static final EcoEnchant MISFORTUNE_CURSE = new MisfortuneCurse(); - public static final EcoEnchant VENOM = new Venom(); - public static final EcoEnchant CRANIAL = new Cranial(); - public static final EcoEnchant AQUATIC = new Aquatic(); - public static final EcoEnchant BUCKSHOT = new Buckshot(); - public static final EcoEnchant DIVERSE = new Diverse(); - public static final EcoEnchant LIFE_STEAL = new LifeSteal(); - public static final EcoEnchant LIME_ARTIFACT = new LimeArtifact(); - public static final EcoEnchant FORCE = new Force(); - public static final EcoEnchant END_INFUSION = new EndInfusion(); - public static final EcoEnchant DIURNAL = new Diurnal(); - public static final EcoEnchant MARKING = new Marking(); - public static final EcoEnchant CORROSIVE = new Corrosive(); - public static final EcoEnchant WOUND = new Wound(); - public static final EcoEnchant FINALITY = new Finality(); - public static final EcoEnchant BLIND = new Blind(); - public static final EcoEnchant SICKENING = new Sickening(); - public static final EcoEnchant DEFENDER = new Defender(); - public static final EcoEnchant NETHERIC = new Netheric(); - public static final EcoEnchant ENDERISM = new Enderism(); - public static final EcoEnchant RAGE = new Rage(); - public static final EcoEnchant IMPACT = new Impact(); - public static final EcoEnchant PARALYZE = new Paralyze(); - public static final EcoEnchant IDENTIFY = new Identify(); - public static final EcoEnchant INFURIATE = new Infuriate(); - public static final EcoEnchant ATMOSPHERIC = new Atmospheric(); - public static final EcoEnchant REVENANT = new Revenant(); - public static final EcoEnchant INSECTICIDE = new Insecticide(); - public static final EcoEnchant SLAUGHTER = new Slaughter(); - public static final EcoEnchant SETTLE = new Settle(); - public static final EcoEnchant PHANTASM = new Phantasm(); - public static final EcoEnchant ARACHNID = new Arachnid(); - public static final EcoEnchant PACIFY = new Pacify(); - public static final EcoEnchant ABATTOIR = new Abattoir(); - public static final EcoEnchant DISABLE = new Disable(); - public static final EcoEnchant HELLISH = new Hellish(); - public static final EcoEnchant VOID_AFFINITY = new VoidAffinity(); - public static final EcoEnchant CUBISM = new Cubism(); - public static final EcoEnchant QUADRILATERALISM = new Quadrilateralism(); - public static final EcoEnchant LESION = new Lesion(); - public static final EcoEnchant CONCLUDE = new Conclude(); - public static final EcoEnchant GRACEFUL = new Graceful(); - public static final EcoEnchant BLOCK_BREATHER = new BlockBreather(); - public static final EcoEnchant VOLTAGE = new Voltage(); - public static final EcoEnchant TRANSFUSE = new Transfuse(); - public static final EcoEnchant INACCURACY_CURSE = new InaccuracyCurse(); - public static final EcoEnchant RESPIRATOR = new Respirator(); - public static final EcoEnchant FETCHING = new Fetching(); - public static final EcoEnchant ECONOMICAL = new Economical(); - public static final EcoEnchant SOUL_ARTIFACT = new SoulArtifact(); - public static final EcoEnchant SOUL_FIRE_ARTIFACT = new SoulFireArtifact(); - public static final EcoEnchant CRIMSON_ARTIFACT = new CrimsonArtifact(); - public static final EcoEnchant ASH_ARTIFACT = new AshArtifact(); - public static final EcoEnchant WARPED_ARTIFACT = new WarpedArtifact(); - public static final EcoEnchant TEAR_ARTIFACT = new TearArtifact(); - public static final EcoEnchant BACKSTAB = new Backstab(); - public static final EcoEnchant DWELLER = new Dweller(); - public static final EcoEnchant STALWART = new Stalwart(); - public static final EcoEnchant PLASMIC = new Plasmic(); - public static final EcoEnchant MISSILE = new Missile(); - public static final EcoEnchant QUAKE = new Quake(); - public static final EcoEnchant VITALIZE = new Vitalize(); - public static final EcoEnchant DYNAMITE = new Dynamite(); - public static final EcoEnchant CHARGE = new Charge(); - public static final EcoEnchant ASCEND = new Ascend(); - public static final EcoEnchant ARBORIST = new Arborist(); - public static final EcoEnchant LUCKY_CATCH = new LuckyCatch(); - public static final EcoEnchant INTROVERSION = new Introversion(); - public static final EcoEnchant VILLAGER_ARTIFACT = new VillagerArtifact(); - public static final EcoEnchant ANGER_ARTIFACT = new AngerArtifact(); - public static final EcoEnchant NAUTILUS_ARTIFACT = new NautilusArtifact(); - public static final EcoEnchant SWEEP_ARTIFACT = new SweepArtifact(); - public static final EcoEnchant REAPER = new Reaper(); - public static final EcoEnchant WOOD_SWITCHER = new WoodSwitcher(); - public static final EcoEnchant REBOUNDING = new Rebounding(); - public static final EcoEnchant COPPER_ARTIFACT = new CopperArtifact(); - public static final EcoEnchant GLOW_ARTIFACT = new GlowArtifact(); - public static final EcoEnchant SPARK_ARTIFACT = new SparkArtifact(); - public static final EcoEnchant SPORE_ARTIFACT = new SporeArtifact(); - public static final EcoEnchant WAX_ARTIFACT = new WaxArtifact(); - public static final EcoEnchant RAIN_ARTIFACT = new RainArtifact(); - public static final EcoEnchant SLIME_ARTIFACT = new SlimeArtifact(); - public static final EcoEnchant DOUSING = new Dousing(); - - /** - * Get all registered {@link EcoEnchant}s. - * - * @return A list of all {@link EcoEnchant}s. - */ - public static List values() { - return ImmutableList.copyOf(BY_KEY.values()); - } - - /** - * Get {@link EcoEnchant} matching display name. - * - * @param name The display name to search for. - * @return The matching {@link EcoEnchant}, or null if not found. - */ - public static EcoEnchant getByName(@NotNull final String name) { - return BY_NAME.get(name); - } - - /** - * Get {@link EcoEnchant} matching permission name. - * - * @param permissionName The permission name to search for. - * @return The matching {@link EcoEnchant}, or null if not found. - */ - public static EcoEnchant getByPermission(@NotNull final String permissionName) { - Optional matching = values().stream().filter(enchant -> enchant.getPermissionName().equalsIgnoreCase(permissionName)).findFirst(); - return matching.orElse(null); - } - - /** - * Get {@link EcoEnchant} matching key. - * - * @param key The NamespacedKey to search for. - * @return The matching {@link EcoEnchant}, or null if not found. - */ - public static EcoEnchant getByKey(@NotNull final NamespacedKey key) { - return BY_KEY.get(key); - } - - /** - * Get if {@link ItemStack} has any {@link EcoEnchant} matching specified {@link EnchantmentType}. - * - * @param item The {@link ItemStack} to check. - * @param type The {@link EnchantmentType} to match. - * @return True if has, false if doesn't have. - */ - public static boolean hasAnyOfType(@NotNull final ItemStack item, - @NotNull final EnchantmentType type) { - return FastItemStack.wrap(item).getEnchants(true).keySet() - .stream() - .filter(enchantment -> enchantment instanceof EcoEnchant) - .map(enchantment -> (EcoEnchant) enchantment) - .anyMatch(ecoEnchant -> ecoEnchant.getType().equals(type)); - } - - /** - * Update all {@link EcoEnchant}s. - * - * @param plugin Instance of EcoEnchants. - */ - @ConfigUpdater - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - for (Config config : plugin.getCustomEnchantsYml().getSubsections("chains")) { - EffectChains.compile(config, "Custom Enchant Chains"); - } - - CustomEcoEnchants.update(plugin); - - for (EcoEnchant ecoEnchant : new HashSet<>(values())) { - ecoEnchant.update(); - } - - VanillaEnchantments.update(plugin); - RegistrationManager.registerEnchantments(); - } - - /** - * Add new {@link EcoEnchant} to EcoEnchants. - *

- * Only for internal use, enchantments are automatically added in the constructor. - * - * @param enchant The {@link EcoEnchant} to add. - */ - public static void addNewEcoEnchant(@NotNull final EcoEnchant enchant) { - BY_KEY.remove(enchant.getKey()); - BY_NAME.inverse().remove(enchant); - BY_KEY.put(enchant.getKey(), enchant); - BY_NAME.put(enchant.getDisplayName(), enchant); - } - - /** - * Remove {@link EcoEnchant} from EcoEnchants. - * - * @param enchant The {@link EcoEnchant} to remove. - */ - public static void removeEcoEnchant(@NotNull final EcoEnchant enchant) { - BY_KEY.remove(enchant.getKey()); - BY_NAME.inverse().remove(enchant); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionHasEcoEnchantRequirements.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionHasEcoEnchantRequirements.java deleted file mode 100644 index 5e56fc7f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionHasEcoEnchantRequirements.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.libreforge.conditions.Condition; -import org.bukkit.NamespacedKey; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class ConditionHasEcoEnchantRequirements extends Condition { - /** - * Create new condition. - */ - public ConditionHasEcoEnchantRequirements() { - super("has_ecoenchant_requirements"); - } - - @Override - public boolean isConditionMet(@NotNull final Player player, - @NotNull final Config config) { - EcoEnchant ecoEnchant = EcoEnchants.getByKey(NamespacedKey.minecraft(config.getString("enchant"))); - return ecoEnchant.areRequirementsMet(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionInEcoEnchantWorld.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionInEcoEnchantWorld.java deleted file mode 100644 index 4e731a58..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/ConditionInEcoEnchantWorld.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.eco.util.ListUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.libreforge.conditions.Condition; -import org.bukkit.NamespacedKey; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class ConditionInEcoEnchantWorld extends Condition { - /** - * Create new condition. - */ - public ConditionInEcoEnchantWorld() { - super("in_ecoenchant_world"); - } - - @Override - public boolean isConditionMet(@NotNull final Player player, - @NotNull final Config config) { - EcoEnchant ecoEnchant = EcoEnchants.getByKey(NamespacedKey.minecraft(config.getString("enchant"))); - return !ListUtils.containsIgnoreCase(ecoEnchant.getDisabledWorldNames(), player.getWorld().getName()); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java deleted file mode 100644 index 7f0ea5ef..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchant.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.logging.Logger; - -public class CustomEcoEnchant extends EcoEnchant { - /** - * The levels. - */ - private final Map levels; - - /** - * Create custom EcoEnchant. - * - * @param config The config. - */ - public CustomEcoEnchant(@NotNull final Config config) { - super( - config.getString("id"), EnchantmentType.getByName(config.getString("type").toUpperCase()), config - ); - - this.levels = new HashMap<>(); - - int i = 1; - for (Config levelConfig : config.getSubsections("levels")) { - levels.put(i, new CustomEcoEnchantLevel(this, levelConfig, i)); - i++; - } - } - - @Override - public String getPlaceholder(final int level) { - return this.getLevel(level).getValuePlaceholder(); - } - - @Override - protected void postUpdate() { - for (EnchantmentTarget target : this.getTargets()) { - if (target.getSlot() == null) { - Logger logger = this.getPlugin().getLogger(); - logger.warning(""); - logger.warning("Problem with target " + target.getName() + "!"); - logger.warning("Go to target.yml and specify a slot for enchants to activate on!"); - logger.warning("Example:"); - logger.warning(target.getName() + ":"); - logger.warning(" - slot:hands"); - logger.warning(" - material1"); - logger.warning(" - material2"); - logger.warning(""); - logger.warning("Read the wiki to see available slots!"); - logger.warning("Custom Enchantment " + this.getKey().getKey() + " will not work until then"); - logger.warning(""); - } - } - } - - /** - * Get the level. - * - * @param level The level. - * @return The level. - */ - public CustomEcoEnchantLevel getLevel(final int level) { - return levels.get(level); - } - - /** - * Get the levels. - * - * @return The levels. - */ - public Set getLevels() { - return new HashSet<>(levels.values()); - } - - @Override - public int getMaxLevel() { - return this.levels.size(); - } - - @Override - public boolean isEnabled() { - return true; - } - - static { - new ConditionInEcoEnchantWorld(); - new ConditionHasEcoEnchantRequirements(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java deleted file mode 100644 index c9697cb4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantLevel.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.willfp.eco.core.config.BuildableConfig; -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.eco.core.placeholder.StaticPlaceholder; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.libreforge.Holder; -import com.willfp.libreforge.conditions.Conditions; -import com.willfp.libreforge.conditions.ConfiguredCondition; -import com.willfp.libreforge.effects.ConfiguredEffect; -import com.willfp.libreforge.effects.Effects; -import lombok.Getter; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -public class CustomEcoEnchantLevel implements Holder { - /** - * The parent EcoEnchant. - */ - @Getter - private final EcoEnchant parent; - - /** - * The conditions. - */ - private final Set conditions = new HashSet<>(); - - /** - * The effects. - */ - private final Set effects = new HashSet<>(); - - /** - * The value placeholder. - */ - @Getter - private final String valuePlaceholder; - - /** - * The level. - */ - private final int level; - - /** - * Create custom EcoEnchant level. - * - * @param parent The parent. - * @param config The config. - * @param level The level. - */ - public CustomEcoEnchantLevel(@NotNull final EcoEnchant parent, - @NotNull final Config config, - final int level) { - this.parent = parent; - this.level = level; - - config.injectPlaceholders(new StaticPlaceholder("level", () -> String.valueOf(level))); - - for (Config cfg : config.getSubsections("effects")) { - effects.add(Effects.compile(cfg, "Custom EcoEnchant ID " + parent.getKey().getKey())); - } - - for (Config cfg : config.getSubsections("conditions")) { - conditions.add(Conditions.compile(cfg, "Custom EcoEnchant ID " + parent.getKey().getKey())); - } - - conditions.add(Conditions.compile( - new BuildableConfig() - .add("args.enchant", parent.getKey().getKey()) - .add("id", "in_ecoenchant_world"), - "EcoEnchants Internals (world) - If you see this message, report it as a bug!" - )); - - conditions.add(Conditions.compile( - new BuildableConfig() - .add("args.enchant", parent.getKey().getKey()) - .add("id", "has_ecoenchant_requirements"), - "EcoEnchants Internals (requirements) - If you see this message, report it as a bug!" - )); - - this.valuePlaceholder = config.getString("value-placeholder"); - } - - @NotNull - @Override - public Set getConditions() { - return conditions; - } - - @NotNull - @Override - public Set getEffects() { - return effects; - } - - @Override - public String toString() { - return "CustomEcoEnchantLevel{" - + "parent=" + parent - + ",level=" + level - + '}'; - } - - @NotNull - @Override - public List getNotMetLines(@NotNull final Player player) { - return NotMetLineCacheEntry.CACHE.get(new NotMetLineCacheEntry(player.getUniqueId(), this.getId()), (entry) -> { - List lines = new ArrayList<>(); - - for (ConfiguredCondition condition : this.getConditions()) { - if (!condition.isMet(player)) { - lines.addAll(Objects.requireNonNullElse(condition.getNotMetLines(), new ArrayList<>())); - } - } - - return lines; - }); - } - - @NotNull - @Override - public String getId() { - return this.parent.getKey().getKey() + "_" + this.level; - } - - /** - * Cache for not met lines. - * - * @param uuid The UUID. - * @param holderID The holder ID. - */ - private record NotMetLineCacheEntry(@NotNull UUID uuid, - @NotNull String holderID) { - /** - * The cache. - */ - static final Cache> CACHE = Caffeine.newBuilder() - .expireAfterWrite(1, TimeUnit.SECONDS) - .build(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantRequirementListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantRequirementListeners.java deleted file mode 100644 index e42eb48b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchantRequirementListeners.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.libreforge.events.EffectActivateEvent; -import org.bukkit.event.Listener; -import org.jetbrains.annotations.NotNull; - -public class CustomEcoEnchantRequirementListeners extends PluginDependent implements Listener { - /** - * Initialize new listeners and link them to a plugin. - * - * @param plugin The plugin to link to. - */ - public CustomEcoEnchantRequirementListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - public void onActivate(@NotNull final EffectActivateEvent event) { - if (!(event.getHolder() instanceof CustomEcoEnchantLevel level)) { - return; - } - - EcoEnchant enchant = level.getParent(); - - if (!(enchant.areRequirementsMet(event.getPlayer()))) { - event.setCancelled(true); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchants.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchants.java deleted file mode 100644 index ebfb2f58..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEcoEnchants.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.willfp.eco.core.config.interfaces.Config; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -@UtilityClass -public class CustomEcoEnchants { - /** - * Custom EcoEnchants. - */ - private static final Set VALUES = new HashSet<>(); - - /** - * Update the map. - * - * @param plugin Instance of EcoEnchants. - */ - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - for (EcoEnchant enchant : VALUES) { - EcoEnchants.removeEcoEnchant(enchant); - EnchantmentUtils.unregister(enchant); - } - - VALUES.clear(); - - for (Config cfg : plugin.getCustomEnchantsYml().getSubsections("enchants")) { - VALUES.add(new CustomEcoEnchant(cfg)); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantEnableListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantEnableListeners.java deleted file mode 100644 index e4db5108..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantEnableListeners.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.libreforge.LibReforgeUtils; -import com.willfp.libreforge.effects.ConfiguredEffect; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityPickupItemEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.jetbrains.annotations.NotNull; - -public class CustomEnchantEnableListeners extends PluginDependent implements Listener { - /** - * Initialize new listeners and link them to a plugin. - * - * @param plugin The plugin to link to. - */ - public CustomEnchantEnableListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called on item pickup. - * - * @param event The event to listen for. - */ - @EventHandler - public void onItemPickup(@NotNull final EntityPickupItemEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(event.getItem().getItemStack().getType())) { - return; - } - - refreshPlayer(player); - } - - /** - * Called on player join. - * - * @param event The event to listen for. - */ - @EventHandler - public void onPlayerJoin(@NotNull final PlayerJoinEvent event) { - refresh(); - } - - /** - * Called on player leave. - * - * @param event The event to listen for. - */ - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - refresh(); - - Player player = event.getPlayer(); - - for (EcoEnchant value : EcoEnchants.values()) { - if (!(value instanceof CustomEcoEnchant enchant)) { - continue; - } - - for (CustomEcoEnchantLevel level : enchant.getLevels()) { - for (ConfiguredEffect effect : level.getEffects()) { - effect.disableFor(player); - } - } - } - } - - /** - * Called on item drop. - * - * @param event The event to listen for. - */ - @EventHandler - public void onInventoryDrop(@NotNull final PlayerDropItemEvent event) { - if (!EnchantmentTarget.ALL.getMaterials().contains(event.getItemDrop().getItemStack().getType())) { - return; - } - - refreshPlayer(event.getPlayer()); - } - - /** - * Called on slot change. - * - * @param event The event to listen for. - */ - @EventHandler - public void onChangeSlot(@NotNull final PlayerItemHeldEvent event) { - refreshPlayer(event.getPlayer()); - - this.getPlugin().getScheduler().run(() -> refreshPlayer(event.getPlayer())); - } - - /** - * Called on armor change. - * - * @param event The event to listen for. - */ - @EventHandler - public void onArmorChange(@NotNull final ArmorChangeEvent event) { - refreshPlayer(event.getPlayer()); - } - - /** - * Called on inventory click. - * - * @param event The event to listen for. - */ - @EventHandler - public void onInventoryClick(@NotNull final InventoryClickEvent event) { - if (!(event.getWhoClicked() instanceof Player)) { - return; - } - - refreshPlayer((Player) event.getWhoClicked()); - } - - /** - * Force refresh all online players. - *

- * This is a very expensive method. - */ - public void refresh() { - this.getPlugin().getServer().getOnlinePlayers().forEach(this::refreshPlayer); - } - - private void refreshPlayer(@NotNull final Player player) { - CustomEnchantLookup.clearCache(player); - LibReforgeUtils.updateEffects(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantLookup.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantLookup.java deleted file mode 100644 index f58b486e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/custom/CustomEnchantLookup.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.willfp.ecoenchants.enchantments.custom; - -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.willfp.eco.core.EcoPlugin; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; - -public class CustomEnchantLookup { - /** - * All registered providers. - */ - private static final Set>> PROVIDERS = new HashSet<>(); - - /** - * Cached items. - */ - private static final Cache> ITEM_CACHE = Caffeine.newBuilder() - .expireAfterWrite(2, TimeUnit.SECONDS) - .build(); - - /** - * Cached enchant levels. - */ - private static final Cache> ENCHANT_LEVELS_CACHE = Caffeine.newBuilder() - .expireAfterWrite(2, TimeUnit.SECONDS) - .build(); - - /** - * Instance of EcoEnchants. - */ - private static final EcoPlugin PLUGIN = EcoEnchantsPlugin.getInstance(); - - /** - * Register provider. - * - * @param provider The provider. - */ - public static void registerProvider(@NotNull final Function> provider) { - PROVIDERS.add(provider); - } - - /** - * Provide ItemStacks. - * - * @param p The player. - * @return The ItemStacks. - */ - public static Map provide(@NotNull final Player p) { - return ITEM_CACHE.get(p, player -> { - Map found = new HashMap<>(); - for (Function> provider : PROVIDERS) { - found.putAll(provider.apply(player)); - } - found.keySet().removeIf(Objects::isNull); - return found; - }); - } - - /** - * Provide levels. - * - * @param p The player. - * @return The levels. - */ - public static List provideLevels(@NotNull final Player p) { - return new ArrayList<>(ENCHANT_LEVELS_CACHE.get(p, player -> { - List found = new ArrayList<>(); - - for (Map.Entry entry : provide(player).entrySet()) { - ItemStack itemStack = entry.getKey(); - EnchantmentTarget.Slot slot = entry.getValue(); - if (itemStack == null) { - continue; - } - - Map enchants = EnchantChecks.getEnchantsOnItem(itemStack); - - if (enchants.isEmpty()) { - continue; - } - - for (Map.Entry enchantEntry : enchants.entrySet()) { - if (!(enchantEntry.getKey() instanceof CustomEcoEnchant enchant)) { - continue; - } - - if (slot != EnchantmentTarget.Slot.ANY) { - if (!enchant.getTargets().stream() - .map(EnchantmentTarget::getSlot).toList() - .contains(slot)) { - continue; - } - } - - found.add(enchant.getLevel(enchantEntry.getValue())); - } - } - - return found; - })); - } - - /** - * Clear cache. - * - * @param player The player. - */ - public static void clearCache(@NotNull final Player player) { - ITEM_CACHE.invalidate(player); - ENCHANT_LEVELS_CACHE.invalidate(player); - } - - static { - registerProvider(player -> Map.of( - player.getInventory().getItemInMainHand(), - EnchantmentTarget.Slot.HANDS - )); - registerProvider(player -> Map.of( - player.getInventory().getItemInOffHand(), - EnchantmentTarget.Slot.HANDS - )); - registerProvider(player -> { - Map items = new HashMap<>(); - for (ItemStack stack : player.getInventory().getArmorContents()) { - items.put(stack, EnchantmentTarget.Slot.ARMOR); - } - return items; - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AngerArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AngerArtifact.java deleted file mode 100644 index d60ed683..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AngerArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class AngerArtifact extends Artifact { - public AngerArtifact() { - super( - "anger_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.VILLAGER_ANGRY; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java deleted file mode 100644 index 40dfa27a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/AshArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class AshArtifact extends Artifact { - public AshArtifact() { - super( - "ash_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.WHITE_ASH; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CloudsArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CloudsArtifact.java deleted file mode 100644 index 1811d272..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CloudsArtifact.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Color; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class CloudsArtifact extends Artifact { - public CloudsArtifact() { - super( - "clouds_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.REDSTONE; - } - - @Override - public Particle.DustOptions getDustOptions() { - return new Particle.DustOptions(Color.AQUA, 1.0f); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CopperArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CopperArtifact.java deleted file mode 100644 index ca4e83c8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CopperArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class CopperArtifact extends Artifact { - public CopperArtifact() { - super( - "copper_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.WAX_ON; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java deleted file mode 100644 index 269a528a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/CrimsonArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class CrimsonArtifact extends Artifact { - public CrimsonArtifact() { - super( - "crimson_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.CRIMSON_SPORE; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DamageArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DamageArtifact.java deleted file mode 100644 index dbc80da2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DamageArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class DamageArtifact extends Artifact { - public DamageArtifact() { - super( - "damage_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.DAMAGE_INDICATOR; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DragonArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DragonArtifact.java deleted file mode 100644 index fa9e0cdd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DragonArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class DragonArtifact extends Artifact { - public DragonArtifact() { - super( - "dragon_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.DRAGON_BREATH; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DustArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DustArtifact.java deleted file mode 100644 index ab491a79..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/DustArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class DustArtifact extends Artifact { - public DustArtifact() { - super( - "dust_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.CRIT; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EmeraldArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EmeraldArtifact.java deleted file mode 100644 index 15299ee9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EmeraldArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class EmeraldArtifact extends Artifact { - public EmeraldArtifact() { - super( - "emerald_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.COMPOSTER; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EnchantmentArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EnchantmentArtifact.java deleted file mode 100644 index 57695a44..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EnchantmentArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class EnchantmentArtifact extends Artifact { - public EnchantmentArtifact() { - super( - "enchantment_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.ENCHANTMENT_TABLE; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EndArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EndArtifact.java deleted file mode 100644 index 7f279b4c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/EndArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class EndArtifact extends Artifact { - public EndArtifact() { - super( - "end_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.END_ROD; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/FireArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/FireArtifact.java deleted file mode 100644 index 13fb98c5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/FireArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class FireArtifact extends Artifact { - public FireArtifact() { - super( - "fire_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.FLAME; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/GlowArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/GlowArtifact.java deleted file mode 100644 index ac682227..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/GlowArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class GlowArtifact extends Artifact { - public GlowArtifact() { - super( - "glow_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.GLOW; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HeartArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HeartArtifact.java deleted file mode 100644 index 105575c9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HeartArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class HeartArtifact extends Artifact { - public HeartArtifact() { - super( - "heart_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.HEART; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HoneyArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HoneyArtifact.java deleted file mode 100644 index 227d2e3b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/HoneyArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class HoneyArtifact extends Artifact { - public HoneyArtifact() { - super( - "honey_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.FALLING_HONEY; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/InkArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/InkArtifact.java deleted file mode 100644 index 6fea17dc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/InkArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class InkArtifact extends Artifact { - public InkArtifact() { - super( - "ink_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SQUID_INK; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LavaArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LavaArtifact.java deleted file mode 100644 index 89bb94c6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LavaArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class LavaArtifact extends Artifact { - public LavaArtifact() { - super( - "lava_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.DRIP_LAVA; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LimeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LimeArtifact.java deleted file mode 100644 index 452f9819..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/LimeArtifact.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Color; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class LimeArtifact extends Artifact { - public LimeArtifact() { - super( - "lime_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.REDSTONE; - } - - @Override - public Particle.DustOptions getDustOptions() { - return new Particle.DustOptions(Color.fromRGB(3, 252, 140), 1.0f); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagicArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagicArtifact.java deleted file mode 100644 index 0de89a98..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagicArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class MagicArtifact extends Artifact { - public MagicArtifact() { - super( - "magic_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.CRIT_MAGIC; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagmaArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagmaArtifact.java deleted file mode 100644 index 520c1cba..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MagmaArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class MagmaArtifact extends Artifact { - public MagmaArtifact() { - super( - "magma_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.LAVA; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MusicArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MusicArtifact.java deleted file mode 100644 index 4e1984ca..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/MusicArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class MusicArtifact extends Artifact { - public MusicArtifact() { - super( - "music_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.NOTE; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NautilusArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NautilusArtifact.java deleted file mode 100644 index 3a8b2ce4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NautilusArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class NautilusArtifact extends Artifact { - public NautilusArtifact() { - super( - "nautilus_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.NAUTILUS; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NetherArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NetherArtifact.java deleted file mode 100644 index b7e6a836..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/NetherArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class NetherArtifact extends Artifact { - public NetherArtifact() { - super( - "nether_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.PORTAL; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RainArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RainArtifact.java deleted file mode 100644 index dec3d5fa..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RainArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class RainArtifact extends Artifact { - public RainArtifact() { - super( - "rain_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.WATER_SPLASH; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RedstoneArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RedstoneArtifact.java deleted file mode 100644 index 75f143b4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/RedstoneArtifact.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Color; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class RedstoneArtifact extends Artifact { - public RedstoneArtifact() { - super( - "redstone_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.REDSTONE; - } - - @Override - public Particle.DustOptions getDustOptions() { - return new Particle.DustOptions(Color.RED, 1.0f); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SlimeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SlimeArtifact.java deleted file mode 100644 index 8b96d718..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SlimeArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SlimeArtifact extends Artifact { - public SlimeArtifact() { - super( - "slime_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SLIME; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SmokeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SmokeArtifact.java deleted file mode 100644 index 1bb67824..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SmokeArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SmokeArtifact extends Artifact { - public SmokeArtifact() { - super( - "smoke_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.CAMPFIRE_COSY_SMOKE; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SnowArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SnowArtifact.java deleted file mode 100644 index 009f400f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SnowArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SnowArtifact extends Artifact { - public SnowArtifact() { - super( - "snow_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SNOWBALL; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java deleted file mode 100644 index df2f4bae..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SoulArtifact extends Artifact { - public SoulArtifact() { - super( - "soul_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SOUL; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java deleted file mode 100644 index 4604a6ec..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SoulFireArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SoulFireArtifact extends Artifact { - public SoulFireArtifact() { - super( - "soul_fire_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SOUL_FIRE_FLAME; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkArtifact.java deleted file mode 100644 index 824f08c5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SparkArtifact extends Artifact { - public SparkArtifact() { - super( - "spark_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.ELECTRIC_SPARK; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkleArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkleArtifact.java deleted file mode 100644 index 917f04da..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SparkleArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SparkleArtifact extends Artifact { - public SparkleArtifact() { - super( - "sparkle_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.FIREWORKS_SPARK; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SporeArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SporeArtifact.java deleted file mode 100644 index 529e2d2d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SporeArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SporeArtifact extends Artifact { - public SporeArtifact() { - super( - "spore_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.FALLING_SPORE_BLOSSOM; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SweepArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SweepArtifact.java deleted file mode 100644 index c3cbc353..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/SweepArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class SweepArtifact extends Artifact { - public SweepArtifact() { - super( - "sweep_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SWEEP_ATTACK; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java deleted file mode 100644 index 64ed9ac3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TearArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class TearArtifact extends Artifact { - public TearArtifact() { - super( - "tear_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.DRIPPING_OBSIDIAN_TEAR; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TotemArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TotemArtifact.java deleted file mode 100644 index f0a656b6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/TotemArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class TotemArtifact extends Artifact { - public TotemArtifact() { - super( - "totem_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.TOTEM; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/VillagerArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/VillagerArtifact.java deleted file mode 100644 index f6d76fd6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/VillagerArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class VillagerArtifact extends Artifact { - public VillagerArtifact() { - super( - "villager_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.VILLAGER_HAPPY; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java deleted file mode 100644 index 2a746ca5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WarpedArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class WarpedArtifact extends Artifact { - public WarpedArtifact() { - super( - "warped_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.WARPED_SPORE; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaterArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaterArtifact.java deleted file mode 100644 index 770e34a0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaterArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class WaterArtifact extends Artifact { - public WaterArtifact() { - super( - "water_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.DRIP_WATER; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaxArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaxArtifact.java deleted file mode 100644 index b7f59f83..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WaxArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class WaxArtifact extends Artifact { - public WaxArtifact() { - super( - "wax_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.WAX_OFF; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WitchArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WitchArtifact.java deleted file mode 100644 index 6095fae5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/WitchArtifact.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class WitchArtifact extends Artifact { - public WitchArtifact() { - super( - "witch_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.SPELL_WITCH; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/ZapArtifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/ZapArtifact.java deleted file mode 100644 index 81d8654e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/artifact/ZapArtifact.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.artifact; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import org.bukkit.Color; -import org.bukkit.Particle; -import org.jetbrains.annotations.NotNull; - -public class ZapArtifact extends Artifact { - public ZapArtifact() { - super( - "zap_artifact" - ); - } - - @Override - public @NotNull Particle getParticle() { - return Particle.REDSTONE; - } - - @Override - public Particle.DustOptions getDustOptions() { - return new Particle.DustOptions(Color.YELLOW, 1.0f); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java deleted file mode 100644 index ff191323..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/BreaklessnessCurse.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class BreaklessnessCurse extends EcoEnchant { - public BreaklessnessCurse() { - super( - "breaklessness_curse", EnchantmentType.CURSE - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageBlock(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockDamageEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java deleted file mode 100644 index 18c345f5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/CallingCurse.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.eco.util.NumberUtils; -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.PigZombie; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -public class CallingCurse extends EcoEnchant implements TimedRunnable { - private final Map players = new HashMap<>(); - private double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance"); - - public CallingCurse() { - super( - "calling_curse", EnchantmentType.CURSE - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(distance); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorChangeEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerJoin(@NotNull final PlayerJoinEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - refresh(); - } - - private void refresh() { - players.clear(); - this.getPlugin().getScheduler().runLater(() -> { - for (Player player : this.getPlugin().getServer().getOnlinePlayers()) { - int level = EnchantChecks.getArmorPoints(player, this, 0); - if (level > 0) { - if (this.areRequirementsMet(player)) { - players.put(player, level); - } - } - } - }, 1); - - distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance"); - } - - @Override - public void run() { - players.forEach((player, level) -> { - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, distance, distance)) { - if (!(e instanceof Monster)) { - continue; - } - - if (e instanceof PigZombie) { - ((PigZombie) e).setAngry(true); - } - - ((Monster) e).setTarget(player); - - Vector vector = player.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d); - - if (VectorUtils.isFinite(vector)) { - e.setVelocity(vector); - } - } - }); - } - - @Override - public long getTime() { - return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java deleted file mode 100644 index eb37542d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/DecayCurse.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDropItemEvent; -import org.bukkit.event.entity.EntityPickupItemEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.Repairable; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class DecayCurse extends EcoEnchant implements TimedRunnable { - private final Set players = new HashSet<>(); - private int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - public DecayCurse() { - super( - "decay_curse", EnchantmentType.CURSE - ); - } - - @EventHandler - public void onItemPickup(@NotNull final EntityPickupItemEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - refreshPlayer((Player) event.getEntity()); - } - - @EventHandler - public void onPlayerJoin(@NotNull final PlayerJoinEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - refresh(); - } - - @EventHandler - public void onInventoryDrop(@NotNull final EntityDropItemEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - refreshPlayer((Player) event.getEntity()); - } - - @EventHandler - public void onInventoryClick(@NotNull final InventoryClickEvent event) { - if (!(event.getWhoClicked() instanceof Player)) { - return; - } - refreshPlayer((Player) event.getWhoClicked()); - } - - private void refresh() { - players.clear(); - this.getPlugin().getScheduler().runLater(() -> this.getPlugin().getServer().getOnlinePlayers().forEach(player -> { - if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) { - if (this.areRequirementsMet(player)) { - players.add(player); - } - } - }), 1); - amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier"); - } - - private void refreshPlayer(@NotNull final Player player) { - players.remove(player); - if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) { - if (this.areRequirementsMet(player)) { - players.add(player); - } - } - } - - @Override - public void run() { - players.forEach((player -> { - for (ItemStack item : player.getInventory().getContents()) { - int level = EnchantChecks.getItemLevel(item, this); - if (level == 0) { - continue; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!(item.getItemMeta() instanceof Repairable)) { - continue; - } - - if (player.getInventory().getItemInMainHand().equals(item)) { - continue; - } - if (player.getInventory().getItemInOffHand().equals(item)) { - continue; - } - if (player.getItemOnCursor().equals(item)) { - continue; - } - - DurabilityUtils.damageItemNoBreak(item, amount, player); - } - })); - } - - @Override - public long getTime() { - return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java deleted file mode 100644 index 4fe68cf6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/FragilityCurse.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerItemDamageEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class FragilityCurse extends EcoEnchant { - public FragilityCurse() { - super( - "fragility_curse", EnchantmentType.CURSE - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(( - this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "minimum-extra-durability") - + this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "maximum-extra-durability") - ) / 2D); - } - - @EventHandler - public void onItemDamage(@NotNull final PlayerItemDamageEvent event) { - ItemStack item = event.getItem(); - - if (!EnchantChecks.item(item, this)) { - return; - } - - if (!this.areRequirementsMet(event.getPlayer())) { - return; - } - - if (this.getDisabledWorlds().contains(event.getPlayer().getWorld())) { - return; - } - - int min = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "minimum-extra-durability"); - int max = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "maximum-extra-durability"); - - event.setDamage(event.getDamage() * NumberUtils.randInt(min, max)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java deleted file mode 100644 index 9b261644..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HarmlessnessCurse.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class HarmlessnessCurse extends EcoEnchant { - public HarmlessnessCurse() { - super( - "harmlessness_curse", EnchantmentType.CURSE - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setDamage(0); - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java deleted file mode 100644 index a9081736..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/HungerCurse.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.jetbrains.annotations.NotNull; - -public class HungerCurse extends EcoEnchant { - public HungerCurse() { - super( - "hunger_curse", EnchantmentType.CURSE - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "times-more-hunger")); - } - - @EventHandler - public void onHunger(@NotNull final FoodLevelChangeEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!EnchantChecks.helmet(player, this)) { - return; - } - - if (event.getFoodLevel() > player.getFoodLevel()) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - int delta = player.getFoodLevel() - event.getFoodLevel(); - delta *= this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "times-more-hunger"); - - event.setFoodLevel(player.getFoodLevel() - delta); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/InaccuracyCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/InaccuracyCurse.java deleted file mode 100644 index 597d1d58..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/InaccuracyCurse.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class InaccuracyCurse extends EcoEnchant { - public InaccuracyCurse() { - super( - "inaccuracy_curse", EnchantmentType.CURSE - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - double spread = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread"); - - Vector velocity = event.getProjectile().getVelocity().clone(); - - velocity.add(new Vector(NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread))); - event.getProjectile().setVelocity(velocity); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java deleted file mode 100644 index dc3f3d2c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/MisfortuneCurse.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.jetbrains.annotations.NotNull; - -public class MisfortuneCurse extends EcoEnchant { - public MisfortuneCurse() { - super( - "misfortune_curse", EnchantmentType.CURSE - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setDropItems(false); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/PermanenceCurse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/PermanenceCurse.java deleted file mode 100644 index d3f354aa..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/curse/PermanenceCurse.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.curse; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; - -public class PermanenceCurse extends EcoEnchant { - public PermanenceCurse() { - super( - "permanence_curse", EnchantmentType.CURSE - ); - } - // Listeners are in anvil listeners -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.java deleted file mode 100644 index 64841ac2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abattoir.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Abattoir extends EcoEnchant { - public Abattoir() { - super( - "abattoir", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100 * (level + 1)); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim instanceof Monster) { - return; - } - - if (victim instanceof Player) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java deleted file mode 100644 index 40ce5526..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Abrasion.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; - -public class Abrasion extends EcoEnchant { - public Abrasion() { - super( - "abrasion", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Player victim)) { - return; - } - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - ArrayList armor = new ArrayList<>(Arrays.asList(victim.getInventory().getArmorContents())); - if (armor.isEmpty()) { - return; - } - - for (ItemStack armorPiece : armor) { - if (armorPiece == null) { - continue; - } - - DurabilityUtils.damageItem(victim, armorPiece, level); - - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java deleted file mode 100644 index ee16b5bc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aerial.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.jetbrains.annotations.NotNull; - -public class Aerial extends EcoEnchant { - public Aerial() { - super( - "aerial", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - if (!(event.getProjectile() instanceof Arrow)) { - return; - } - - if (shooter.isOnGround()) { - return; - } - - event.getProjectile().setMetadata("shot-in-air", this.getPlugin().getMetadataValueFactory().create(true)); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!arrow.hasMetadata("shot-in-air")) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.java deleted file mode 100644 index 11cd0f7e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Aquatic.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Aquatic extends EcoEnchant { - public Aquatic() { - super( - "aquatic", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getLocation().getBlock().getType().equals(Material.WATER)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double reduction = 1 + (multiplier * level); - event.setDamage(damage * reduction); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.java deleted file mode 100644 index 213e0d62..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arachnid.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Spider; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Arachnid extends EcoEnchant { - public Arachnid() { - super( - "arachnid", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100 * (level + 1)); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Spider)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java deleted file mode 100644 index 54f21476..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arborist.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Tag; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class Arborist extends EcoEnchant { - public Arborist() { - super( - "arborist", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (!Tag.LEAVES.isTagged(block.getType())) { - return; - } - - event.setDropItems(false); - - Material toDrop; - - List materials = new ArrayList<>(); - - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) { - Material material = Material.getMaterial(materialName.toUpperCase()); - if (material != null) { - materials.add(material); - } - } - - toDrop = materials.get(new Random().nextInt(materials.size())); - - if (toDrop == null) { - toDrop = block.getType(); - } - - ItemStack item = new ItemStack(toDrop, 1); - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItem(item) - .push(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.java deleted file mode 100644 index bdffb91a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Arcanic.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Arcanic extends EcoEnchant { - public Arcanic() { - super( - "arcanic", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!(event.getCause().equals(EntityDamageEvent.DamageCause.POISON) || event.getCause().equals(EntityDamageEvent.DamageCause.WITHER))) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.java deleted file mode 100644 index 6a21f2b8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Atmospheric.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.jetbrains.annotations.NotNull; - -public class Atmospheric extends EcoEnchant { - public Atmospheric() { - super( - "atmospheric", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100); - } - - @Override - public void onTridentLaunch(@NotNull final LivingEntity shooter, - @NotNull final Trident trident, - final int level, - @NotNull final ProjectileLaunchEvent event) { - if (shooter.isOnGround()) { - return; - } - - trident.setMetadata("shot-in-air", this.getPlugin().getMetadataValueFactory().create(true)); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!trident.hasMetadata("shot-in-air")) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.java deleted file mode 100644 index 372e958a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Backstab.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Backstab extends EcoEnchant { - public Backstab() { - super( - "backstab", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level * 100); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - Vector pDir = attacker.getLocation().getDirection(); - Vector eDir = victim.getLocation().getDirection(); - double xv = pDir.getX() * eDir.getZ() - pDir.getZ() * eDir.getX(); - double zv = pDir.getX() * eDir.getX() + pDir.getZ() * eDir.getZ(); - double angle = Math.atan2(xv, zv); // Value between -π and +π - double angleInDegrees = (angle * 180) / Math.PI; - - if (angleInDegrees > 60 || angleInDegrees < -32) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java deleted file mode 100644 index e766aa9e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Beheading.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.core.items.builder.SkullBuilder; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; -import org.jetbrains.annotations.NotNull; - -public class Beheading extends EcoEnchant { - public Beheading() { - super( - "beheading", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onDeath(@NotNull final EntityDeathEvent event) { - if (event.getEntity().getKiller() == null) { - return; - } - - Player player = event.getEntity().getKiller(); - - if (!this.areRequirementsMet(player)) { - return; - } - - LivingEntity victim = event.getEntity(); - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - ItemStack item; - - if (victim instanceof Player) { - item = new ItemStack(Material.PLAYER_HEAD, 1); - SkullMeta meta = (SkullMeta) item.getItemMeta(); - assert meta != null; - meta.setOwningPlayer((Player) victim); - item.setItemMeta(meta); - } else { - item = getHead(event.getEntityType()); - if (item == null) { - if (event.getEntityType().equals(EntityType.ZOMBIE)) { - item = new ItemStack(Material.ZOMBIE_HEAD, 1); - } else if (event.getEntityType().equals(EntityType.SKELETON)) { - item = new ItemStack(Material.SKELETON_SKULL, 1); - } else if (event.getEntityType().equals(EntityType.CREEPER)) { - item = new ItemStack(Material.CREEPER_HEAD, 1); - } else if (event.getEntityType().equals(EntityType.ENDER_DRAGON)) { - item = new ItemStack(Material.DRAGON_HEAD, 1); - } else { - return; - } - } - } - - new DropQueue(player) - .addItem(item) - .addXP(event.getDroppedExp()) - .setLocation(victim.getLocation()) - .push(); - - event.setDroppedExp(0); - } - - private ItemStack getHead(@NotNull final EntityType type) { - for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "custom-heads")) { - String[] split = s.split("::"); - if (type.name().equalsIgnoreCase(split[0])) { - SkullBuilder builder = new SkullBuilder().setSkullTexture(split[1]); - - if (split.length >= 3) { - builder.setDisplayName(split[2]); - } - - return builder.build(); - } - } - return null; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java deleted file mode 100644 index fdbc0268..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlastMining.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.Particle; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -public class BlastMining extends EcoEnchant { - public BlastMining() { - super( - "blast_mining", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (block.hasMetadata("block-ignore")) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) { - return; - } - - Set toBreak = new HashSet<>(); - - for (int x = -1; x <= 1; x++) { - for (int y = -1; y <= 1; y++) { - for (int z = -1; z <= 1; z++) { - if (x == 0 && y == 0 && z == 0) { - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "enable-sound")) { - block.getWorld().createExplosion(block.getLocation().clone().add(0.5, 0.5, 0.5), 0, false); - } else { - block.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, block.getLocation().clone().add(0.5, 0.5, 0.5), 1); - } - continue; - } - Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z)); - - if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { - continue; - } - - if (block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) { - continue; - } - - if (block1.getType() == Material.AIR) { - continue; - } - - if (!AntigriefManager.canBreakBlock(player, block1)) { - continue; - } - - toBreak.add(block1); - } - } - } - - AnticheatManager.exemptPlayer(player); - EnchantmentUtils.rehandleBreaking(player, toBreak, this.getPlugin()); - AnticheatManager.unexemptPlayer(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java deleted file mode 100644 index 400b47c8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Bleed.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.atomic.AtomicInteger; - -public class Bleed extends EcoEnchant { - public Bleed() { - super( - "bleed", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double bleedDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bleed-damage"); - - int bleedCount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); - bleedCount *= level; - final int finalBleedCount = bleedCount; - - AtomicInteger currentBleedCount = new AtomicInteger(0); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - currentBleedCount.addAndGet(1); - - victim.damage(bleedDamage); - - if (currentBleedCount.get() >= finalBleedCount) { - bukkitRunnable.cancel(); - } - }).runTaskTimer(0, 10); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.java deleted file mode 100644 index 3836c2bb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Blind.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Blind extends EcoEnchant { - public Blind() { - super( - "blind", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level"); - - victim.setVelocity(new Vector(0, 0, 0)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, duration * level, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.java deleted file mode 100644 index 8a8473a3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BlockBreather.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class BlockBreather extends EcoEnchant { - public BlockBreather() { - super( - "block_breather", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!event.getCause().equals(EntityDamageEvent.DamageCause.SUFFOCATION)) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BossHunter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BossHunter.java deleted file mode 100644 index a22f6e86..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/BossHunter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.NamespacedKey; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Boss; -import org.bukkit.entity.ElderGuardian; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.persistence.PersistentDataType; -import org.jetbrains.annotations.NotNull; - -@SuppressWarnings("deprecation") -public class BossHunter extends EcoEnchant { - public BossHunter() { - super( - "boss_hunter", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Boss || victim instanceof ElderGuardian) && !victim.getPersistentDataContainer().has(new NamespacedKey("ecobosses", "boss"), PersistentDataType.STRING)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java deleted file mode 100644 index 4b4e67b3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Buckshot.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Sound; -import org.bukkit.SoundCategory; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Buckshot extends EcoEnchant { - public Buckshot() { - super( - "buckshot", EnchantmentType.NORMAL - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - this.getPlugin().getScheduler().runLater(1, () -> event.getProjectile().remove()); - if (shooter instanceof Player player) { - player.playSound(shooter.getLocation(), Sound.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0f, 1.0f); - } - - int number = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); - number *= level; - - double spread = Math.abs(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "spread-per-level")); - spread *= level; - - if (shooter instanceof Player player) { - AnticheatManager.exemptPlayer(player); - } - - for (int i = 0; i < number; i++) { - Vector velocity = event.getProjectile().getVelocity().clone(); - - velocity.add(new Vector(NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread), NumberUtils.randFloat(-spread, spread))); - - Arrow arrow1 = shooter.launchProjectile(Arrow.class, velocity); - if (EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE)) { - arrow1.setFireTicks(Integer.MAX_VALUE); - } - if (EnchantChecks.mainhand(shooter, EcoEnchants.MARKSMAN)) { - arrow1.setGravity(false); - } - arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); - } - - if (shooter instanceof Player player) { - AnticheatManager.unexemptPlayer(player); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Butchering.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Butchering.java deleted file mode 100644 index b24a2081..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Butchering.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Butchering extends EcoEnchant { - public Butchering() { - super( - "butchering", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim instanceof Monster) { - return; - } - - if (victim instanceof Player) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - event.setDamage(event.getDamage() + (level * multiplier)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cerebral.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cerebral.java deleted file mode 100644 index 0fe58864..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cerebral.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Cerebral extends EcoEnchant { - public Cerebral() { - super( - "cerebral", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (arrow.getLocation().getY() < victim.getLocation().getY() + victim.getEyeHeight() - 0.22) { - return; - } - - if (!EnchantChecks.arrow(arrow, this)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Chopless.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Chopless.java deleted file mode 100644 index 2d0f84a6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Chopless.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Chopless extends EcoEnchant { - public Chopless() { - super( - "chopless", EnchantmentType.NORMAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (victim.getEquipment() == null) { - return; - } - - if (!victim.getEquipment().getItemInMainHand().getType().toString().endsWith("_AXE")) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level"); - - double multiplier = 1 - ((reduction / 100) * level); - - event.setDamage(event.getDamage() * multiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java deleted file mode 100644 index 74119832..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cleave.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Cleave extends EcoEnchant { - public Cleave() { - super( - "cleave", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim.hasMetadata("cleaved")) { - return; - } - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-percentage-per-level") * 0.01; - double radiusPerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level"); - final double damage = damagePerLevel * level * event.getDamage(); - final double radius = radiusPerLevel * level; - - victim.getNearbyEntities(radius, radius, radius).stream() - .filter(entity -> entity instanceof LivingEntity) - .filter(entity -> !entity.equals(attacker)) - .forEach(entity -> { - entity.setMetadata("cleaved", this.getPlugin().getMetadataValueFactory().create(true)); - this.getPlugin().getScheduler().run(() -> ((LivingEntity) entity).damage(damage, attacker)); - this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata("cleaved", this.getPlugin()), 5); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Collateral.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Collateral.java deleted file mode 100644 index 4b456406..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Collateral.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.jetbrains.annotations.NotNull; - -public class Collateral extends EcoEnchant { - public Collateral() { - super( - "collateral", EnchantmentType.NORMAL - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - arrow.setPierceLevel(level); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.java deleted file mode 100644 index 5e611a02..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Conclude.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Conclude extends EcoEnchant { - public Conclude() { - super( - "conclude", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level"); - if (victim.getHealth() > level * minhealth) { - return; - } - - event.setDamage(30); // cba to do this properly - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java deleted file mode 100644 index 0f6a2360..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Corrosive.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; - -public class Corrosive extends EcoEnchant { - public Corrosive() { - super( - "corrosive", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Player victim)) { - return; - } - - if (attacker instanceof Player player) { - if (!AntigriefManager.canInjure(player, uncastVictim)) { - return; - } - } - - ArrayList armor = new ArrayList<>(Arrays.asList(victim.getInventory().getArmorContents())); - if (armor.isEmpty()) { - return; - } - - for (ItemStack armorPiece : armor) { - if (armorPiece == null) { - continue; - } - - DurabilityUtils.damageItem(victim, armorPiece, level); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cranial.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cranial.java deleted file mode 100644 index f6f43ee9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cranial.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Cranial extends EcoEnchant { - public Cranial() { - super( - "cranial", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (trident.getLocation().getY() < victim.getLocation().getY() + victim.getEyeHeight() - 0.22) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.java deleted file mode 100644 index 6c42ebe0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Criticals.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Criticals extends EcoEnchant { - public Criticals() { - super( - "criticals", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return NumberUtils.format(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * 100 * level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(attacker.getFallDistance() > 0 && !attacker.isOnGround())) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "use-additive")) { - damage = damage / 1.5; - double bonus = damage * (multiplier * level); - damage = damage + bonus + damage / 2; - event.setDamage(damage); - } else { - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cubism.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cubism.java deleted file mode 100644 index 7b1c8bdf..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Cubism.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Slime; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Cubism extends EcoEnchant { - public Cubism() { - super( - "cubism", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Slime)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.java deleted file mode 100644 index b6adfe03..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defender.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Tameable; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Defender extends EcoEnchant { - public Defender() { - super( - "defender", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Tameable pet)) { - return; - } - - if (pet.getOwner() == null) { - return; - } - if (!pet.getOwner().equals(attacker)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java deleted file mode 100644 index 912e7fe8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Deflection.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Deflection extends EcoEnchant { - public Deflection() { - super( - "deflection", EnchantmentType.NORMAL - ); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (blocker.hasMetadata("cleaved") || blocker.hasMetadata("carved")) { - return; - } - - if (attacker.hasMetadata("cleaved") || attacker.hasMetadata("carved")) { - return; - } - if (attacker.equals(blocker)){ - return; - } - double perlevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-deflected-per-level"); - double damagePercent = (perlevel / 100) * level; - double damage = event.getDamage() * damagePercent; - - attacker.damage(damage, attacker); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defusion.java deleted file mode 100644 index 5b0344cd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Defusion.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Creeper; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Defusion extends EcoEnchant { - public Defusion() { - super( - "defusion", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Creeper)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - event.setDamage(event.getDamage() + (level * multiplier)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.java deleted file mode 100644 index 1cb1e7f3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dexterous.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Dexterous extends EcoEnchant { - public Dexterous() { - super( - "dexterous", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onDextHold(@NotNull final PlayerItemHeldEvent event) { - Player player = event.getPlayer(); - ItemStack item = player.getInventory().getItem(event.getNewSlot()); - - if (!EnchantChecks.item(item, this)) { - player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0); - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - int level = EnchantChecks.getItemLevel(item, this); - double bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "add-speed-per-level"); - player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0 + (level * bonus)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.java deleted file mode 100644 index 9688d06a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disable.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Disable extends EcoEnchant { - public Disable() { - super( - "disable", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, level * 10, 5)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java deleted file mode 100644 index b7538ee6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Disappear.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Disappear extends EcoEnchant { - public Disappear() { - super( - "disappear", EnchantmentType.NORMAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - this.getPlugin().getScheduler().runLater(() -> { - if (victim.getHealth() > EcoEnchants.DISAPPEAR.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "threshold")) { - return; - } - - int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - final int ticks = ticksPerLevel * level; - victim.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, ticks, 1, false, false, true)); - }, 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java deleted file mode 100644 index 656e20bb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diurnal.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Diurnal extends EcoEnchant { - public Diurnal() { - super( - "diurnal", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { - return; - } - - long time = attacker.getWorld().getTime(); - - if (time > 12300 && time < 23850) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diverse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diverse.java deleted file mode 100644 index 02fcd986..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Diverse.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Diverse extends EcoEnchant { - public Diverse() { - super( - "diverse", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim.getEquipment() == null) { - return; - } - - if (!victim.getEquipment().getItemInMainHand().getType().toString().endsWith("_SWORD")) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dousing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dousing.java deleted file mode 100644 index 7b5079a4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dousing.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.jetbrains.annotations.NotNull; - -public class Dousing extends EcoEnchant { - public Dousing() { - super( - "dousing", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowHit(@NotNull final LivingEntity uncastShooter, - final int level, - @NotNull final ProjectileHitEvent event) { - if (!(uncastShooter instanceof Player shooter)) { - return; - } - - if (event.getHitBlock() == null) { - return; - } - - if (!AntigriefManager.canBreakBlock(shooter, event.getHitBlock())) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - BlockFace face = event.getHitBlockFace(); - - assert face != null; - - Block toIgnite = event.getHitBlock().getRelative(face); - if (toIgnite.getType().equals(Material.FIRE)) { - toIgnite.setType(Material.AIR); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java deleted file mode 100644 index 43a20441..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Drill.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Drill extends EcoEnchant { - public Drill() { - super( - "drill", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (block.hasMetadata("block-ignore")) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) { - return; - } - - int blocks = level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level"); - - AnticheatManager.exemptPlayer(player); - - for (int i = 1; i <= blocks; i++) { - Vector simplified = VectorUtils.simplifyVector(player.getLocation().getDirection().normalize()).multiply(i); - Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(simplified)); - block1.setMetadata("block-ignore", this.getPlugin().getMetadataValueFactory().create(true)); - - if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { - continue; - } - - if (block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) { - continue; - } - - if (!AntigriefManager.canBreakBlock(player, block1)) { - continue; - } - - player.breakBlock(block1); - block1.removeMetadata("block-ignore", this.getPlugin()); - } - - AnticheatManager.unexemptPlayer(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java deleted file mode 100644 index 5a3ef65a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dullness.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Dullness extends EcoEnchant { - public Dullness() { - super( - "dullness", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int durationPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level"); - - victim.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, level * durationPerLevel, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dweller.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dweller.java deleted file mode 100644 index 94e01f1f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Dweller.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Illager; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Dweller extends EcoEnchant { - public Dweller() { - super( - "dweller", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Illager)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java deleted file mode 100644 index 8684ffcd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Economical.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.destroystokyo.paper.event.player.PlayerElytraBoostEvent; -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.event.EventHandler; -import org.jetbrains.annotations.NotNull; - -public class Economical extends EcoEnchant { - public Economical() { - super( - "economical", EnchantmentType.NORMAL, - Prerequisite.HAS_PAPER - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onElytraBoost(@NotNull final PlayerElytraBoostEvent event) { - if (!EnchantChecks.chestplate(event.getPlayer(), this)) { - return; - } - if (!EnchantmentUtils.passedChance(this, EnchantChecks.getArmorPoints(event.getPlayer(), this))) { - return; - } - if (this.getDisabledWorlds().contains(event.getPlayer().getWorld())) { - return; - } - if (!this.areRequirementsMet(event.getPlayer())) { - return; - } - event.setShouldConsume(false); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java deleted file mode 100644 index fde33d2b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Electroshock.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.LightningUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Electroshock extends EcoEnchant { - public Electroshock() { - super( - "electroshock", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage"); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound"); - LightningUtils.strike(attacker, damage, silent); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EndInfusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EndInfusion.java deleted file mode 100644 index 8ab7bc46..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EndInfusion.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class EndInfusion extends EcoEnchant { - public EndInfusion() { - super( - "end_infusion", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EnderSlayer.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EnderSlayer.java deleted file mode 100644 index b414eff4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/EnderSlayer.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.google.common.collect.ImmutableSet; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; - -public class EnderSlayer extends EcoEnchant { - private static final Set END_MOBS = new ImmutableSet.Builder() - .add(EntityType.ENDERMITE) - .add(EntityType.ENDERMAN) - .add(EntityType.ENDER_DRAGON) - .add(EntityType.SHULKER) - .build(); - - public EnderSlayer() { - super( - "ender_slayer", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!END_MOBS.contains(victim.getType())) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - - event.setDamage(event.getDamage() + (level * multiplier)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Enderism.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Enderism.java deleted file mode 100644 index 757f93ca..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Enderism.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.World; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Enderism extends EcoEnchant { - public Enderism() { - super( - "enderism", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } - - @EventHandler - public void onHit(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof Arrow arrow)) { - return; - } - if (!(((Arrow) event.getDamager()).getShooter() instanceof Player player)) { - return; - } - - if (!player.getWorld().getEnvironment().equals(World.Environment.THE_END)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.arrow(arrow, this)) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getArrowLevel(arrow, this); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.java deleted file mode 100644 index 7fd8c83c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Evasion.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Evasion extends EcoEnchant { - public Evasion() { - super( - "evasion", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.java deleted file mode 100644 index 39dda6a2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extinguishing.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Extinguishing extends EcoEnchant { - public Extinguishing() { - super( - "extinguishing", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!event.getCause().equals(EntityDamageEvent.DamageCause.FIRE_TICK)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.setFireTicks(0); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java deleted file mode 100644 index 4cdb6dcc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Extract.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Extract extends EcoEnchant { - public Extract() { - super( - "extract", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level"); - double amountToHeal = level * multiplier; - double newHealth = attacker.getHealth() + amountToHeal; - if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - attacker.setHealth(newHealth); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java deleted file mode 100644 index a2ed445b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Famine.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Famine extends EcoEnchant { - public Famine() { - super( - "famine", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"), level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java deleted file mode 100644 index cfa975ff..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Farmhand.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Farmhand extends EcoEnchant { - public Farmhand() { - super( - "farmhand", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onTill(@NotNull final PlayerInteractEvent event) { - Player player = event.getPlayer(); - - if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { - return; - } - - if (event.getClickedBlock() == null) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!(event.getClickedBlock().getType().equals(Material.DIRT) || event.getClickedBlock().getType().equals(Material.GRASS_BLOCK))) { - return; - } - - ItemStack item = event.getItem(); - - if (!EnchantChecks.item(item, this)) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!item.getType().toString().endsWith("_HOE")) { - return; - } - - if (!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) { - return; - } - - event.getClickedBlock().setType(Material.FARMLAND); - int initial = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-radius"); - int levelrad = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-radius"); - int radius = initial + (EnchantChecks.getItemLevel(item, this) - 1) * levelrad; - Vector[] vecs; - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "use-cube")) { - vecs = VectorUtils.getCube(radius); - } else { - vecs = VectorUtils.getSquare(radius); - } - - if (!this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-block-damage")) { - DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1); - } - - for (Vector vec : vecs) { - Location loc = event.getClickedBlock().getLocation().add(vec); - Block block = event.getClickedBlock().getWorld().getBlockAt(loc); - - if (!AntigriefManager.canBreakBlock(player, block)) { - continue; - } - - if (!(block.getType().equals(Material.DIRT) || block.getType().equals(Material.GRASS_BLOCK))) { - continue; - } - - if (!block.getWorld().getBlockAt(loc.add(0, 1, 0)).getType().equals(Material.AIR)) { - continue; - } - - block.setType(Material.FARMLAND); - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-block-damage")) { - - DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1); - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fetching.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fetching.java deleted file mode 100644 index e5d29393..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fetching.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.core.events.EntityDeathByEntityEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wolf; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; - -public class Fetching extends EcoEnchant { - public Fetching() { - super( - "fetching", EnchantmentType.NORMAL - ); - } - - @EventHandler(priority = EventPriority.HIGH) - public void onWolfKill(@NotNull final EntityDeathByEntityEvent event) { - LivingEntity entity = event.getVictim(); - - if (entity instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-on-players")) { - return; - } - - if (!(event.getKiller() instanceof Wolf wolf)) { - return; - } - - if (!wolf.isTamed() || wolf.getOwner() == null) { - return; - } - - if (!(wolf.getOwner() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!(EnchantChecks.helmet(player, this))) { - return; - } - - int xp = event.getXp(); - Collection drops = event.getDrops(); - - new DropQueue(player) - .addItems(drops) - .setLocation(entity.getLocation()) - .addXP(xp) - .forceTelekinesis() - .push(); - - event.getDeathEvent().setDroppedExp(0); - event.getDeathEvent().getDrops().clear(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.java deleted file mode 100644 index 993d0bef..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finality.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Finality extends EcoEnchant { - public Finality() { - super( - "finality", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level"); - if (victim.getHealth() > level * minhealth) { - return; - } - - event.setDamage(30); // cba to do this properly - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.java deleted file mode 100644 index 07680e10..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Finishing.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Finishing extends EcoEnchant { - public Finishing() { - super( - "finishing", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level"); - if (victim.getHealth() > level * minhealth) { - return; - } - - event.setDamage(30); // cba to do this properly - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FireAffinity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FireAffinity.java deleted file mode 100644 index c391a209..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FireAffinity.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class FireAffinity extends EcoEnchant { - public FireAffinity() { - super( - "fire_affinity", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (attacker.getFireTicks() == 0) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FirstStrike.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FirstStrike.java deleted file mode 100644 index 8f2d1671..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/FirstStrike.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class FirstStrike extends EcoEnchant { - public FirstStrike() { - super( - "first_strike", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim.getHealth() != victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java deleted file mode 100644 index 072035b1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Flinch.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Flinch extends EcoEnchant { - public Flinch() { - super( - "flinch", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int finalDuration = duration * level; - - attacker.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, finalDuration, 1, false, false, false)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java deleted file mode 100644 index 1875220e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Forcefield.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import org.bukkit.entity.Endermite; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -public class Forcefield extends EcoEnchant implements TimedRunnable { - private final Map players = new HashMap<>(); - private double initialDistance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance"); - private double bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - private double damagePerPoint = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - - public Forcefield() { - super( - "forcefield", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorChangeEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerJoin(@NotNull final PlayerJoinEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - refresh(); - } - - private void refresh() { - players.clear(); - this.getPlugin().getScheduler().runLater(() -> { - for (Player player : this.getPlugin().getServer().getOnlinePlayers()) { - int level = EnchantChecks.getArmorPoints(player, this, 0); - if (level > 0) { - if (this.areRequirementsMet(player)) { - players.put(player, level); - } - } - } - }, 1); - initialDistance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance"); - bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - damagePerPoint = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - } - - @Override - public void run() { - new HashMap<>(players).forEach((player, level) -> { - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - double distance = initialDistance + (level * bonus); - final double damage = damagePerPoint * level; - - for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, 2.0d, distance)) { - if (!(e instanceof Monster)) { - continue; - } - - if (e instanceof Endermite) { - continue; - } - - if (e.getCustomName() != null || e.isCustomNameVisible()) { - continue; - } - - ((Monster) e).damage(damage); - - double damageChance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-chance"); - - if (NumberUtils.randFloat(0, 1) < damageChance) { - EnchantChecks.getArmorPoints(player, this, 1); - } - } - }); - } - - @Override - public long getTime() { - return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.java deleted file mode 100644 index a2d576c3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Freerunner.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Freerunner extends EcoEnchant { - public Freerunner() { - super( - "freerunner", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onFallDamage(@NotNull final LivingEntity faller, - final int level, - @NotNull final EntityDamageEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java deleted file mode 100644 index 09703ca3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Frozen.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Frozen extends EcoEnchant { - public Frozen() { - super( - "frozen", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onHurt(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity victim)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - final int points = EnchantChecks.getArmorPoints(player, this, 0); - - if (points == 0) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!EnchantmentUtils.passedChance(this, points)) { - return; - } - - int divisor = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "points-per-level"); - final int level = (int) Math.ceil((double) points / divisor); - - this.getPlugin().getScheduler().runLater(() -> { - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, points * 5, level)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, points * 5, level)); - }, 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java deleted file mode 100644 index 96410c97..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Fury.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.PigZombie; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Fury extends EcoEnchant { - public Fury() { - super( - "fury", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double distancePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level"); - final double distance = distancePerLevel * level; - - for (Entity e : victim.getWorld().getNearbyEntities(victim.getLocation(), distance, distance, distance)) { - if (!(e instanceof Monster)) { - continue; - } - - if (e instanceof PigZombie) { - ((PigZombie) e).setAngry(true); - } - - ((Monster) e).setTarget(victim); - - Vector vector = attacker.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d); - - if (VectorUtils.isFinite(vector)) { - e.setVelocity(vector); - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java deleted file mode 100644 index e7779f6f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Goliath extends EcoEnchant { - public Goliath() { - super( - "goliath", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim.getHealth() <= attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - return; - } - - double timesMoreHealth = victim.getHealth() / attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level * timesMoreHealth); - if (bonus - 1 > this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap")) { - bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap") + 1; - } - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.java deleted file mode 100644 index e0d383a5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Graceful.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -@SuppressWarnings("deprecation") -public class Graceful extends EcoEnchant { - public Graceful() { - super( - "graceful", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onFall(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (player.isOnGround()) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (player.getVelocity().getY() > -1) { - return; - } - - if (player.getLocation().clone().add(0, -3, 0).getBlock().getType().equals(Material.AIR)) { - return; - } - - if (!EnchantChecks.boots(player, this)) { - return; - } - - int level = EnchantChecks.getBootsLevel(player, this); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 5, false, false, true)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java deleted file mode 100644 index 8e0da516..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grapple.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Grapple extends EcoEnchant { - public Grapple() { - super( - "grapple", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier"); - Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier); - - if (VectorUtils.isFinite(vector)) { - victim.setVelocity(vector); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java deleted file mode 100644 index 81ac81e2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/GreenThumb.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.jetbrains.annotations.NotNull; - -public class GreenThumb extends EcoEnchant { - public GreenThumb() { - super( - "green_thumb", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onInteract(@NotNull final PlayerInteractEvent event) { - Player player = event.getPlayer(); - - if (!event.getAction().equals(Action.LEFT_CLICK_BLOCK)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (event.getClickedBlock() == null) { - return; - } - - if (!event.getClickedBlock().getType().equals(Material.DIRT)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!AntigriefManager.canBreakBlock(player, event.getClickedBlock())) { - return; - } - - if (!AntigriefManager.canPlaceBlock(player, event.getClickedBlock())) { - return; - } - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage")) { - DurabilityUtils.damageItem(player, player.getInventory().getItemInMainHand(), 1); - } - - event.getClickedBlock().setType(Material.GRASS_BLOCK); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java deleted file mode 100644 index 2fdd2394..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Grit.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.meta.Damageable; -import org.jetbrains.annotations.NotNull; - -public class Grit extends EcoEnchant { - public Grit() { - super( - "grit", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onGritHurt(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!(event.getDamager() instanceof Player attacker)) { - return; - } - - if (!this.areRequirementsMet(attacker)) { - return; - } - - if (!AntigriefManager.canInjure(attacker, player)) { - return; - } - - int totalGritPoints = EnchantChecks.getArmorPoints(player, this, 0); - - if (totalGritPoints == 0) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!(attacker.getInventory().getItemInMainHand() instanceof Damageable)) { - return; - } - - int damage = (int) Math.ceil(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * totalGritPoints); - - DurabilityUtils.damageItem(attacker, attacker.getInventory().getItemInMainHand(), damage); - } - -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hellish.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hellish.java deleted file mode 100644 index b02b339b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hellish.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Hellish extends EcoEnchant { - public Hellish() { - super( - "hellish", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java deleted file mode 100644 index f6209400..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Hook.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Hook extends EcoEnchant { - public Hook() { - super( - "hook", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier"); - Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier); - if (VectorUtils.isFinite(vector)) { - victim.setVelocity(vector); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Horde.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Horde.java deleted file mode 100644 index 9164aefe..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Horde.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Horde extends EcoEnchant { - public Horde() { - super( - "horde", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level") * level; - - int entitiesNearby = (int) attacker.getNearbyEntities(distance, distance, distance).stream().filter(entity -> entity instanceof LivingEntity).count(); - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-per-level"); - multiplier = (1 + (level * multiplier * entitiesNearby)); - - event.setDamage(event.getDamage() * multiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java deleted file mode 100644 index aa808d93..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IceShot.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class IceShot extends EcoEnchant { - public IceShot() { - super( - "ice_shot", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.setVelocity(new Vector(0, 0, 0)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.java deleted file mode 100644 index 51a06410..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Identify.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Identify extends EcoEnchant { - public Identify() { - super( - "identify", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int finalDuration = duration * level; - - attacker.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, finalDuration, 1, false, false, false)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java deleted file mode 100644 index 67acefb3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Ignite.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.jetbrains.annotations.NotNull; - -public class Ignite extends EcoEnchant { - public Ignite() { - super( - "ignite", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowHit(@NotNull final LivingEntity uncastShooter, - final int level, - @NotNull final ProjectileHitEvent event) { - if (!(uncastShooter instanceof Player shooter)) { - return; - } - - if (event.getHitBlock() == null) { - return; - } - - if (!AntigriefManager.canBreakBlock(shooter, event.getHitBlock())) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - BlockFace face = event.getHitBlockFace(); - - assert face != null; - - Block toIgnite = event.getHitBlock().getRelative(face); - if (toIgnite.getType().equals(Material.AIR)) { - toIgnite.setType(Material.FIRE); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java deleted file mode 100644 index c6dcd743..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/IllusionAspect.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class IllusionAspect extends EcoEnchant { - public IllusionAspect() { - super( - "illusion_aspect", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, level * 10 + 15, level)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, level * 10 + 15, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.java deleted file mode 100644 index 902b73b2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Impact.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Impact extends EcoEnchant { - public Impact() { - super( - "impact", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java deleted file mode 100644 index 286dad61..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Incandescence.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Incandescence extends EcoEnchant { - public Incandescence() { - super( - "incandescence", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onIncandescenceHurt(@NotNull final EntityDamageByEntityEvent event) { - if (event.getCause() == EntityDamageEvent.DamageCause.THORNS) { - return; - } - - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity victim)) { - return; - } - - int totalIncandescencePoints = EnchantChecks.getArmorPoints(player, this); - - if (totalIncandescencePoints == 0) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!AntigriefManager.canInjure(player, victim)) { - return; - } - - this.getPlugin().getScheduler().runLater(() -> victim.setFireTicks(totalIncandescencePoints - * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-point") - + this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-ticks")), - 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java deleted file mode 100644 index 27ababe7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/InfernalTouch.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.core.tuples.Pair; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.Container; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.BlockDropItemEvent; -import org.bukkit.inventory.FurnaceRecipe; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.Recipe; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class InfernalTouch extends EcoEnchant { - private static final Map> RECIPES = new HashMap<>(); - private static final Set FORTUNE_MATERIALS = new HashSet<>( - Arrays.asList( - Material.GOLD_INGOT, - Material.IRON_INGOT - ) - ); - - static { - Iterator iterator = Bukkit.recipeIterator(); - while (iterator.hasNext()) { - Recipe recipe = iterator.next(); - if (!(recipe instanceof FurnaceRecipe furnaceRecipe)) { - continue; - } - int xp = (int) Math.ceil(furnaceRecipe.getExperience()); - RECIPES.put(furnaceRecipe.getInput().getType(), new Pair<>(furnaceRecipe.getResult().getType(), xp)); - } - - FORTUNE_MATERIALS.add(Material.COPPER_INGOT); - } - - public InfernalTouch() { - super( - "infernal_touch", EnchantmentType.NORMAL - ); - } - - @NotNull - private static Pair getOutput(@NotNull final Material input) { - Pair toReturn = RECIPES.get(input); - if (toReturn == null) { - return new Pair<>(input, 0); - } - return toReturn; - } - - @EventHandler - public void infernalTouchBreak(@NotNull final BlockDropItemEvent event) { - - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (event.getBlockState() instanceof Container) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!AntigriefManager.canBreakBlock(player, block)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - List drops = new ArrayList<>(); - - for (Item item : event.getItems()) { - drops.add(item.getItemStack()); - } - - int experience = 0; - int fortune = EnchantChecks.getMainhandLevel(player, Enchantment.LOOT_BONUS_BLOCKS); - - for (ItemStack itemStack : drops) { - Pair out = getOutput(itemStack.getType()); - itemStack.setType(out.getFirst()); - experience += out.getSecond(); - - if (fortune > 0 && FORTUNE_MATERIALS.contains(itemStack.getType())) { - itemStack.setAmount((int) Math.round((Math.random() * ((double) fortune - 1)) + 1.1)); - experience++; - } - } - - if (!this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "drop-xp")) { - experience = 0; - } - - int i = 0; - for (Item item : event.getItems()) { - item.setItemStack(drops.get(i)); - i++; - } - - new DropQueue(player) - .setLocation(block.getLocation()) - .addXP(experience) - .push(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Inferno.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Inferno.java deleted file mode 100644 index 22353798..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Inferno.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.jetbrains.annotations.NotNull; - -public class Inferno extends EcoEnchant { - public Inferno() { - super( - "inferno", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentLaunch(@NotNull final LivingEntity shooter, - @NotNull final Trident trident, - final int level, - final @NotNull ProjectileLaunchEvent event) { - trident.setFireTicks(Integer.MAX_VALUE); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (trident.getFireTicks() <= 0) { - return; - } - - victim.setFireTicks(100); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java deleted file mode 100644 index 2a2b69db..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Infuriate.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.PigZombie; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Infuriate extends EcoEnchant { - public Infuriate() { - super( - "infuriate", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double distancePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level"); - final double distance = distancePerLevel * level; - - for (Entity e : attacker.getWorld().getNearbyEntities(attacker.getLocation(), distance, distance, distance)) { - if (!(e instanceof Monster)) { - continue; - } - - if (e instanceof PigZombie) { - ((PigZombie) e).setAngry(true); - } - - ((Monster) e).setTarget(attacker); - - Vector vector = attacker.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d); - - if (VectorUtils.isFinite(vector)) { - e.setVelocity(vector); - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Insecticide.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Insecticide.java deleted file mode 100644 index 83457511..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Insecticide.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Spider; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Insecticide extends EcoEnchant { - public Insecticide() { - super( - "insecticide", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Spider)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java deleted file mode 100644 index 06929c3b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Instantaneous.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockDamageEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class Instantaneous extends EcoEnchant { - public Instantaneous() { - super( - "instantaneous", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageBlock(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockDamageEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (block.getDrops(player.getInventory().getItemInMainHand()).isEmpty()) { - return; - } - - if (block.getType().getHardness() > 100) { - return; - } - - List blacklist = new ArrayList<>(); - - for (String s : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks")) { - blacklist.add(Material.getMaterial(s)); - } - - if (blacklist.contains(block.getType())) { - return; - } - - AnticheatManager.exemptPlayer(player); - - event.setInstaBreak(true); - - AnticheatManager.unexemptPlayer(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Introversion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Introversion.java deleted file mode 100644 index 7e7bee50..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Introversion.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Introversion extends EcoEnchant { - public Introversion() { - super( - "introversion", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Player)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - event.setDamage(event.getDamage() + (level * multiplier)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java deleted file mode 100644 index 9ae6c67a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Invigoration.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Invigoration extends EcoEnchant { - public Invigoration() { - super( - "invigoration", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onInvigorationHurt(@NotNull final EntityDamageEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (player.getHealth() > this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "below-health")) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - int totalInvigorationPoints = EnchantChecks.getArmorPoints(player, this, 0); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (totalInvigorationPoints == 0) { - return; - } - - double damageReduction = totalInvigorationPoints * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-multiplier") * 0.01; - event.setDamage(event.getDamage() * (1 - damageReduction)); - } - - @EventHandler - public void onInvigorationDamage(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (player.getHealth() > this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "below-health")) { - return; - } - - int totalInvigorationPoints = EnchantChecks.getArmorPoints(player, this, 0); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (totalInvigorationPoints == 0) { - return; - } - - double damageBonus = totalInvigorationPoints * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier") * 0.01; - damageBonus += 1; - event.setDamage(event.getDamage() * damageBonus); - } - -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Kinetic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Kinetic.java deleted file mode 100644 index 033f3818..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Kinetic.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Kinetic extends EcoEnchant { - public Kinetic() { - super( - "kinetic", EnchantmentType.NORMAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!event.getCause().equals(EntityDamageEvent.DamageCause.FLY_INTO_WALL)) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level"); - double multiplier = 1 - ((reduction / 100) * level); - event.setDamage(event.getDamage() * multiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java deleted file mode 100644 index 1e3a25f4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Launch.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.VelocityChecks; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Launch extends EcoEnchant { - public Launch() { - super( - "launch", EnchantmentType.NORMAL - ); - } - - // START OF LISTENERS - @EventHandler - public void onFireworkUse(@NotNull final PlayerInteractEvent event) { - if (event.getItem() == null) { - return; - } - - if (!event.getItem().getType().equals(Material.FIREWORK_ROCKET)) { - return; - } - - if (!event.getAction().equals(Action.RIGHT_CLICK_AIR)) { - return; - } - - Player player = event.getPlayer(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!player.isGliding()) { - return; - } - - if (!EnchantChecks.chestplate(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getChestplateLevel(player, this); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double boost = 1 + (multiplier * level); - Vector vector = player.getVelocity().multiply(boost); - - if (VelocityChecks.isUnsafeVelocity(vector)) { - return; - } - - this.getPlugin().getScheduler().run(() -> player.setVelocity(vector)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java deleted file mode 100644 index 36572d15..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Leeching.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Leeching extends EcoEnchant { - public Leeching() { - super( - "leeching", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level"); - double amountToHeal = level * multiplier; - double newHealth = attacker.getHealth() + amountToHeal; - if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - attacker.setHealth(newHealth); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.java deleted file mode 100644 index a8359a7b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lesion.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.atomic.AtomicInteger; - -public class Lesion extends EcoEnchant { - public Lesion() { - super( - "lesion", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double bleedDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bleed-damage"); - - int bleedCount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); - bleedCount *= level; - final int finalBleedCount = bleedCount; - - AtomicInteger currentBleedCount = new AtomicInteger(0); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - currentBleedCount.addAndGet(1); - - victim.damage(bleedDamage); - - if (currentBleedCount.get() >= finalBleedCount) { - bukkitRunnable.cancel(); - } - }).runTaskTimer(0, 10); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java deleted file mode 100644 index a9fd3f02..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Levitate.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Levitate extends EcoEnchant { - public Levitate() { - super( - "levitate", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level"); - - victim.setVelocity(new Vector(0, 0, 0)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, duration * level, 0)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LiquidShot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LiquidShot.java deleted file mode 100644 index 07065e2d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LiquidShot.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Blaze; -import org.bukkit.entity.Enderman; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.MagmaCube; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class LiquidShot extends EcoEnchant { - public LiquidShot() { - super( - "liquid_shot", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Blaze || victim instanceof MagmaCube || victim instanceof Enderman)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java deleted file mode 100644 index 0a28227c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/LuckyCatch.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerFishEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class LuckyCatch extends EcoEnchant { - public LuckyCatch() { - super( - "lucky_catch", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onFish(@NotNull final PlayerFishEvent event) { - Player player = event.getPlayer(); - ItemStack item = player.getInventory().getItemInMainHand(); - - if (!EnchantChecks.item(item, this)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (event.getState() == PlayerFishEvent.State.CAUGHT_ENTITY) { - return; - } - - int level = EnchantChecks.getItemLevel(item, this); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - Entity caught = event.getCaught(); - - if (!(caught instanceof Item caughtItem)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - caughtItem.getItemStack().setAmount(caughtItem.getItemStack().getAmount() * 2); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java deleted file mode 100644 index b8701637..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Lumberjack.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.BlockUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -public class Lumberjack extends EcoEnchant { - private List materials; - - public Lumberjack() { - super( - "lumberjack", EnchantmentType.NORMAL - ); - } - - @Override - protected void postUpdate() { - materials = new ArrayList<>(); - for (String string : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks")) { - Material match = Material.getMaterial(string.toUpperCase()); - if (match != null) { - materials.add(match); - } - } - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (block.hasMetadata("block-ignore")) { - return; - } - - if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) { - return; - } - - if (!materials.contains(block.getType())) { - return; - } - - int blocksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level"); - int limit = level * blocksPerLevel; - - Set treeBlocks = BlockUtils.getVein(block, materials, limit); - treeBlocks.removeIf(block1 -> !AntigriefManager.canBreakBlock(player, block1)); - - AnticheatManager.exemptPlayer(player); - EnchantmentUtils.rehandleBreaking(player, treeBlocks, this.getPlugin()); - AnticheatManager.unexemptPlayer(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java deleted file mode 100644 index 040ab596..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Magnetic.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import org.bukkit.entity.Entity; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -public class Magnetic extends EcoEnchant implements TimedRunnable { - private final Map players = new HashMap<>(); - private double initialDistance = 1; - private double bonus = 1; - - public Magnetic() { - super( - "magnetic", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorChangeEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerJoin(@NotNull final PlayerJoinEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - refresh(); - } - - private void refresh() { - players.clear(); - this.getPlugin().getScheduler().runLater(() -> this.getPlugin().getServer().getOnlinePlayers().forEach(player -> { - int level = EnchantChecks.getArmorPoints(player, this, 0); - if (level > 0) { - if (this.areRequirementsMet(player)) { - players.put(player, level); - } - } - }), 1); - initialDistance = EcoEnchants.MAGNETIC.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "initial-distance"); - bonus = EcoEnchants.MAGNETIC.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-level"); - } - - @Override - public void run() { - players.forEach((player, level) -> { - double distance = initialDistance + (level * bonus); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-while-sneaking")) { - if (player.isSneaking()) { - return; - } - } - - for (Entity e : player.getWorld().getNearbyEntities(player.getLocation(), distance, 2.0d, distance)) { - if (!(e instanceof Item || e instanceof ExperienceOrb)) { - continue; - } - - if (e instanceof Item && ((Item) e).getPickupDelay() > 0) { - continue; - } - - - Vector vector = player.getLocation().toVector().subtract(e.getLocation().toVector()).normalize().multiply(0.1 * level); - - if (VectorUtils.isFinite(vector)) { - e.setVelocity(vector); - } - } - }); - } - - @Override - public long getTime() { - return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.java deleted file mode 100644 index a7c42d37..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marking.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Marking extends EcoEnchant { - public Marking() { - super( - "marking", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - int ticks = ticksPerLevel * level; - - victim.setMetadata("marked", this.getPlugin().getMetadataValueFactory().create(true)); - - this.getPlugin().getScheduler().runLater(() -> victim.removeMetadata("marked", this.getPlugin()), ticks); - } - - @EventHandler - public void onHitWhileMarked(@NotNull final EntityDamageEvent event) { - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - if (!victim.hasMetadata("marked")) { - return; - } - - event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-while-weak")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java deleted file mode 100644 index 4a36b2dc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Marksman.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.jetbrains.annotations.NotNull; - -public class Marksman extends EcoEnchant { - public Marksman() { - super( - "marksman", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onMarksmanShoot(@NotNull final ProjectileLaunchEvent event) { - if (!(event.getEntity().getShooter() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - Projectile a = event.getEntity(); - a.setGravity(false); - - int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "remove-arrow-after-ticks"); - - this.getPlugin().getScheduler().runLater(() -> { - if (!a.isOnGround()) { - a.remove(); - } - }, ticks); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java deleted file mode 100644 index 79040fee..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Necrotic.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.enchantments.util.WeakMetadata; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.entity.WitherSkeleton; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Necrotic extends EcoEnchant { - public Necrotic() { - super( - "necrotic", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void necroticKill(@NotNull final EntityDeathEvent event) { - if (event.getEntity().getKiller() == null) { - return; - } - - if (!(event.getEntity() instanceof WitherSkeleton victim)) { - return; - } - - Player player = event.getEntity().getKiller(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (WeakMetadata.SUMMONED_ENTITY_MEMORY.containsKey(event.getEntity())) { - return; - } - - ItemStack item = new ItemStack(Material.WITHER_SKELETON_SKULL, 1); - - new DropQueue(player) - .addItem(item) - .setLocation(victim.getLocation()) - .addXP(event.getDroppedExp()) - .push(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/NetherInfusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/NetherInfusion.java deleted file mode 100644 index 5b3e737b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/NetherInfusion.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class NetherInfusion extends EcoEnchant { - public NetherInfusion() { - super( - "nether_infusion", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Netheric.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Netheric.java deleted file mode 100644 index 106d5718..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Netheric.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Netheric extends EcoEnchant { - public Netheric() { - super( - "netheric", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.NETHER)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Nocturnal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Nocturnal.java deleted file mode 100644 index 0d3818f4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Nocturnal.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Nocturnal extends EcoEnchant { - public Nocturnal() { - super( - "nocturnal", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.NORMAL)) { - return; - } - - if (!(attacker.getWorld().getTime() > 12300 && attacker.getWorld().getTime() < 23850)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Optics.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Optics.java deleted file mode 100644 index cbbd8210..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Optics.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Location; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Optics extends EcoEnchant { - public Optics() { - super( - "optics", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - Location land = arrow.getLocation(); - Location source = attacker.getLocation(); - - double distance = land.distance(source); - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "block-multiplier"); - - double damageMultiplier = (distance * level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java deleted file mode 100644 index e7c57194..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Oxygenate.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.jetbrains.annotations.NotNull; - -public class Oxygenate extends EcoEnchant { - public Oxygenate() { - super( - "oxygenate", EnchantmentType.NORMAL - ); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (player.getRemainingAir() == player.getMaximumAir()) { - return; - } - - int oxygenLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "oxygen-per-level"); - int oxygen = level * oxygenLevel; - int newOxygen = player.getRemainingAir() + oxygen; - newOxygen = Math.min(newOxygen, player.getMaximumAir()); - - player.setRemainingAir(newOxygen); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Pacify.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Pacify.java deleted file mode 100644 index 57ffccc7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Pacify.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Creeper; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Pacify extends EcoEnchant { - public Pacify() { - super( - "pacify", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Creeper)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paladin.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paladin.java deleted file mode 100644 index 971b4bb7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paladin.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Horse; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Paladin extends EcoEnchant { - public Paladin() { - super( - "paladin", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(attacker.getVehicle() instanceof Horse)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.java deleted file mode 100644 index 3bd3ca4d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Paralyze.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Paralyze extends EcoEnchant { - public Paralyze() { - super( - "paralyze", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int finalDuration = duration * level; - - attacker.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, finalDuration, 10, false, false, false)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java deleted file mode 100644 index f38e7f9f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parasitic.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Parasitic extends EcoEnchant { - public Parasitic() { - super( - "parasitic", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level"); - double amountToHeal = level * multiplier; - double newHealth = attacker.getHealth() + amountToHeal; - if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - - if (attacker.getHealth() > 0) { - attacker.setHealth(newHealth); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.java deleted file mode 100644 index e46c23ea..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Parry.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Parry extends EcoEnchant { - public Parry() { - super( - "parry", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void parryHit(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 - (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Phantasm.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Phantasm.java deleted file mode 100644 index 7e4253cc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Phantasm.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Trident; -import org.bukkit.entity.Zombie; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Phantasm extends EcoEnchant { - public Phantasm() { - super( - "phantasm", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Zombie || victim instanceof Skeleton)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java deleted file mode 100644 index 707cfc8a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Plasmic.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.EntityEquipment; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Plasmic extends EcoEnchant { - private static final Material[] ITEMS; - - static { - ITEMS = new Material[]{ - Material.DIAMOND_HELMET, - Material.DIAMOND_CHESTPLATE, - Material.DIAMOND_LEGGINGS, - Material.DIAMOND_BOOTS, - - Material.NETHERITE_HELMET, - Material.NETHERITE_CHESTPLATE, - Material.NETHERITE_LEGGINGS, - Material.NETHERITE_BOOTS - }; - } - - public Plasmic() { - super( - "plasmic", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - EntityEquipment equipment = victim.getEquipment(); - if (equipment == null) { - return; - } - - int pieces = 0; - for (ItemStack armorPiece : equipment.getArmorContents()) { - if (armorPiece == null) { - continue; - } - if (Arrays.asList(ITEMS).contains(armorPiece.getType())) { - pieces++; - } - } - - if (pieces == 0) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier * pieces))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.java deleted file mode 100644 index 290f46ef..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Protector.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Tameable; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Protector extends EcoEnchant { - public Protector() { - super( - "protector", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Tameable victim)) { - return; - } - - if (victim.getOwner() == null) { - return; - } - if (!victim.getOwner().equals(attacker)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.java deleted file mode 100644 index bea9edb4..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Proximity.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Proximity extends EcoEnchant { - public Proximity() { - super( - "proximity", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().equals(victim.getWorld())) { - return; - } - - double distance = attacker.getLocation().distance(victim.getLocation()); - - double decreaseAfter = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "when-closer-than-blocks"); - - if (distance > decreaseAfter) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Puncture.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Puncture.java deleted file mode 100644 index 4384c74e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Puncture.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Shulker; -import org.bukkit.entity.Trident; -import org.bukkit.entity.Turtle; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Puncture extends EcoEnchant { - public Puncture() { - super( - "puncture", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Turtle || victim instanceof Shulker)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Quadrilateralism.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Quadrilateralism.java deleted file mode 100644 index 414691ec..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Quadrilateralism.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Slime; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Quadrilateralism extends EcoEnchant { - public Quadrilateralism() { - super( - "quadrilateralism", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Slime)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java deleted file mode 100644 index 879c7897..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Radiance.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Radiance extends EcoEnchant { - public Radiance() { - super( - "radiance", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier"); - int duration = level * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level"); - - for (Entity e : arrow.getNearbyEntities(radius, radius, radius)) { - if (e.hasMetadata("NPC")) { - continue; - } - - if (!(e instanceof LivingEntity entity)) { - continue; - } - - if (e.equals(attacker)) { - continue; - } - - entity.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, duration, 0, false, false, false)); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java deleted file mode 100644 index ba154cf2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rage.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.PigZombie; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Rage extends EcoEnchant { - public Rage() { - super( - "rage", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double distancePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level"); - final double distance = distancePerLevel * level; - - for (Entity e : victim.getWorld().getNearbyEntities(victim.getLocation(), distance, distance, distance)) { - if (!(e instanceof Monster)) { - continue; - } - - if (e instanceof PigZombie) { - ((PigZombie) e).setAngry(true); - } - - ((Monster) e).setTarget(victim); - - Vector vector = attacker.getLocation().toVector().clone().subtract(e.getLocation().toVector()).normalize().multiply(0.23d); - - if (VectorUtils.isFinite(vector)) { - e.setVelocity(vector); - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java deleted file mode 100644 index e1225eec..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rapid.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.jetbrains.annotations.NotNull; - -public class Rapid extends EcoEnchant { - public Rapid() { - super( - "rapid", EnchantmentType.NORMAL - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - if (shooter instanceof Player player) { - AnticheatManager.exemptPlayer(player); - } - double multiplier = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-faster-per-level") / 100) * level); - - if (event.getForce() < multiplier) { - return; - } - - double force = 1 / event.getForce(); - event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(force)); - - if (shooter instanceof Player player) { - AnticheatManager.unexemptPlayer(player); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java deleted file mode 100644 index 2b7ef38e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reaper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; - -public class Reaper extends EcoEnchant { - public Reaper() { - super( - "reaper", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - // Actual code is in soulbound. -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.java deleted file mode 100644 index f0dbf63d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rebounding.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Rebounding extends EcoEnchant { - public Rebounding() { - super( - "rebounding", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onDamage(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity attacker)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!this.areRequirementsMet(victim)) { - return; - } - - int level = EnchantChecks.getArmorPoints(victim, this); - - if (level == 0) { - return; - } - - if (this.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize() - .multiply((level * (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier") - 1)) + 1); - - if (!VectorUtils.isFinite(vector)) { - return; - } - - vector.setY(0.2); - - if (!VectorUtils.isFinite(vector)) { - return; - } - - attacker.setVelocity(vector); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java deleted file mode 100644 index f6770f32..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reel.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerFishEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Reel extends EcoEnchant { - public Reel() { - super( - "reel", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onFish(@NotNull final PlayerFishEvent event) { - if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) { - return; - } - - if (!(event.getCaught() instanceof LivingEntity victim)) { - return; - } - - Player player = event.getPlayer(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (victim.hasMetadata("NPC")) { - return; - } - - if (!AntigriefManager.canInjure(player, victim)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier"); - Vector vector = player.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier); - if (VectorUtils.isFinite(vector)) { - victim.setVelocity(vector); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reinforcement.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reinforcement.java deleted file mode 100644 index ad4bc6d8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Reinforcement.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Reinforcement extends EcoEnchant { - public Reinforcement() { - super( - "reinforcement", EnchantmentType.NORMAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level"); - double multiplier = 1 - ((reduction / 100) * level); - event.setDamage(event.getDamage() * multiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.java deleted file mode 100644 index 596a0438..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Rejuvenation.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.jetbrains.annotations.NotNull; - -public class Rejuvenation extends EcoEnchant { - public Rejuvenation() { - super( - "rejuvenation", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onRejuvenationHeal(@NotNull final EntityRegainHealthEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.SATIATED) && !event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.REGEN)) { - return; - } - - int totalRejuvenationPoints = EnchantChecks.getArmorPoints(player, this, 0); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (totalRejuvenationPoints == 0) { - return; - } - - double amount = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "per-point-multiplier"); - amount = amount * totalRejuvenationPoints; - amount += 1; - - event.setAmount(event.getAmount() * amount); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java deleted file mode 100644 index 3165660a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Replenish.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.data.Ageable; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.jetbrains.annotations.NotNull; - -public class Replenish extends EcoEnchant { - public Replenish() { - super( - "replenish", EnchantmentType.NORMAL - ); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - Material type = block.getType(); - - if (!(block.getBlockData() instanceof Ageable data)) { - return; - } - - if (block.getType() == Material.GLOW_BERRIES || block.getType() == Material.SWEET_BERRY_BUSH) { - return; - } - - if (block.getType() == Material.CACTUS || block.getType() == Material.BAMBOO) { - return; - } - - if (block.getType() == Material.CHORUS_FLOWER || block.getType() == Material.SUGAR_CANE) { - return; - } - - - if (data.getAge() != data.getMaximumAge()) { - event.setDropItems(false); - event.setExpToDrop(0); - - data.setAge(0); - - this.getPlugin().getScheduler().runLater(() -> { - block.setType(type); - block.setBlockData(data); - }, 1); - } - - data.setAge(0); - - this.getPlugin().getScheduler().runLater(() -> { - block.setType(type); - block.setBlockData(data); - }, 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Respirator.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Respirator.java deleted file mode 100644 index 48b0c627..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Respirator.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Respirator extends EcoEnchant { - public Respirator() { - super( - "respirator", EnchantmentType.NORMAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - final @NotNull EntityDamageEvent event) { - if (!event.getCause().equals(EntityDamageEvent.DamageCause.DRAGON_BREATH)) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level"); - - double multiplier = 1 - ((reduction / 100) * level); - - event.setDamage(event.getDamage() * multiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Revenant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Revenant.java deleted file mode 100644 index a214959f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Revenant.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Zombie; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Revenant extends EcoEnchant { - public Revenant() { - super( - "revenant", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Zombie || victim instanceof Skeleton)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java deleted file mode 100644 index a2db6c61..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sating.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.jetbrains.annotations.NotNull; - -public class Sating extends EcoEnchant { - public Sating() { - super( - "sating", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onSatingHunger(@NotNull final FoodLevelChangeEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.helmet(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (event.getFoodLevel() > player.getFoodLevel()) { - return; - } - - int level = EnchantChecks.getHelmetLevel(player, this); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Serrated.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Serrated.java deleted file mode 100644 index ef3ec479..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Serrated.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Serrated extends EcoEnchant { - public Serrated() { - super( - "serrated", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Settle.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Settle.java deleted file mode 100644 index c744f4fb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Settle.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Creeper; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Settle extends EcoEnchant { - public Settle() { - super( - "settle", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Creeper)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java deleted file mode 100644 index 86b5d6c3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Shockwave.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Shockwave extends EcoEnchant { - public Shockwave() { - super( - "shockwave", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onShoot(@NotNull final ProjectileLaunchEvent event) { - if (!(event.getEntity() instanceof AbstractArrow entity)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - ItemStack item = player.getInventory().getItemInMainHand(); - if (entity instanceof Trident trident) { - item = trident.getItem(); - } - - if (!EnchantChecks.item(item, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "particle-tick-delay"); - - int level = EnchantChecks.getMainhandLevel(player, this); - double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - damage *= level; - final double finalDamage = damage; - - this.getPlugin().getRunnableFactory().create(runnable -> { - if (entity.isOnGround() || entity.isInBlock() || entity.isDead()) { - runnable.cancel(); - } - entity.getNearbyEntities(1.5, 1.5, 1.5).stream() - .filter(entity1 -> entity1 instanceof LivingEntity) - .filter(entity1 -> entity1 != player) - .filter(entity1 -> !entity1.hasMetadata("shockwaved")) - .filter(entity1 -> AntigriefManager.canInjure(player, (LivingEntity) entity1)) - .forEach((mob -> { - ((LivingEntity) mob).damage(finalDamage, entity); - mob.setMetadata("shockwaved", this.getPlugin().getMetadataValueFactory().create(true)); - this.getPlugin().getScheduler().runLater(() -> mob.removeMetadata("shockwaved", this.getPlugin()), 10); - } - )); - }).runTaskTimer(4, ticks); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.java deleted file mode 100644 index f1fb87e3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/ShotAssist.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class ShotAssist extends EcoEnchant { - public ShotAssist() { - super( - "shot_assist", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onHit(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof Arrow)) { - return; - } - - if (!(((Arrow) event.getDamager()).getShooter() instanceof Player player)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - assert player != null; - - int points = EnchantChecks.getArmorPoints(player, this, 0); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (points == 0) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double reduction = 1 + (multiplier * points); - event.setDamage(damage * reduction); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.java deleted file mode 100644 index 7677fd0b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sickening.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Sickening extends EcoEnchant { - public Sickening() { - super( - "sickening", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level"); - - victim.setVelocity(new Vector(0, 0, 0)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, duration * level, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slaughter.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slaughter.java deleted file mode 100644 index 22f9ac78..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slaughter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Slaughter extends EcoEnchant { - public Slaughter() { - super( - "slaughter", EnchantmentType.NORMAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim instanceof Monster) { - return; - } - - if (victim instanceof Player) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 1)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java deleted file mode 100644 index 0431ace1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Slicing.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Bukkit; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerMoveEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; - -public class Slicing extends EcoEnchant { - private final ArrayList entities = new ArrayList<>(); - - public Slicing() { - super( - "slicing", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onPlayerCollide(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (!player.isGliding()) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.chestplate(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - for (Entity entity : player.getNearbyEntities(1, 1, 1)) { - LivingEntity victim; - if (entity instanceof LivingEntity) { - victim = (LivingEntity) entity; - } else { - continue; - } - - if (entities.contains(victim)) { - continue; - } - - double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - int level = EnchantChecks.getChestplateLevel(player, this); - victim.damage(level * damage, player); - entities.add(victim); - - Bukkit.getServer().getScheduler().runTaskLater(this.getPlugin(), () -> entities.remove(victim), this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "cooldown")); - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "damage-elytra")) { - DurabilityUtils.damageItem(player, player.getInventory().getChestplate(), 1); - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java deleted file mode 100644 index cd3e6ddb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spearfishing.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Random; - -public class Spearfishing extends EcoEnchant { - public Spearfishing() { - super( - "spearfishing", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onSpearfishingLand(@NotNull final ProjectileHitEvent event) { - if (event.getEntityType() != EntityType.TRIDENT) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!(event.getEntity() instanceof Trident trident)) { - return; - } - - if (!trident.getWorld().getBlockAt(trident.getLocation().add(0, 0.2, 0)).getType().equals(Material.WATER)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - ItemStack item = trident.getItem(); - - if (!EnchantChecks.item(item, this)) { - return; - } - - int level = EnchantChecks.getItemLevel(item, this); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - List potentialDrops = new ArrayList<>(); - this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "drops").forEach(material -> { - potentialDrops.add(Material.getMaterial(material.toUpperCase())); - }); - - Collections.shuffle(potentialDrops, new Random(NumberUtils.randInt(0, 100000))); - ItemStack drop = new ItemStack(potentialDrops.get(0), 1); - - if (EnchantChecks.item(item, EcoEnchants.TELEKINESIS)) { - new DropQueue(player) - .addItem(drop) - .setLocation(trident.getLocation()) - .forceTelekinesis() - .push(); - } else { - new DropQueue(player) - .addItem(drop) - .setLocation(trident.getLocation()) - .push(); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java deleted file mode 100644 index cf5347eb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Spiked.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerFishEvent; -import org.jetbrains.annotations.NotNull; - -public class Spiked extends EcoEnchant { - public Spiked() { - super( - "spiked", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onFish(@NotNull final PlayerFishEvent event) { - if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) { - return; - } - - if (!(event.getCaught() instanceof LivingEntity victim)) { - return; - } - - Player player = event.getPlayer(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (victim.hasMetadata("NPC")) { - return; - } - - if (!AntigriefManager.canInjure(player, victim)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - double damage = damagePerLevel * level; - victim.damage(damage, player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java deleted file mode 100644 index 8d0699ee..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Splash.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Bukkit; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -@SuppressWarnings("deprecation") -public class Splash extends EcoEnchant { - public Splash() { - super( - "splash", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentHit(@NotNull final LivingEntity shooter, - final int level, - @NotNull final ProjectileHitEvent event) { - Trident trident = (Trident) event.getEntity(); - - ItemStack item = trident.getItem(); - - if (!EnchantChecks.item(item, this)) { - return; - } - - if (this.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - double radius = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier"); - double damage = level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - - for (Entity victim : trident.getNearbyEntities(radius, radius, radius)) { - if (victim.hasMetadata("NPC")) { - continue; - } - - if (!(victim instanceof LivingEntity entity)) { - continue; - } - - if (victim.equals(shooter)) { - continue; - } - - Bukkit.getPluginManager().callEvent(new EntityDamageByEntityEvent(trident, entity, EntityDamageEvent.DamageCause.ENTITY_ATTACK, damage)); - - if (shooter instanceof Player) { - if (!AntigriefManager.canInjure((Player) shooter, entity)) { - continue; - } - } - - entity.damage(damage, trident); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stab.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stab.java deleted file mode 100644 index d1a15d96..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stab.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Stab extends EcoEnchant { - public Stab() { - super( - "stab", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-base"); - double perLevelDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - double damage = baseDamage + (level * perLevelDamage); - - event.setDamage(event.getDamage() + damage); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.java deleted file mode 100644 index 1e3858b3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stalwart.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Stalwart extends EcoEnchant { - public Stalwart() { - super( - "stalwart", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "duration-per-level"); - duration *= level; - - int amplifier = (int) Math.ceil((double) level / 4) - 1; - - victim.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, duration, amplifier, false, false, true)); - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java deleted file mode 100644 index fb563bbe..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Stamina.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.jetbrains.annotations.NotNull; - -public class Stamina extends EcoEnchant { - public Stamina() { - super( - "stamina", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @EventHandler - public void onStaminaHunger(@NotNull final FoodLevelChangeEvent event) { - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!player.isSprinting()) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.boots(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (event.getFoodLevel() > player.getFoodLevel()) { - return; - } - - int level = EnchantChecks.getBootsLevel(player, this); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java deleted file mode 100644 index e591088b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StoneSwitcher.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class StoneSwitcher extends EcoEnchant { - public StoneSwitcher() { - super( - "stone_switcher", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (!block.getType().equals(Material.STONE)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setDropItems(false); - - Material material; - double random = NumberUtils.randFloat(0, 1); - double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size(); - int selectedIndex = (int) Math.floor(random / band); - selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1); - String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex); - material = Material.getMaterial(materialName.toUpperCase()); - - if (material == null) { - material = Material.COBBLESTONE; - } - - ItemStack item = new ItemStack(material, 1); - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItem(item) - .push(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java deleted file mode 100644 index 11cf512f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/StrayAspect.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class StrayAspect extends EcoEnchant { - public StrayAspect() { - super( - "stray_aspect", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, level * ticksPerLevel, level)); - victim.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, level * ticksPerLevel, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java deleted file mode 100644 index c83d067f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Succession.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.jetbrains.annotations.NotNull; - -public class Succession extends EcoEnchant { - public Succession() { - super( - "succession", EnchantmentType.NORMAL - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "extra-arrows-per-level") * level; - - boolean fire = EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE); - - if (shooter instanceof Player player) { - AnticheatManager.exemptPlayer(player); - } - - for (int i = 1; i <= amount; i++) { - this.getPlugin().getScheduler().runLater(() -> { - Arrow arrow1 = shooter.launchProjectile(Arrow.class, event.getProjectile().getVelocity()); - arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); - if (fire) { - arrow1.setFireTicks(Integer.MAX_VALUE); - } - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "per-arrow-damage") && shooter instanceof Player) { - DurabilityUtils.damageItem((Player) shooter, ((Player) shooter).getInventory().getItemInMainHand(), 1); - } - }, (long) i * this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "delay-between-arrows")); - } - if (shooter instanceof Player player) { - AnticheatManager.unexemptPlayer(player); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.java deleted file mode 100644 index 2de2131a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Supercritical.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Supercritical extends EcoEnchant { - public Supercritical() { - super( - "supercritical", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-multiplier")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sycophant.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sycophant.java deleted file mode 100644 index 96df8afd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Sycophant.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Sycophant extends EcoEnchant { - public Sycophant() { - super( - "sycophant", EnchantmentType.NORMAL - ); - } - - @Override - public void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level"); - double amountToHeal = level * multiplier; - double newHealth = blocker.getHealth() + amountToHeal; - if (newHealth > blocker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - newHealth = blocker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - blocker.setHealth(newHealth); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tectonic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tectonic.java deleted file mode 100644 index 25968078..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tectonic.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; - -public class Tectonic extends EcoEnchant { - public Tectonic() { - super( - "tectonic", EnchantmentType.NORMAL - ); - } - - @Override - public void onFallDamage(@NotNull final LivingEntity faller, - final int level, - @NotNull final EntityDamageEvent event) { - - if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) { - return; - } - - int radius = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-radius") + (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-radius") * level - 1); - int damage = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-damage") + (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-damage") * level - 1); - - - Collection entities = faller.getWorld().getNearbyEntities(faller.getLocation(), radius, 2, radius); - - for (Entity entity : entities) { - if (entity.equals(faller)) { - continue; - } - if (!(entity instanceof LivingEntity)) { - continue; - } - entity.teleport(entity.getLocation().add(0, 0.3, 0)); - if (faller instanceof Player && !AntigriefManager.canInjure((Player) faller, (LivingEntity) entity)) { - return; - } - ((LivingEntity) entity).damage(damage); - } - } - -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java deleted file mode 100644 index b50f47f6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Telekinesis.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.core.events.EntityDeathByEntityEvent; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.core.integrations.mcmmo.McmmoManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.integrations.mythicmobs.MythicMobsManager; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDropItemEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataType; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; - -public class Telekinesis extends EcoEnchant { - private static boolean always = false; - - public Telekinesis() { - super( - "telekinesis", EnchantmentType.NORMAL - ); - } - - @Override - protected void postUpdate() { - always = this.getPlugin().getConfigYml().getBool("advanced.force-dropqueue"); - } - - // For block drops - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public void telekinesisDropItem(@NotNull final BlockDropItemEvent event) { - Player player = event.getPlayer(); - - if (!always && !(EnchantChecks.mainhand(player, this)) && this.areRequirementsMet(player)) { - return; - } - - if (this.getDisabledWorldNames().contains(player.getWorld().getName())) { - return; - } - - if (event.isCancelled()) { - return; - } - - Block block = event.getBlock(); - - if (!AntigriefManager.canBreakBlock(player, block)) { - return; - } - - List drops = new ArrayList<>(); - - for (Item item : event.getItems()) { - drops.add(item.getItemStack()); - for (int i = 0; i < McmmoManager.getBonusDropCount(block); i++) { - drops.add(item.getItemStack()); - } - } - - event.getItems().clear(); - - DropQueue queue = new DropQueue(player) - .setLocation(block.getLocation()) - .addItems(drops); - - if (!always) { - queue.forceTelekinesis(); - } - - queue.push(); - } - - // For exp drops, blockdropitemevent doesn't cover xp - @EventHandler(priority = EventPriority.HIGH) - public void telekinesisBreak(@NotNull final BlockBreakEvent event) { - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (!always && !(EnchantChecks.mainhand(player, this)) && this.areRequirementsMet(player)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!AntigriefManager.canBreakBlock(player, block)) { - return; - } - - if (block.getType().equals(Material.SPAWNER)) { - event.setExpToDrop(0); - } - - DropQueue queue = new DropQueue(player) - .setLocation(block.getLocation()) - .addXP(event.getExpToDrop()); - - if (!always) { - queue.forceTelekinesis(); - } - - queue.push(); - - event.setExpToDrop(0); - } - - @EventHandler(priority = EventPriority.HIGH) - public void telekinesisKill(@NotNull final EntityDeathByEntityEvent event) { - Player player = null; - LivingEntity entity = event.getVictim(); - ItemStack item = null; - - if (entity instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-on-players")) { - return; - } - - if (!MythicMobsManager.canDropItems(entity)) { - return; - } - - if (event.getKiller() instanceof Player) { - player = (Player) event.getKiller(); - item = player.getInventory().getItemInMainHand(); - } else if (event.getKiller() instanceof Arrow) { - if (((Arrow) event.getKiller()).getShooter() instanceof Player) { - player = (Player) ((Arrow) event.getKiller()).getShooter(); - item = player.getInventory().getItemInMainHand(); - } - } else if (event.getKiller() instanceof Trident trident) { - if (trident.getShooter() instanceof Player) { - player = (Player) trident.getShooter(); - item = trident.getItem(); - } - } - - //noinspection ConstantConditions - if (player == null || item == null) { - return; - } - - if (Objects.equals(player, entity)) { - return; - } - - if (!EnchantChecks.item(item, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int xp = event.getXp(); - Collection drops = event.getDrops(); - - drops.removeIf(itemStack -> { - if (itemStack == null) { - return true; - } - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return false; - } - //noinspection ConstantConditions - if (meta.getPersistentDataContainer() == null) { - return false; - } - return meta.getPersistentDataContainer().has(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER); - }); - - new DropQueue(player) - .addItems(drops) - .setLocation(entity.getLocation()) - .addXP(xp) - .forceTelekinesis() - .push(); - - event.getDeathEvent().setDroppedExp(0); - event.getDeathEvent().getDrops().clear(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java deleted file mode 100644 index 5d29599e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thor.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.LightningUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Thor extends EcoEnchant { - public Thor() { - super( - "thor", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage"); - - boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound"); - LightningUtils.strike(victim, damage, silent); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java deleted file mode 100644 index e59a4699..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Thrive.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.attribute.Attribute; -import org.bukkit.attribute.AttributeInstance; -import org.bukkit.attribute.AttributeModifier; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.jetbrains.annotations.NotNull; - -import java.util.UUID; - -public class Thrive extends EcoEnchant { - private final AttributeModifier modifier = new AttributeModifier(UUID.nameUUIDFromBytes("thrive".getBytes()), this.getKey().getKey(), 1, AttributeModifier.Operation.ADD_NUMBER); - - public Thrive() { - super( - "thrive", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorChangeEvent event) { - Player player = event.getPlayer(); - - if (!this.areRequirementsMet(player)) { - return; - } - - int points = EnchantChecks.getArmorPoints(player, this); - - AttributeInstance inst = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); - - assert inst != null; - - if (this.getDisabledWorlds().contains(player.getWorld())) { - points = 0; - } - - inst.removeModifier(modifier); - - if (points > 0) { - inst.addModifier( - new AttributeModifier( - UUID.nameUUIDFromBytes("thrive".getBytes()), - this.getKey().getKey(), - this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "health-per-point") * points, - AttributeModifier.Operation.ADD_NUMBER - ) - ); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java deleted file mode 100644 index 3afc824c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tornado.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Tornado extends EcoEnchant { - public Tornado() { - super( - "tornado", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double baseVelocity = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-per-level"); - double yVelocity = baseVelocity * level; - - Vector toAdd = new Vector(0, yVelocity, 0); - - if (victim instanceof Player pVictim) { - AnticheatManager.exemptPlayer(pVictim); - - this.getPlugin().getScheduler().runLater(() -> { - AnticheatManager.unexemptPlayer(pVictim); - }, 40); - } - - this.getPlugin().getScheduler().run(() -> { - victim.setVelocity(victim.getVelocity().clone().add(toAdd)); - }); - - this.getPlugin().getScheduler().runLater(() -> victim.setVelocity(victim.getVelocity().clone().add(toAdd)), 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java deleted file mode 100644 index 212f98af..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Toxic.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Toxic extends EcoEnchant { - public Toxic() { - super( - "toxic", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.addPotionEffect(new PotionEffect(PotionEffectType.POISON, level * 10 + 20, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java deleted file mode 100644 index f2738f61..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Transfuse.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Transfuse extends EcoEnchant { - public Transfuse() { - super( - "transfuse", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "works-on").contains(block.getType().toString().toLowerCase())) { - return; - } - - event.setDropItems(false); - - Material material; - double random = NumberUtils.randFloat(0, 1); - double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size(); - int selectedIndex = (int) Math.floor(random / band); - selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1); - String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex); - material = Material.getMaterial(materialName.toUpperCase()); - if (material == null) { - material = Material.COBBLESTONE; - } - - ItemStack item = new ItemStack(material, 1); - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItem(item) - .push(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.java deleted file mode 100644 index 293681b8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Tripleshot.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Tripleshot extends EcoEnchant { - public Tripleshot() { - super( - "tripleshot", EnchantmentType.NORMAL - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (shooter instanceof Player player) { - AnticheatManager.exemptPlayer(player); - } - - for (int i = -1; i < 2; i += 2) { - Vector velocity = event.getProjectile().getVelocity(); - - float radians = (float) ((float) i * Math.toRadians(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "angle"))); - velocity.rotateAroundY(radians); - - Arrow arrow1 = shooter.launchProjectile(Arrow.class, velocity); - if (EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE)) { - arrow1.setFireTicks(Integer.MAX_VALUE); - } - arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); - } - - if (shooter instanceof Player player) { - AnticheatManager.unexemptPlayer(player); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java deleted file mode 100644 index 6dbe0c7e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VampireAspect.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class VampireAspect extends EcoEnchant { - public VampireAspect() { - super( - "vampire_aspect", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, level * 10 + 20, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java deleted file mode 100644 index b7da4cc2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Vein.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.util.BlockUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.List; -import java.util.Set; - -public class Vein extends EcoEnchant { - public Vein() { - super( - "vein", EnchantmentType.NORMAL - ); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (block.hasMetadata("block-ignore")) { - return; - } - - if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) { - return; - } - - List materials = Collections.singletonList(block.getType()); - - if (!this.getConfig() - .getStrings(EcoEnchants.CONFIG_LOCATION + "whitelisted-blocks") - .contains(block.getType().toString().toLowerCase())) { - return; - } - - int blocksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level"); - int limit = level * blocksPerLevel; - - Set blockSet = BlockUtils.getVein(block, materials, limit); - blockSet.removeIf(block1 -> !AntigriefManager.canBreakBlock(player, block1)); - - AnticheatManager.exemptPlayer(player); - EnchantmentUtils.rehandleBreaking(player, blockSet, this.getPlugin()); - AnticheatManager.unexemptPlayer(player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java deleted file mode 100644 index 730ac04d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Venom.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Venom extends EcoEnchant { - public Venom() { - super( - "venom", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - victim.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, level * 10 + 20, level)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VoidAffinity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VoidAffinity.java deleted file mode 100644 index 3c275127..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/VoidAffinity.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.World; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class VoidAffinity extends EcoEnchant { - public VoidAffinity() { - super( - "void_affinity", EnchantmentType.NORMAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getWorld().getEnvironment().equals(World.Environment.THE_END)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Voltage.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Voltage.java deleted file mode 100644 index 5d3d9465..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Voltage.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.EntityEquipment; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Voltage extends EcoEnchant { - private static final Material[] ITEMS = { - Material.IRON_HELMET, - Material.IRON_CHESTPLATE, - Material.IRON_LEGGINGS, - Material.IRON_BOOTS, - - Material.GOLDEN_HELMET, - Material.GOLDEN_CHESTPLATE, - Material.GOLDEN_LEGGINGS, - Material.GOLDEN_BOOTS, - - Material.CHAINMAIL_HELMET, - Material.CHAINMAIL_CHESTPLATE, - Material.CHAINMAIL_LEGGINGS, - Material.CHAINMAIL_BOOTS, - }; - - public Voltage() { - super( - "voltage", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - EntityEquipment equipment = victim.getEquipment(); - if (equipment == null) { - return; - } - - int pieces = 0; - - for (ItemStack armorPiece : equipment.getArmorContents()) { - if (armorPiece == null) { - continue; - } - - if (Arrays.asList(ITEMS).contains(armorPiece.getType())) { - pieces++; - } - } - - if (pieces == 0) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - event.setDamage(event.getDamage() * (1 + (level * multiplier * pieces))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAffinity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAffinity.java deleted file mode 100644 index 6fd7fbb6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAffinity.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Material; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class WaterAffinity extends EcoEnchant { - public WaterAffinity() { - super( - "water_affinity", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!attacker.getLocation().getBlock().getType().equals(Material.WATER)) { - return; - } - - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level); - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAspect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAspect.java deleted file mode 100644 index 465811a3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WaterAspect.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Blaze; -import org.bukkit.entity.Enderman; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.MagmaCube; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class WaterAspect extends EcoEnchant { - public WaterAspect() { - super( - "water_aspect", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Blaze || victim instanceof MagmaCube || victim instanceof Enderman)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - double damageMultiplier = (level * multiplier) + 1; - - event.setDamage(event.getDamage() * damageMultiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java deleted file mode 100644 index 8a4a5074..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Weakening.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Weakening extends EcoEnchant { - public Weakening() { - super( - "weakening", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - int ticksPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level"); - int ticks = ticksPerLevel * level; - - victim.setMetadata("weak", this.getPlugin().getMetadataValueFactory().create(true)); - - this.getPlugin().getScheduler().runLater(() -> victim.removeMetadata("weak", this.getPlugin()), ticks); - } - - @EventHandler - public void onDamage(@NotNull final EntityDamageEvent event) { - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - if (!victim.hasMetadata("weak")) { - return; - } - - event.setDamage(event.getDamage() * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-while-weak")); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java deleted file mode 100644 index 562b7ab1..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wisdom.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.events.NaturalExpGainEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.inventory.InventoryType; -import org.jetbrains.annotations.NotNull; - -public class Wisdom extends EcoEnchant { - public Wisdom() { - super( - "wisdom", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onExpChange(@NotNull final NaturalExpGainEvent event) { - Player player = event.getExpChangeEvent().getPlayer(); - - if (event.getExpChangeEvent().getAmount() < 0) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (player.getOpenInventory().getTopInventory().getType() == InventoryType.GRINDSTONE) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point"))))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java deleted file mode 100644 index d53bdad6..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/WoodSwitcher.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Tag; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class WoodSwitcher extends EcoEnchant { - public WoodSwitcher() { - super( - "wood_switcher", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (!Tag.LOGS.isTagged(block.getType())) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - event.setDropItems(false); - - Material material; - double random = NumberUtils.randFloat(0, 1); - double band = 1 / (double) this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size(); - int selectedIndex = (int) Math.floor(random / band); - selectedIndex = Math.min(selectedIndex, this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").size() - 1); - String materialName = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks").get(selectedIndex); - material = Material.getMaterial(materialName.toUpperCase()); - - if (material == null) { - material = block.getType(); - } - - ItemStack item = new ItemStack(material, 1); - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItem(item) - .push(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.java deleted file mode 100644 index 86a81ed2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Wound.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.atomic.AtomicInteger; - -public class Wound extends EcoEnchant { - public Wound() { - super( - "wound", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double bleedDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bleed-damage"); - - int bleedCount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount-per-level"); - bleedCount *= level; - final int finalBleedCount = bleedCount; - - AtomicInteger currentBleedCount = new AtomicInteger(0); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - currentBleedCount.addAndGet(1); - - victim.damage(bleedDamage); - - if (currentBleedCount.get() >= finalBleedCount) { - bukkitRunnable.cancel(); - } - }).runTaskTimer(0, 10); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java deleted file mode 100644 index e532da4b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Zeus.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.normal; - -import com.willfp.eco.util.LightningUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Zeus extends EcoEnchant { - public Zeus() { - super( - "zeus", EnchantmentType.NORMAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage"); - - boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound"); - LightningUtils.strike(victim, damage, silent); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java deleted file mode 100644 index 387bee5f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Aiming.java +++ /dev/null @@ -1,135 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.entities.Entities; -import com.willfp.eco.core.entities.TestableEntity; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.GameMode; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Enderman; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -@SuppressWarnings({"unchecked", "unused"}) -public class Aiming extends EcoEnchant { - private final List targets = new ArrayList<>(); - - public Aiming() { - super( - "aiming", EnchantmentType.SPECIAL - ); - targets.clear(); - targets.addAll(this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "targets").stream().map( - Entities::lookup - ).toList()); - } - - @EventHandler - public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) { - if (!(event.getEntity().getShooter() instanceof Player player)) { - return; - } - - if (!(event.getEntity() instanceof Arrow arrow)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level"); - - double distance = level * multiplier; - double force = arrow.getVelocity().clone().length() / 3; - force = Math.min(force, 1); - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "require-full-force") && force < 0.9) { - return; - } - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "scale-on-force")) { - distance *= force; - } - - final double finalDistance = distance; - - Runnable runnable = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - List nearbyEntities = (List) (List) Arrays.asList(arrow.getNearbyEntities(finalDistance, finalDistance, finalDistance).stream() - .filter(entity -> entity instanceof LivingEntity) - .filter(entity -> this.targets.stream().anyMatch(target -> target.matches(entity))) - .map(entity -> (LivingEntity) entity) - .filter(entity -> !entity.equals(player)) - .filter(entity -> !(entity instanceof Enderman)) - .filter(entity -> AntigriefManager.canInjure(player, entity)) - .filter(entity -> { - if (entity instanceof Player) { - return ((Player) entity).getGameMode().equals(GameMode.SURVIVAL) || ((Player) entity).getGameMode().equals(GameMode.ADVENTURE); - } - return true; - }).toArray()); - - if (nearbyEntities.isEmpty()) { - return; - } - - LivingEntity entity = nearbyEntities.get(0); - double dist = Double.MAX_VALUE; - - for (LivingEntity livingEntity : nearbyEntities) { - double currentDistance = livingEntity.getLocation().distance(arrow.getLocation()); - if (currentDistance >= dist) { - continue; - } - - dist = currentDistance; - entity = livingEntity; - } - if (entity != null) { - Vector vector = entity.getEyeLocation().toVector().clone().subtract(arrow.getLocation().toVector()).normalize(); - arrow.setVelocity(vector); - } - }); - - final int period = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "check-ticks"); - final int checks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "checks-per-level") * level; - AtomicInteger checksPerformed = new AtomicInteger(0); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - checksPerformed.addAndGet(1); - if (checksPerformed.get() > checks) { - bukkitRunnable.cancel(); - } - if (arrow.isDead() || arrow.isInBlock() || arrow.isOnGround()) { - bukkitRunnable.cancel(); - } - this.getPlugin().getScheduler().run(runnable); - }).runTaskTimer(3, period); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java deleted file mode 100644 index e2e3e8f9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Annihilate.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.util.VectorUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Annihilate extends EcoEnchant { - public Annihilate() { - super( - "annihilate", EnchantmentType.SPECIAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double baseMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-multiplier"); - Vector vector = attacker.getLocation().toVector().clone().subtract(victim.getLocation().toVector()).normalize().multiply(level * baseMultiplier).multiply(-1); - if (!VectorUtils.isFinite(vector)) { - return; - } - vector.setY(0.2); - if (!VectorUtils.isFinite(vector)) { - return; - } - victim.setVelocity(vector); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java deleted file mode 100644 index c2dd99dc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bladed.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Bladed extends EcoEnchant { - public Bladed() { - super( - "bladed", EnchantmentType.SPECIAL - ); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) { - return; - } - double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-multiplier"); - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = 1 + (multiplier * level) + baseDamage; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java deleted file mode 100644 index ae15875c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Bolt.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.util.LightningUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Bolt extends EcoEnchant { - public Bolt() { - super( - "bolt", EnchantmentType.SPECIAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - double damage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "lightning-damage"); - - boolean silent = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "local-lightning-sound"); - LightningUtils.strike(victim, damage, silent); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java deleted file mode 100644 index e8f25885..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Carve.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Carve extends EcoEnchant { - public Carve() { - super( - "carve", EnchantmentType.SPECIAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim.hasMetadata("cleaved")) { - return; - } - - double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-percentage-per-level") * 0.01; - double radiusPerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level"); - final double damage = damagePerLevel * level * event.getDamage(); - final double radius = radiusPerLevel * level; - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - victim.getNearbyEntities(radius, radius, radius).stream() - .filter(entity -> entity instanceof LivingEntity) - .filter(entity -> !entity.equals(attacker)) - .forEach(entity -> { - entity.setMetadata("cleaved", this.getPlugin().getMetadataValueFactory().create(true)); - this.getPlugin().getScheduler().run(() -> ((LivingEntity) entity).damage(damage, attacker)); - this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata("cleaved", this.getPlugin()), 20); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java deleted file mode 100644 index 127e8777..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Confusion.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class Confusion extends EcoEnchant { - public Confusion() { - super( - "confusion", EnchantmentType.SPECIAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Player victim)) { - return; - } - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - List hotbar = new ArrayList<>(); - for (int i = 0; i < 9; i++) { - hotbar.add(victim.getInventory().getItem(i)); - } - Collections.shuffle(hotbar); - int i2 = 0; - for (ItemStack item : hotbar) { - victim.getInventory().setItem(i2, item); - i2++; - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java deleted file mode 100644 index 37d1aacc..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Energizing.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Energizing extends EcoEnchant { - public Energizing() { - super( - "energizing", EnchantmentType.SPECIAL - ); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - int duration = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level") * level; - int amplifier = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "initial-level") + (level - 2); - - player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, duration, amplifier, true, true, true)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java deleted file mode 100644 index b7e8c0ae..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Force.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Force extends EcoEnchant { - public Force() { - super( - "force", EnchantmentType.SPECIAL - ); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) { - return; - } - double damage = event.getDamage(); - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double bonus = (multiplier * (level + 6)) + 1; - event.setDamage(damage * bonus); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java deleted file mode 100644 index 2c256781..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Frenzy.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Frenzy extends EcoEnchant { - public Frenzy() { - super( - "frenzy", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onFrenzyKill(@NotNull final EntityDeathEvent event) { - if (event.getEntity().getKiller() == null) { - return; - } - - Player player = event.getEntity().getKiller(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - int duration = (int) (level * 20 * this.getConfig().getDouble((EcoEnchants.CONFIG_LOCATION + "seconds-per-level"))); - - player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, duration, level, true, true, true)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java deleted file mode 100644 index 9d501fac..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Harpoon.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerFishEvent; -import org.jetbrains.annotations.NotNull; - -public class Harpoon extends EcoEnchant { - public Harpoon() { - super( - "harpoon", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onFish(@NotNull final PlayerFishEvent event) { - if (!event.getState().equals(PlayerFishEvent.State.CAUGHT_ENTITY)) { - return; - } - - if (!(event.getCaught() instanceof LivingEntity victim)) { - return; - } - - Player player = event.getPlayer(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (victim.hasMetadata("NPC")) { - return; - } - - if (!AntigriefManager.canInjure(player, victim)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - double damagePerLevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level"); - double damage = damagePerLevel * level; - victim.damage(damage, player); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java deleted file mode 100644 index 7adbb7ce..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Indestructibility.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerItemDamageEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Indestructibility extends EcoEnchant { - public Indestructibility() { - super( - "indestructibility", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onItemDamage(@NotNull final PlayerItemDamageEvent event) { - ItemStack item = event.getItem(); - - if (!EnchantChecks.item(item, this)) { - return; - } - - if (this.getDisabledWorlds().contains(event.getPlayer().getWorld())) { - return; - } - - if (!this.areRequirementsMet(event.getPlayer())) { - return; - } - - double level = EnchantChecks.getItemLevel(item, this); - double levelBonus = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "level-bonus"); - - if (NumberUtils.randFloat(0, 1) < (100 / (level + (1 + levelBonus)) / 100)) { - return; - } - - event.setCancelled(true); - event.setDamage(0); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java deleted file mode 100644 index 5288b445..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Instability.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -public class Instability extends EcoEnchant { - - private static final List toProtect = new ArrayList<>(); - - public Instability() { - super( - "instability", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onInstabilityExplode(@NotNull final EntityDamageEvent event) { - if (!toProtect.contains(event.getEntity())) { - return; - } - - if (event.getCause() != EntityDamageEvent.DamageCause.ENTITY_EXPLOSION && event.getCause() - != EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) { - return; - } - - event.setCancelled(true); - toProtect.remove(event.getEntity()); - } - - @EventHandler - public void onInstabilityLand(@NotNull final ProjectileHitEvent event) { - if (event.getEntityType() != EntityType.ARROW) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player player)) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!(event.getEntity() instanceof Arrow)) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - boolean fire = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire"); - boolean breakblocks = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "break-blocks"); - - float power = (float) (0.5 + (level * 0.5)); - - if (!AntigriefManager.canCreateExplosion(player, event.getEntity().getLocation())) { - return; - } - - if (breakblocks) { - breakblocks = AntigriefManager.canBreakBlock(player, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation())); - } - - List toAdd = event.getEntity().getNearbyEntities(power, power, power) - .stream().filter(entity -> entity instanceof LivingEntity && !AntigriefManager.canInjure(player, (LivingEntity) entity)) - .toList(); - - toProtect.addAll( - toAdd - ); - - this.getPlugin().getScheduler().runLater(() -> toProtect.removeAll(toAdd), 20); - - event.getEntity().getWorld().createExplosion(event.getEntity().getLocation().getX(), event.getEntity().getLocation().getY(), event.getEntity().getLocation().getZ(), power, fire, breakblocks); - - event.getEntity().remove(); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java deleted file mode 100644 index 2e2d7cd7..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Intellect.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.events.NaturalExpGainEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.inventory.InventoryType; -import org.jetbrains.annotations.NotNull; - -public class Intellect extends EcoEnchant { - public Intellect() { - super( - "intellect", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onExpChange(@NotNull final NaturalExpGainEvent event) { - Player player = event.getExpChangeEvent().getPlayer(); - - if (event.getExpChangeEvent().getAmount() < 0) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - if (level == 0) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (player.getOpenInventory().getTopInventory().getType() == InventoryType.GRINDSTONE) { - return; - } - - event.getExpChangeEvent().setAmount((int) Math.ceil(event.getExpChangeEvent().getAmount() * (1 + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "bonus-per-point"))))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java deleted file mode 100644 index 38a054c2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/LifeSteal.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class LifeSteal extends EcoEnchant { - public LifeSteal() { - super( - "life_steal", EnchantmentType.SPECIAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level"); - double amountToHeal = level * multiplier; - double newHealth = attacker.getHealth() + amountToHeal; - if (newHealth > attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - newHealth = attacker.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - attacker.setHealth(newHealth); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java deleted file mode 100644 index 074103c5..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Pentashot.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Pentashot extends EcoEnchant { - public Pentashot() { - super( - "pentashot", EnchantmentType.SPECIAL - ); - } - - @Override - public void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - int bonusPerSide = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "side-arrows-per-level") * level; - - if (shooter instanceof Player player) { - AnticheatManager.exemptPlayer(player); - } - - for (int i = -bonusPerSide; i <= bonusPerSide; i += 1) { - if (i == 0) { - continue; - } - - Vector velocity = event.getProjectile().getVelocity(); - - float radians = (float) ((float) i * Math.toRadians(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "angle"))); - velocity.rotateAroundY(radians); - - Arrow arrow1 = shooter.launchProjectile(Arrow.class, velocity); - if (EnchantChecks.mainhand(shooter, Enchantment.ARROW_FIRE)) { - arrow1.setFireTicks(Integer.MAX_VALUE); - } - arrow1.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED); - } - - if (shooter instanceof Player player) { - AnticheatManager.unexemptPlayer(player); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Preservation.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Preservation.java deleted file mode 100644 index 07fe41ad..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Preservation.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public class Preservation extends EcoEnchant { - public Preservation() { - super( - "preservation", EnchantmentType.SPECIAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-less-per-level"); - - double multiplier = 1 - ((reduction / 100) * level); - - event.setDamage(event.getDamage() * multiplier); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java deleted file mode 100644 index 5867e03c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Prosperity.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.attribute.Attribute; -import org.bukkit.attribute.AttributeInstance; -import org.bukkit.attribute.AttributeModifier; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.jetbrains.annotations.NotNull; - -import java.util.UUID; - -public class Prosperity extends EcoEnchant { - private final AttributeModifier modifier = new AttributeModifier(UUID.nameUUIDFromBytes("prosperity".getBytes()), this.getKey().getKey(), 1, AttributeModifier.Operation.ADD_NUMBER); - - public Prosperity() { - super( - "prosperity", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onArmorEquip(@NotNull final ArmorChangeEvent event) { - Player player = event.getPlayer(); - - if (!this.areRequirementsMet(player)) { - return; - } - - int points = EnchantChecks.getArmorPoints(player, this); - - AttributeInstance inst = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); - - assert inst != null; - - if (this.getDisabledWorlds().contains(player.getWorld())) { - points = 0; - } - - inst.removeModifier(modifier); - - if (points > 0) { - inst.addModifier( - new AttributeModifier( - UUID.nameUUIDFromBytes("prosperity".getBytes()), - this.getKey().getKey(), - this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "health-per-point") * points, - AttributeModifier.Operation.ADD_NUMBER - ) - ); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java deleted file mode 100644 index 97d2d617..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Razor.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Razor extends EcoEnchant { - public Razor() { - super( - "razor", EnchantmentType.SPECIAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (victim instanceof Player && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-players")) { - return; - } - double perLevelMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); - double baseDamage = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "base-damage"); - double extra = (level * perLevelMultiplier) + baseDamage; - if (this.getConfig().getBool((EcoEnchants.CONFIG_LOCATION) + "decrease-if-cooldown") && attacker instanceof Player) { - extra *= ((Player) attacker).getAttackCooldown(); - } - - event.setDamage(event.getDamage() + extra); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java deleted file mode 100644 index 20ab14bd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Repairing.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.TimedRunnable; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDropItemEvent; -import org.bukkit.event.entity.EntityPickupItemEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.Repairable; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Repairing extends EcoEnchant implements TimedRunnable { - private final Set players = new HashSet<>(); - private int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier"); - - public Repairing() { - super( - "repairing", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void onItemPickup(@NotNull final EntityPickupItemEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - refreshPlayer((Player) event.getEntity()); - } - - @EventHandler - public void onPlayerJoin(@NotNull final PlayerJoinEvent event) { - refresh(); - } - - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - refresh(); - } - - @EventHandler - public void onInventoryDrop(@NotNull final EntityDropItemEvent event) { - if (!(event.getEntity() instanceof Player)) { - return; - } - - refreshPlayer((Player) event.getEntity()); - } - - @EventHandler - public void onInventoryClick(@NotNull final InventoryClickEvent event) { - if (!(event.getWhoClicked() instanceof Player)) { - return; - } - refreshPlayer((Player) event.getWhoClicked()); - } - - private void refresh() { - players.clear(); - this.getPlugin().getScheduler().runLater(() -> this.getPlugin().getServer().getOnlinePlayers().forEach(player -> { - if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) { - if (this.areRequirementsMet(player)) { - players.add(player); - } - } - }), 1); - amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier"); - } - - private void refreshPlayer(@NotNull final Player player) { - players.remove(player); - if (Arrays.stream(player.getInventory().getContents()).parallel().anyMatch(item -> EnchantChecks.item(item, this))) { - if (this.areRequirementsMet(player)) { - players.add(player); - } - } - } - - @Override - public void run() { - players.forEach((player -> { - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - for (ItemStack item : player.getInventory().getContents()) { - int level = EnchantChecks.getItemLevel(item, this); - if (level == 0) { - continue; - } - - if (!(item.getItemMeta() instanceof Repairable)) { - continue; - } - - if (player.getInventory().getItemInMainHand().equals(item)) { - continue; - } - - if (player.getInventory().getItemInOffHand().equals(item)) { - continue; - } - - if (player.getItemOnCursor().equals(item)) { - continue; - } - - DurabilityUtils.repairItem(item, amount * level); - } - })); - } - - @Override - public long getTime() { - return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "repeat-ticks"); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java deleted file mode 100644 index 09615069..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Soulbound.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.NamespacedKey; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; -import org.jetbrains.annotations.NotNull; -import org.bukkit.entity.Arrow; - -import java.util.ArrayList; -import java.util.List; - -@SuppressWarnings("unchecked") -public class Soulbound extends EcoEnchant { - public Soulbound() { - super( - "soulbound", EnchantmentType.SPECIAL - ); - } - - @EventHandler(priority = EventPriority.LOW) - public void onSoulboundDeath(@NotNull final PlayerDeathEvent event) { - if (event.getKeepInventory()) { - return; - } - - Player player = event.getEntity(); - List soulboundItems = new ArrayList<>(); // Stored as list to preserve duplicates - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!(event.getEntity() instanceof Arrow)) { - if (player.getKiller() != null) { - Player killer = player.getKiller(); - int reaperLevel = EnchantChecks.getMainhandLevel(killer, EcoEnchants.REAPER); - if (reaperLevel > 0) { - if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) { - if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, reaperLevel)) { - return; - } - } - } - } - } - - for (ItemStack itemStack : player.getInventory().getContents()) { - if (itemStack == null) { - continue; - } - - if (itemStack.containsEnchantment(this)) { - soulboundItems.add(itemStack); - } - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "on-books")) { - if (itemStack.getItemMeta() instanceof EnchantmentStorageMeta && (((EnchantmentStorageMeta) itemStack.getItemMeta()).getStoredEnchants().containsKey(this))) { - soulboundItems.add(itemStack); - } - } - } - - event.getDrops().removeAll(soulboundItems); - - for (ItemStack itemStack : soulboundItems) { - ItemMeta meta = itemStack.getItemMeta(); - assert meta != null; - PersistentDataContainer container = meta.getPersistentDataContainer(); - container.set(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER, 1); - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "remove-after")) { - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "on-books")) { - if (meta instanceof EnchantmentStorageMeta) { - ((EnchantmentStorageMeta) meta).removeStoredEnchant(this); - } - } - meta.removeEnchant(this); - } - - itemStack.setItemMeta(meta); - } - - player.setMetadata("soulbound-items", this.getPlugin().getMetadataValueFactory().create(soulboundItems)); - } - - public boolean hasSoulboundItems(@NotNull final Player player) { - final NamespacedKey soulbound = this.getPlugin().getNamespacedKeyFactory().create("soulbound"); - for (ItemStack itemStack : player.getInventory().getContents()) { - if (itemStack != null && itemStack.getItemMeta().getPersistentDataContainer().has(soulbound, PersistentDataType.INTEGER)) { - return false; - } - } - return true; - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onSoulboundRespawn(@NotNull final PlayerRespawnEvent event) { - Player player = event.getPlayer(); - - this.getPlugin().getScheduler().run(() -> { - if (!hasSoulboundItems(player)) { - return; - } - - if (!player.hasMetadata("soulbound-items")) { - return; - } - - List soulboundItems = (List) player.getMetadata("soulbound-items").get(0).value(); - - if (soulboundItems == null) { - player.removeMetadata("soulbound-items", this.getPlugin()); - return; - } - - for (ItemStack soulboundItem : soulboundItems) { - player.getInventory().remove(soulboundItem); - - ItemMeta meta = soulboundItem.getItemMeta(); - assert meta != null; - meta.getPersistentDataContainer().remove(this.getPlugin().getNamespacedKeyFactory().create("soulbound")); - soulboundItem.setItemMeta(meta); - player.getInventory().addItem(soulboundItem); - } - - player.removeMetadata("soulbound-items", this.getPlugin()); - }); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onDeath(@NotNull final PlayerDeathEvent event) { - final NamespacedKey soulbound = this.getPlugin().getNamespacedKeyFactory().create("soulbound"); - event.getDrops().removeIf(itemStack -> itemStack.getItemMeta().getPersistentDataContainer().has(soulbound, PersistentDataType.INTEGER)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.java deleted file mode 100644 index 5a009d16..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Spring.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.jetbrains.annotations.NotNull; - -public class Spring extends EcoEnchant { - public Spring() { - super( - "spring", EnchantmentType.SPECIAL - ); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (event.getCause() == EntityDamageEvent.DamageCause.FALL) { - event.setCancelled(true); - } - } - - @Override - public void onJump(@NotNull final Player player, - final int level, - @NotNull final PlayerMoveEvent event) { - if (player.isSneaking() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "disable-on-sneak")) { - return; - } - AnticheatManager.exemptPlayer(player); - - double multiplier = 0.5 + ((double) (level * level) / 4 - 0.2) / 3; - player.setVelocity(player.getLocation().getDirection().multiply(multiplier).setY(multiplier)); - - this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), 100); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java deleted file mode 100644 index d0b49c9a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Streamlining.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Streamlining extends EcoEnchant { - public Streamlining() { - super( - "streamlining", EnchantmentType.SPECIAL - ); - } - - @Override - public void onArmorEquip(@NotNull final Player player, - final int level, - @NotNull final ArmorChangeEvent event) { - if (level == 0) { - player.setWalkSpeed(0.2f); - return; - } - - player.setWalkSpeed((float) (0.2f + (level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "speed-per-level")))); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java deleted file mode 100644 index 60d9e4b8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/special/Volatile.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.special; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Location; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Volatile extends EcoEnchant { - public Volatile() { - super( - "volatile", EnchantmentType.SPECIAL - ); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity uncastAttacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastAttacker instanceof Player attacker)) { - return; - } - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - boolean fire = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire"); - boolean breakblocks = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "break-blocks"); - - float power = (float) (0.5 + (level * 0.5)); - - if (!AntigriefManager.canCreateExplosion(attacker, event.getEntity().getLocation())) { - return; - } - - if (breakblocks && !AntigriefManager.canBreakBlock(attacker, event.getEntity().getLocation().getWorld().getBlockAt(event.getEntity().getLocation()))) { - return; - } - - Location explosionLoc = victim.getEyeLocation(); - - victim.getWorld().createExplosion(explosionLoc, power, fire, breakblocks); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Ascend.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Ascend.java deleted file mode 100644 index 680d7a7f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Ascend.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public class Ascend extends Spell { - private static final String IGNORE_FALL_KEY = "ignore-fall-damage"; - - public Ascend() { - super("ascend"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-per-level") * level; - player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, ticks, this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "power") - 1, false, false)); - player.setMetadata(IGNORE_FALL_KEY, this.getPlugin().getMetadataValueFactory().create(true)); - this.getPlugin().getScheduler().runLater(() -> player.removeMetadata(IGNORE_FALL_KEY, this.getPlugin()), ticks * 4L); - - return true; - } - - @EventHandler - public void onFallDamage(@NotNull final EntityDamageEvent event) { - if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) { - return; - } - - if (!event.getEntity().hasMetadata(IGNORE_FALL_KEY)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java deleted file mode 100644 index d677d235..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Charge.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Charge extends Spell { - public Charge() { - super("charge"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - AnticheatManager.exemptPlayer(player); - - Vector velocity = player.getEyeLocation().getDirection().clone(); - velocity.normalize(); - velocity.multiply(level * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity-per-level")); - velocity.setY(player.getEyeLocation().getDirection().clone().getY() + 0.2); - player.setVelocity(safenVector(velocity)); - - this.getPlugin().getScheduler().runLater(() -> AnticheatManager.unexemptPlayer(player), 10); - - return true; - } - - private Vector safenVector(@NotNull final Vector vector) { - if (Math.abs(vector.getX()) > 4) { - vector.setX(vector.getX() < 0 ? -3.9 : 3.9); - } - - if (Math.abs(vector.getY()) > 4) { - vector.setY(vector.getY() < 0 ? -3.9 : 3.9); - } - - if (Math.abs(vector.getZ()) > 4) { - vector.setZ(vector.getZ() < 0 ? -3.9 : 3.9); - } - - return vector; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java deleted file mode 100644 index f7f34a47..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Dynamite.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.eco.core.integrations.anticheat.AnticheatManager; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.Particle; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -public class Dynamite extends Spell { - public Dynamite() { - super("dynamite"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - Block block = event.getClickedBlock(); - - if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { - return false; - } - - if (block == null) { - return false; - } - - if (block.hasMetadata("block-ignore")) { - return false; - } - - AnticheatManager.exemptPlayer(player); - - Set toBreak = new HashSet<>(); - - int baseDiff = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "base-bonus"); - int bonusPerLevel = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "per-level-bonus"); - final int size = baseDiff + (bonusPerLevel * (level - 1)); - - - for (int x = -size; x <= size; x++) { - for (int y = -size; y <= size; y++) { - for (int z = -size; z <= size; z++) { - if (x == 0 && y == 0 && z == 0) { - block.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, block.getLocation().clone().add(0.5, 0.5, 0.5), 1); - } - Block block1 = block.getWorld().getBlockAt(block.getLocation().clone().add(x, y, z)); - - if (this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blacklisted-blocks").contains(block1.getType().name().toLowerCase())) { - continue; - } - - if (block1.getType().getHardness() > block.getType().getHardness() && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "hardness-check")) { - continue; - } - - if (!AntigriefManager.canBreakBlock(player, block1)) { - continue; - } - - toBreak.add(block1); - } - } - } - - EnchantmentUtils.rehandleBreaking(player, toBreak, this.getPlugin()); - - AnticheatManager.unexemptPlayer(player); - - return true; - } - - @Override - protected boolean requiresBlockClick() { - return true; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java deleted file mode 100644 index 7a5aa3d9..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Missile.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.entity.Player; -import org.bukkit.entity.WitherSkull; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.jetbrains.annotations.NotNull; - -public class Missile extends Spell { - public Missile() { - super("missile"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - WitherSkull skull = player.launchProjectile(WitherSkull.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity"))); - skull.setCharged(true); - skull.setIsIncendiary(false); - skull.setMetadata("eco-damage", this.getPlugin().getMetadataValueFactory().create(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level)); - skull.setMetadata("nobreak", this.getPlugin().getMetadataValueFactory().create(true)); - skull.setShooter(player); - - return true; - } - - @EventHandler(priority = EventPriority.LOW) - public void onWitherSkullDamage(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof WitherSkull)) { - return; - } - - if (event.getDamager().getMetadata("eco-damage").isEmpty()) { - return; - } - - double multiplier = event.getDamager().getMetadata("eco-damage").get(0).asDouble(); - - if (((WitherSkull) event.getDamager()).getShooter().equals(event.getEntity())) { - event.setCancelled(true); - } - - event.setDamage(multiplier); - } - - @EventHandler - public void onWitherSkullExplode(@NotNull final EntityExplodeEvent event) { - if (!(event.getEntity() instanceof WitherSkull)) { - return; - } - - if (event.getEntity().getMetadata("nobreak").isEmpty()) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Quake.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Quake.java deleted file mode 100644 index 382f3d2d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Quake.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; -import org.jetbrains.annotations.NotNull; - -import java.util.Collection; - -public class Quake extends Spell { - public Quake() { - super("quake"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - int radius = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "radius-per-level") * level; - int damage = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level; - - - Collection entities = player.getWorld().getNearbyEntities(player.getLocation(), radius, 3, radius); - - for (Entity entity : entities) { - if (entity.equals(player)) { - continue; - } - if (!(entity instanceof LivingEntity)) { - continue; - } - if (!AntigriefManager.canInjure(player, (LivingEntity) entity)) { - continue; - } - - ((LivingEntity) entity).damage(damage); - } - - return true; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java deleted file mode 100644 index 887b6df8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/spell/Vitalize.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.enchantments.ecoenchants.spell; - -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.Location; -import org.bukkit.Particle; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; -import org.jetbrains.annotations.NotNull; - -public class Vitalize extends Spell { - public Vitalize() { - super("vitalize"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "spawn-heart-particles")) { - spawnParticles(player); - } - - return true; - } - - private void spawnParticles(@NotNull final Player player) { - Location location = player.getLocation().clone(); - - location.add(0, 1, 0); - - int limit = NumberUtils.randInt(8, 13); - - for (int i = 0; i < limit; i++) { - Location spawnLoc = location.clone(); - spawnLoc.add( - NumberUtils.randFloat(-1.2, 1.2), - NumberUtils.randFloat(-0.3, 1.2), - NumberUtils.randFloat(-1.2, 1.2) - ); - - spawnLoc.getWorld().spawnParticle( - Particle.HEART, - spawnLoc, - 1 - ); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java deleted file mode 100644 index b0e40957..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Artifact.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.willfp.ecoenchants.enchantments.itemtypes; - -import com.google.common.util.concurrent.AtomicDouble; -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.Location; -import org.bukkit.Particle; -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.HandlerList; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public abstract class Artifact extends EcoEnchant { - /** - * The artifact particle. - */ - private Particle particle; - - /** - * The extra particle dust options. - *

- * Used for redstone particles. - */ - @Nullable - private Object extra; - - /** - * Create a new artifact enchantment. - * - * @param key The key name of the enchantment - * @param prerequisites Optional {@link Prerequisite}s that must be met - */ - protected Artifact(@NotNull final String key, - @NotNull final Prerequisite... prerequisites) { - super(key, EnchantmentType.ARTIFACT, prerequisites); - - if (!Prerequisite.areMet(prerequisites)) { - HandlerList.unregisterAll(this); // Prevent events firing - return; - } - - this.particle = this.getParticle(); - this.extra = this.getDustOptions(); - } - - /** - * Get the artifact particle. - * - * @return The artifact particle. - */ - @NotNull - public abstract Particle getParticle(); - - /** - * The extra particle dust options. - * - * @return The dust options. - */ - @Nullable - public Object getDustOptions() { - return null; - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (!this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "on-blocks").contains(block.getType().name().toLowerCase())) { - return; - } - - int amount = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "amount"); - block.getWorld().spawnParticle(particle, block.getLocation().add(0.5, 0.5, 0.5), amount, 0.4, 0.4, 0.4, 0, extra, false); - } - - /** - * Called on player fly while wearing an elytra. - * - * @param event The event to listen for. - */ - @EventHandler - public void onElytra(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (!player.isGliding()) { - return; - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.chestplate(player, this)) { - return; - } - - this.getPlugin().getScheduler().runAsync(() -> { - Vector point1 = player.getLocation().getDirection().clone(); - point1.rotateAroundY(Math.toRadians(90)); - point1.multiply(1.2); - Location location1 = player.getLocation().clone().add(point1); - - Vector point2 = player.getLocation().getDirection().clone(); - point2.rotateAroundY(Math.toRadians(-90)); - point2.multiply(1.2); - Location location2 = player.getLocation().clone().add(point2); - - player.getWorld().spawnParticle(particle, location1, 1, 0, 0, 0, 0, extra, true); - player.getWorld().spawnParticle(particle, location2, 1, 0, 0, 0, 0, extra, true); - }); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - double radius = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius"); - - AtomicDouble yAtomic = new AtomicDouble(0); - - double yDelta = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "y-delta"); - double radiusMultiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-multiplier"); - double offset = NumberUtils.randFloat(0, 0.75); - - boolean doubleHelix = this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "use-double-helix"); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - for (int i = 0; i < 3; i++) { - if (yAtomic.get() > victim.getHeight()) { - bukkitRunnable.cancel(); - } - yAtomic.addAndGet(yDelta); - double y = yAtomic.get(); - double x = radius * NumberUtils.fastCos((y + offset) * radiusMultiplier); - double z = radius * NumberUtils.fastSin((y + offset) * radiusMultiplier); - Location particleLocation = victim.getLocation(); - particleLocation.add(x, y, z); - victim.getWorld().spawnParticle(particle, particleLocation, 1, 0, 0, 0, 0, extra, false); - if (doubleHelix) { - Location particleLocation2 = victim.getLocation(); - particleLocation2.add(-x, y, -z); - victim.getWorld().spawnParticle(particle, particleLocation2, 1, 0, 0, 0, 0, extra, false); - } - } - }).runTaskTimerAsynchronously(0, 1); - } - - @Override - public void onProjectileLaunch(@NotNull final LivingEntity shooter, - @NotNull final Projectile projectile, - final int level, - @NotNull final ProjectileLaunchEvent event) { - int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "particle-tick-delay"); - - int noteColor; - AtomicDouble color = new AtomicDouble(0); - if (particle.equals(Particle.NOTE)) { - noteColor = NumberUtils.randInt(0, 24); - color.set((double) noteColor / 24); - } - final double finalColor = color.get(); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - if (projectile.isOnGround() || projectile.isDead()) { - bukkitRunnable.cancel(); - } - projectile.getLocation().getWorld().spawnParticle(particle, projectile.getLocation(), 1, 0, 0, 0, finalColor, extra, true); - }).runTaskTimerAsynchronously(4, ticks); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java deleted file mode 100644 index e1df8f6a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.willfp.ecoenchants.enchantments.itemtypes; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -import com.willfp.eco.core.placeholder.PlayerPlaceholder; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.display.EnchantmentCache; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.SpellActivateEvent; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.SoundCategory; -import org.bukkit.Tag; -import org.bukkit.block.Container; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.BlockInventoryHolder; -import org.bukkit.permissions.PermissionAttachmentInfo; -import org.bukkit.util.NumberConversions; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -@SuppressWarnings("deprecation") -public abstract class Spell extends EcoEnchant { - /** - * Items that must be left-clicked to activate spells for. - */ - private static final List LEFT_CLICK_ITEMS = Arrays.asList( - Material.FISHING_ROD, - Material.BOW, - Material.CROSSBOW, - Material.TRIDENT - ); - - /** - * Items that don't cause spells to activate when right clicked. - */ - private static final List BLACKLIST_CLICKED_BLOCKS = new ArrayList<>(Arrays.asList( - Material.CRAFTING_TABLE, - Material.GRINDSTONE, - Material.ENCHANTING_TABLE, - Material.FURNACE, - Material.SMITHING_TABLE, - Material.LEVER, - Material.REPEATER, - Material.COMPARATOR, - Material.RESPAWN_ANCHOR, - Material.NOTE_BLOCK, - Material.ITEM_FRAME, - Material.CHEST, - Material.BARREL, - Material.BEACON, - Material.LECTERN, - Material.FLETCHING_TABLE, - Material.SMITHING_TABLE, - Material.STONECUTTER, - Material.SMOKER, - Material.BLAST_FURNACE, - Material.BREWING_STAND, - Material.DISPENSER, - Material.DROPPER, - Material.FIRE - )); - - static { - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.BUTTONS.getValues()); - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.BEDS.getValues()); - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.DOORS.getValues()); - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.FENCE_GATES.getValues()); - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.TRAPDOORS.getValues()); - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.ANVIL.getValues()); - BLACKLIST_CLICKED_BLOCKS.addAll(Tag.SHULKER_BOXES.getValues()); - } - - /** - * The cooldown end times linked to players. - */ - private final Map tracker = new HashMap<>(); - /** - * Players currently running spells - prevents listener firing twice. - */ - private final Set preventDuplicateList = new HashSet<>(); - - /** - * Create a new spell enchantment. - * - * @param key The key name of the enchantment - * @param prerequisites Optional {@link Prerequisite}s that must be met - */ - protected Spell(@NotNull final String key, - @NotNull final Prerequisite... prerequisites) { - super(key, EnchantmentType.SPELL, prerequisites); - - PlaceholderManager.registerPlaceholder( - new PlayerPlaceholder( - this.getPlugin(), - this.getPermissionName() + "_" + "cooldown", - player -> StringUtils.toNiceString(getCooldown(this, player)) - ) - ); - } - - /** - * Utility method to get a player's cooldown time of a specific spell. - * - * @param spell The spell to query. - * @param player The player to query. - * @return The time left in seconds before next use. - */ - public static int getCooldown(@NotNull final Spell spell, - @NotNull final Player player) { - if (!spell.tracker.containsKey(player.getUniqueId())) { - return 0; - } - - long msLeft = spell.tracker.get(player.getUniqueId()) - System.currentTimeMillis(); - - long secondsLeft = (long) Math.ceil((double) msLeft / 1000); - - return NumberConversions.toInt(secondsLeft); - } - - /** - * Get a multiplier for a spell cooldown. - *

- * Used for perks.. - * - * @param player The player to query. - * @return The multiplier. - */ - public static double getCooldownMultiplier(@NotNull final Player player) { - if (player.hasPermission("ecoenchants.cooldowntime.quarter")) { - return 0.25; - } - - if (player.hasPermission("ecoenchants.cooldowntime.third")) { - return 0.33; - } - - if (player.hasPermission("ecoenchants.cooldowntime.half")) { - return 0.5; - } - - if (player.hasPermission("ecoenchants.cooldowntime.75")) { - return 0.75; - } - - String prefix = "ecoenchants.cooldowntime."; - for (PermissionAttachmentInfo permissionAttachmentInfo : player.getEffectivePermissions()) { - String permission = permissionAttachmentInfo.getPermission(); - if (permission.startsWith(prefix)) { - try { - return Double.parseDouble(permission.substring(permission.lastIndexOf(".") + 1)) / 100; - } catch (NumberFormatException e) { - return 1; - } - } - } - - return 1; - } - - /** - * Get the cooldown time of the spell (in seconds). - * - * @return The time, in seconds. - */ - public int getCooldownTime() { - return this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "cooldown"); - } - - /** - * Get the sound to be played on activation. - * - * @return The sound. - */ - public final Sound getActivationSound() { - return Sound.valueOf(this.getConfig().getString(EcoEnchants.CONFIG_LOCATION + "activation-sound").toUpperCase()); - } - - /** - * Listener called on spell activation. - * - * @param event The event to listen for. - */ - @EventHandler - public void onUseEventHandler(@NotNull final PlayerInteractEvent event) { - Player player = event.getPlayer(); - - if (preventDuplicateList.contains(player.getUniqueId())) { - return; - } - preventDuplicateList.add(player.getUniqueId()); - this.getPlugin().getScheduler().runLater(() -> preventDuplicateList.remove(player.getUniqueId()), 2); - - if (player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (LEFT_CLICK_ITEMS.contains(player.getInventory().getItemInMainHand().getType())) { - if (!(event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK))) { - return; - } - if (requiresBlockClick() && !event.getAction().equals(Action.LEFT_CLICK_BLOCK)) { - return; - } - } else { - if (!(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK))) { - return; - } - if (requiresBlockClick() && !event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { - return; - } - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int cooldown = getCooldown(this, player); - - if (event.getClickedBlock() != null) { - if (event.getClickedBlock().getState() instanceof Container - || event.getClickedBlock().getState() instanceof BlockInventoryHolder - || BLACKLIST_CLICKED_BLOCKS.contains(event.getClickedBlock().getType())) { - return; - } - } - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "not-while-sneaking")) { - if (player.isSneaking()) { - return; - } - } - - if (!this.areRequirementsMet(player)) { - return; - } - - if (cooldown > 0) { - if (!this.hasFlag("no-cooldown-message")) { - if (this.getPlugin().getConfigYml().getBool("types.special.cooldown-in-actionbar")) { - String message = this.getPlugin().getLangYml().getFormattedString("messages.on-cooldown") - .replace("%seconds%", String.valueOf(cooldown)) - .replace("%name%", EnchantmentCache.getEntry(this).getRawName()); - - player.spigot().sendMessage( - ChatMessageType.ACTION_BAR, - TextComponent.fromLegacyText(message) - ); - } else { - String message = this.getPlugin().getLangYml().getMessage("on-cooldown") - .replace("%seconds%", String.valueOf(cooldown)) - .replace("%name%", EnchantmentCache.getEntry(this).getRawName()); - player.sendMessage(message); - } - player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 0.5f); - } - } else { - SpellActivateEvent spellActivateEvent = new SpellActivateEvent(player, this); - Bukkit.getPluginManager().callEvent(spellActivateEvent); - - if (!spellActivateEvent.isCancelled()) { - if (onUse(player, level, event)) { - if (!this.hasFlag("no-use-message")) { - String message = this.getPlugin().getLangYml().getMessage("used-spell").replace("%name%", EnchantmentCache.getEntry(this).getRawName()); - player.sendMessage(message); - player.playSound(player.getLocation(), this.getActivationSound(), SoundCategory.PLAYERS, 1, 1); - } - - tracker.remove(player.getUniqueId()); - tracker.put(player.getUniqueId(), System.currentTimeMillis() + (long) ((this.getCooldownTime() * 1000L) * Spell.getCooldownMultiplier(player))); - } - } - } - } - - /** - * Get if the spell requires a block to be clicked to trigger the spell. - * - * @return If the spell requires a block to be clicked. - */ - protected boolean requiresBlockClick() { - return false; - } - - /** - * Actual spell-specific implementations; the functionality. - * - * @param player The player who triggered the spell. - * @param level The level of the spell on the item. - * @param event The event that activated the spell. - * @return If the spell should be activated. - */ - public abstract boolean onUse(@NotNull Player player, - int level, - @NotNull PlayerInteractEvent event); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java deleted file mode 100644 index bc5b8229..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentRarity.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.willfp.ecoenchants.enchantments.meta; - -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.config.RarityYml; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; - -public class EnchantmentRarity { - /** - * All registered rarities. - */ - private static final Set REGISTERED = new HashSet<>(); - - static { - update(EcoEnchantsPlugin.getInstance()); - } - - /** - * The name of the rarity. - */ - @Getter - private final String name; - /** - * The probability of getting an enchantment with this rarity from an enchanting table. - */ - @Getter - private final double tableProbability; - /** - * The minimum xp level to get an enchantment of this rarity from an enchanting table. - */ - @Getter - private final int minimumLevel; - /** - * The probability of a villager obtaining an enchantment with this rarity. - */ - @Getter - private final double villagerProbability; - /** - * The probability of an item in a loot chest having an enchantment with this rarity. - */ - @Getter - private final double lootProbability; - /** - * The custom display color, or null if not enabled. - */ - @Getter - private final String customColor; - - /** - * Create new EnchantmentRarity. - * - * @param name The name of the rarity - * @param tableProbability The probability of getting an enchantment with this rarity from an enchanting table. - * @param minimumLevel The minimum xp level - * @param villagerProbability The probability of a villager obtaining an enchantment with this rarity - * @param lootProbability The probability of an item in a loot chest having an enchantment with this rarity - * @param customColor The custom display color, or null if not enabled - */ - public EnchantmentRarity(@NotNull final String name, - final double tableProbability, - final int minimumLevel, - final double villagerProbability, - final double lootProbability, - @Nullable final String customColor) { - this.name = name; - this.tableProbability = tableProbability; - this.minimumLevel = minimumLevel; - this.villagerProbability = villagerProbability; - this.lootProbability = lootProbability; - this.customColor = customColor; - } - - /** - * Get EnchantmentRarity matching name. - * - * @param name The name to search for. - * @return The matching EnchantmentRarity, or null if not found. - */ - public static EnchantmentRarity getByName(@NotNull final String name) { - Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst(); - return matching.orElse(null); - } - - /** - * Update all rarities. - * - * @param plugin Instance of EcoEnchants. - */ - @ConfigUpdater - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - RarityYml rarityYml = plugin.getRarityYml(); - List raritiesNames = rarityYml.getRarities(); - raritiesNames.forEach(rarity -> { - double probability = rarityYml.getDouble("rarities." + rarity + ".table-probability"); - int minimumLevel = rarityYml.getInt("rarities." + rarity + ".minimum-level"); - double villagerProbability = rarityYml.getDouble("rarities." + rarity + ".villager-probability"); - double lootProbability = rarityYml.getDouble("rarities." + rarity + ".loot-probability"); - String customColor = null; - if (rarityYml.getBool("rarities." + rarity + ".custom-color.enabled")) { - customColor = rarityYml.getString("rarities." + rarity + ".custom-color.color"); - } - - new EnchantmentRarity(rarity, probability, minimumLevel, villagerProbability, lootProbability, customColor).register(); - }); - } - - /** - * Get all rarities. - * - * @return A set of all rarities. - */ - public static Set values() { - return REGISTERED; - } - - /** - * Register rarity. - */ - private void register() { - Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst(); - matching.ifPresent(REGISTERED::remove); - - REGISTERED.add(this); - } - - /** - * Is custom color enabled. - * - * @return If has enabled custom color. - */ - public boolean hasCustomColor() { - return this.customColor != null; - } - - @Override - public boolean equals(@NotNull final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof EnchantmentRarity that)) { - return false; - } - return Objects.equals(getName(), that.getName()); - } - - @Override - public int hashCode() { - return Objects.hash(getName()); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java deleted file mode 100644 index c3835b62..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentTarget.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.willfp.ecoenchants.enchantments.meta; - -import com.google.common.collect.ImmutableSet; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import lombok.Getter; -import org.bukkit.Material; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; - -public class EnchantmentTarget { - /** - * Target containing the materials from all other targets. - */ - public static final EnchantmentTarget ALL = new EnchantmentTarget("all", new HashSet<>(), Slot.ANY); - /** - * All registered targets. - */ - private static final Set REGISTERED = new HashSet<>(); - - static { - REGISTERED.add(ALL); - update(EcoEnchantsPlugin.getInstance()); - } - - /** - * The name of the target. - */ - @Getter - private final String name; - - /** - * The materials of the target. - */ - @Getter - private final Set materials; - - /** - * The slot to check for custom enchants. - */ - @Getter - private final Slot slot; - - /** - * Create new rarity. - * - * @param name The name of the rarity - * @param materials The items for the target - */ - public EnchantmentTarget(@NotNull final String name, - @NotNull final Set materials, - @NotNull final Slot slot) { - this.name = name; - materials.removeIf(Objects::isNull); - this.materials = materials; - this.slot = slot; - } - - /** - * Get EnchantmentTarget matching name. - * - * @param name The name to search for. - * @return The matching EnchantmentTarget, or null if not found. - */ - public static EnchantmentTarget getByName(@NotNull final String name) { - Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst(); - return matching.orElse(null); - } - - /** - * Update all targets. - * - * @param plugin Instance of EcoEnchants. - */ - @ConfigUpdater - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - List targetNames = plugin.getTargetYml().getTargets(); - ALL.materials.clear(); - targetNames.forEach(name -> { - Set materials = plugin.getTargetYml().getTargetMaterials(name); - new EnchantmentTarget(name, materials, plugin.getTargetYml().getSlot(name)).register(); - }); - } - - /** - * Get all rarities. - * - * @return A set of all rarities. - */ - public static Set values() { - return ImmutableSet.copyOf(REGISTERED); - } - - private void register() { - Optional matching = REGISTERED.stream().filter(rarity -> rarity.getName().equalsIgnoreCase(name)).findFirst(); - matching.ifPresent(REGISTERED::remove); - matching.ifPresent(enchantmentTarget -> ALL.getMaterials().removeAll(enchantmentTarget.getMaterials())); - REGISTERED.add(this); - ALL.getMaterials().addAll(this.getMaterials()); - } - - /** - * Enchant slots. - */ - public enum Slot { - /** - * In hands. - */ - HANDS, - - /** - * In armor. - */ - ARMOR, - - /** - * In inventory. - */ - ANY - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java deleted file mode 100644 index 02d2ef0e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/meta/EnchantmentType.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.willfp.ecoenchants.enchantments.meta; - -import com.google.common.collect.ImmutableList; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import lombok.Getter; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Supplier; - -public class EnchantmentType { - /** - * Instance of EcoEnchants. - */ - private static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance(); - - /** - * All registered types. - */ - private static final List REGISTERED = new ArrayList<>(); - - /** - * Most enchantments are like this. - *

- * eg: Arachnid, Telekinesis, Sharpness. - */ - public static final EnchantmentType NORMAL = new EnchantmentType( - "normal", - false, - () -> PLUGIN.getLangYml().getString("normal-color") - ); - - /** - * Negative enchantments. - *

- * eg: Curse of Decay, Curse of Vanishing. - */ - public static final EnchantmentType CURSE = new EnchantmentType( - "curse", - false, - () -> PLUGIN.getLangYml().getString("curse-color") - ); - - /** - * Extremely powerful enchantments. - *

- * eg: Razor, Force. - */ - public static final EnchantmentType SPECIAL = new EnchantmentType( - "special", - () -> !PLUGIN.getConfigYml().getBool("types.special.allow-multiple"), - () -> PLUGIN.getLangYml().getString("special-color") - ); - - /** - * Cosmetic enchantments. - *

- * eg: Ash Artifact, Totem Artifact. - */ - public static final EnchantmentType ARTIFACT = new EnchantmentType( - "artifact", - () -> !PLUGIN.getConfigYml().getBool("types.artifact.allow-multiple"), - () -> PLUGIN.getLangYml().getString("artifact-color"), - Artifact.class - ); - - /** - * Ability enchantments. - *

- * eg: Missile, Quake. - */ - public static final EnchantmentType SPELL = new EnchantmentType( - "spell", - true, - () -> PLUGIN.getLangYml().getString("spell-color"), - Spell.class - ); - - /** - * Lambda to fetch the color of the type. - */ - private final Supplier colorSupplier; - - /** - * Lambda to fetch the singularity of the type. - */ - private final Supplier singularSupplier; - - /** - * The name of the type. - */ - @Getter - private final String name; - - /** - * The class that all enchantments of this type must extend. - *

- * Null if not required. - */ - @Getter - @Nullable - private final Class requiredToExtend; - - /** - * If only one enchantment of this type is allowed on an item. - */ - @Getter - private boolean singular; - - /** - * The color of enchantments of this type to have in lore. - */ - @Getter - private String color; - - /** - * Create simple EnchantmentType. - *

- * Singularity and Color will not be updated using this constructor. - * - * @param name The name of the type. - * @param singular Whether an item can have several enchantments of this type. - * @param color The color for enchantments with this type in lore to have. - */ - public EnchantmentType(@NotNull final String name, - final boolean singular, - @NotNull final String color) { - this(name, () -> singular, () -> color); - } - - /** - * Create EnchantmentType with updatable color. - *

- * Singularity will not be updated using this constructor. - * - * @param name The name of the type. - * @param singular Whether an item can have several enchantments of this type. - * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload. - */ - public EnchantmentType(@NotNull final String name, - final boolean singular, - @NotNull final Supplier colorSupplier) { - this(name, () -> singular, colorSupplier); - } - - /** - * Create EnchantmentType with updatable color that must extend a specified class. - *

- * Singularity will not be updated using this constructor. - * - * @param name The name of the type. - * @param singular Whether an item can have several enchantments of this type. - * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload. - * @param requiredToExtend Class that all enchantments of this type must extend - or null if not required. - */ - public EnchantmentType(@NotNull final String name, - final boolean singular, - @NotNull final Supplier colorSupplier, - @Nullable final Class requiredToExtend) { - this(name, () -> singular, colorSupplier, requiredToExtend); - } - - /** - * Create EnchantmentType with updatable color and singularity. - * - * @param name The name of the type. - * @param singularSupplier Lambda to fetch whether an item can have several enchantments of this type. Updates on /ecoreload. - * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload. - */ - public EnchantmentType(@NotNull final String name, - @NotNull final Supplier singularSupplier, - @NotNull final Supplier colorSupplier) { - this(name, singularSupplier, colorSupplier, null); - } - - /** - * Create EnchantmentType with updatable color and singularity that must extend a specified class. - * - * @param name The name of the type. - * @param singularSupplier Lambda to fetch whether an item can have several enchantments of this type. Updates on /ecoreload. - * @param colorSupplier Lambda to fetch the color of enchantments with this type to have. Updates on /ecoreload. - * @param requiredToExtend Class that all enchantments of this type must extend - or null if not required. - */ - public EnchantmentType(@NotNull final String name, - @NotNull final Supplier singularSupplier, - @NotNull final Supplier colorSupplier, - @Nullable final Class requiredToExtend) { - this.name = name; - this.singularSupplier = singularSupplier; - this.colorSupplier = colorSupplier; - this.requiredToExtend = requiredToExtend; - color = colorSupplier.get(); - singular = singularSupplier.get(); - REGISTERED.add(this); - } - - /** - * Get EnchantmentType matching name. - * - * @param name The name to search for. - * @return The matching EnchantmentType, or null if not found. - */ - public static EnchantmentType getByName(@NotNull final String name) { - Optional matching = REGISTERED.stream().filter(enchantmentType -> enchantmentType.getName().equalsIgnoreCase(name)).findFirst(); - return matching.orElse(null); - } - - /** - * Update suppliers of all types. - */ - @ConfigUpdater - public static void update() { - REGISTERED.forEach(EnchantmentType::refresh); - } - - /** - * All registered enchantment types. - * - * @return All registered types. - */ - public static List values() { - return ImmutableList.copyOf(REGISTERED); - } - - private void refresh() { - this.color = colorSupplier.get(); - this.singular = singularSupplier.get(); - } - - @Override - public boolean equals(@NotNull final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof EnchantmentType that)) { - return false; - } - return Objects.equals(getName(), that.getName()); - } - - @Override - public int hashCode() { - return Objects.hash(getName()); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java deleted file mode 100644 index 8d1dd192..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilListeners.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.anvil; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.core.proxy.ProxyConstants; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy; -import org.bukkit.Material; -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.inventory.PrepareAnvilEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -public class AnvilListeners extends PluginDependent implements Listener { - /** - * Map to prevent incrementing cost several times as inventory events are fired 3 times. - */ - private static final Map ANTI_REPEAT = new HashMap<>(); - - /** - * Class for AnvilGUI wrappers to ignore them. - */ - private static final String ANVIL_GUI_CLASS = "net.wesjd.anvilgui.version.Wrapper" + ProxyConstants.NMS_VERSION.substring(1) + "$AnvilContainer"; - - /** - * Instantiate anvil listeners and link them to a specific plugin. - * - * @param plugin The plugin to link to. - */ - public AnvilListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called when items are placed into an anvil. - * - * @param event The event to listen to. - */ - @EventHandler(priority = EventPriority.HIGHEST) - public void onAnvilPrepare(@NotNull final PrepareAnvilEvent event) { - /* - This code is almost as bad as AnvilMerge#doMerge - Inventory events fire three times so I have to do weird workarounds - I also don't know how any of this works - so many things are null - - Do I know when the items are changed? No - Do I know when the experience and name is set? No - Do I know when the merge has failed? No - But it works and I won't touch it. - - I wrote this code in July 2020 and I'm amazed that it holds up. - */ - - - ItemStack left = event.getInventory().getItem(0); - ItemStack right = event.getInventory().getItem(1); - ItemStack out = event.getResult(); - String name = event.getInventory().getRenameText(); - - if (event.getViewers().isEmpty()) { - return; // Prevent ArrayIndexOutOfBoundsException when using AnvilGUI - } - - event.setResult(null); - event.getInventory().setItem(2, null); - - Player player = (Player) event.getViewers().get(0); - if (this.getPlugin().getProxy(OpenInventoryProxy.class).getOpenInventory(player).getClass().toString().equals(ANVIL_GUI_CLASS)) { - return; - } - - if (name == null) { - name = ""; - } - - AnvilResult newOut = AnvilMerge.doMerge(left, right, out, name, player); - - if (newOut.result() == null) { - newOut = new AnvilResult(new ItemStack(Material.AIR, 0), newOut.xp()); - } - - int modCost; - if (newOut.xp() == null) { - modCost = 0; - } else { - modCost = newOut.xp(); - } - - AnvilResult finalNewOut = newOut; - this.getPlugin().getScheduler().run(() -> { - - // This is a disgusting bodge - if (!ANTI_REPEAT.containsKey(player.getUniqueId())) { - ANTI_REPEAT.put(player.getUniqueId(), 0); - } - - Integer num = ANTI_REPEAT.get(player.getUniqueId()); - num += 1; - ANTI_REPEAT.put(player.getUniqueId(), num); - - this.getPlugin().getScheduler().runLater(() -> ANTI_REPEAT.remove(player.getUniqueId()), 1); - - // End pain - - int preCost = event.getInventory().getRepairCost(); - ItemStack item = finalNewOut.result(); - - if (event.getInventory().getItem(0) == null) { - return; - } - - if (!Objects.requireNonNull(event.getInventory().getItem(0)).getType().equals(item.getType())) { - return; - } - - if (this.getPlugin().getConfigYml().getBool("anvil.rework-cost")) { - int repairCost = FastItemStack.wrap(item).getRepairCost(); - int reworkCount = NumberUtils.log2(repairCost + 1); - if (repairCost == 0) { - reworkCount = 0; - } - reworkCount++; - repairCost = (int) Math.pow(2, reworkCount) - 1; - FastItemStack fis = FastItemStack.wrap(item); - fis.setRepairCost(repairCost); - item = fis.unwrap(); - } - - int cost; - - if (ANTI_REPEAT.get(player.getUniqueId()) == 1) { - cost = preCost + modCost; - } else { - cost = preCost; - } - - if (!Objects.equals(left, player.getOpenInventory().getItem(0))) { - return; - } - if (cost == 0) { - return; - } - - /* - This is a weird anti-dupe bodge. Don't look into it. - */ - ItemStack l = event.getInventory().getItem(0); - Map leftEnchants = l == null ? new HashMap<>() : FastItemStack.wrap(l).getEnchants(true); - Map outEnchants = item == null ? new HashMap<>() : FastItemStack.wrap(item).getEnchants(true); - - if (event.getInventory().getItem(1) == null - && !leftEnchants.equals(outEnchants)) { - return; - } - - event.getInventory().setRepairCost(cost); - event.setResult(item); - event.getInventory().setItem(2, item); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java deleted file mode 100644 index 69472443..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.anvil; - -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import lombok.experimental.UtilityClass; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.Damageable; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -@SuppressWarnings("deprecation") -@UtilityClass -public class AnvilMerge { - /** - * Instance of EcoEnchants. - */ - private static final EcoEnchantsPlugin PLUGIN = EcoEnchantsPlugin.getInstance(); - - /** - * Config key for allowing unsafe levels. - */ - private static final String ALLOW_UNSAFE_KEY = "anvil.allow-unsafe-levels"; - - /** - * Merge items in anvil. - * - * @param left The {@link ItemStack} on the left of the anvil. - * @param right The {@link ItemStack} in the middle of the anvil. - * @param old The previous {@link ItemStack} result. - * @param itemName The anvil display name. - * @param player The player merging (for permissions). - * @return The result. - */ - public AnvilResult doMerge(@Nullable final ItemStack left, - @Nullable final ItemStack right, - @Nullable final ItemStack old, - @NotNull final String itemName, - @NotNull final Player player) { - /* - If you're currently looking at this code, - pray to whatever god you have that any changes - don't cause things to break. - - I have no idea how this code works, it does - and it scares me. - I'll just pretend that I understand it and never look at it again. - */ - - // Copied to non-final string. - String name = itemName; - - int outDamage = -1; - if (old != null && old.getItemMeta() instanceof Damageable) { - outDamage = ((Damageable) old.getItemMeta()).getDamage(); - } - - if (left == null) { - return AnvilResult.FAIL; - } - - if (left.getEnchantments().containsKey(EcoEnchants.PERMANENCE_CURSE)) { - return AnvilResult.FAIL; - } - - name = name.replace("§", "&"); - - if (player.hasPermission("ecoenchants.anvil.color")) { - name = StringUtils.format(name); - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(left.getType()) || right == null || !EnchantmentTarget.ALL.getMaterials().contains(right.getType())) { - ItemStack out = left.clone(); - ItemMeta outMeta = out.getItemMeta(); - assert outMeta != null; - ItemMeta meta = left.getItemMeta(); - assert meta != null; - - outMeta.setDisplayName(name); - - if (meta.getDisplayName().equals(name)) { - - if (meta instanceof Damageable) { - int leftDamage = ((Damageable) meta).getDamage(); - - if (outDamage >= leftDamage || outDamage == -1) { - return AnvilResult.FAIL; - } else { - ((Damageable) outMeta).setDamage(outDamage); - } - } else { - return AnvilResult.FAIL; - } - if (right == null) { - return AnvilResult.FAIL; - } - } - - out.setItemMeta(outMeta); - - if (out.equals(left)) { - return AnvilResult.FAIL; - } - return new AnvilResult(out, 0); - } - - if (left.getItemMeta() instanceof Damageable && right.getItemMeta() instanceof EnchantmentStorageMeta) { - outDamage = ((Damageable) left.getItemMeta()).getDamage(); - } - - if (!left.getType().equals(right.getType()) && !(right.getItemMeta() instanceof EnchantmentStorageMeta)) { - return AnvilResult.FAIL; - } - - if (left.getAmount() != right.getAmount()) { - return AnvilResult.FAIL; - } - - Map outEnchants = new HashMap<>(); - - HashMap leftEnchants = new HashMap<>(FastItemStack.wrap(left).getEnchants(true)); - HashMap rightEnchants = new HashMap<>(FastItemStack.wrap(right).getEnchants(true)); - - leftEnchants.forEach(((enchantment, integer) -> { - int level = integer; - - if (rightEnchants.containsKey(enchantment)) { - int rightLevel = rightEnchants.get(enchantment); - if (rightLevel > level) { - level = rightLevel; - } else if (rightLevel == level - && ((rightLevel > enchantment.getMaxLevel() && PLUGIN.getConfigYml().getBool("anvil.allow-combining-unsafe")) - || ((rightLevel + 1) <= enchantment.getMaxLevel() || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)))) { - level++; - } - rightEnchants.remove(enchantment); - } - - if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled")) { - if (!player.hasPermission("ecoenchants.anvil.bypasshardcap")) { - if (outEnchants.keySet() - .stream() - .filter(enchant -> { - if (enchant instanceof EcoEnchant) { - return !((EcoEnchant) enchant).hasFlag("hard-cap-ignore"); - } - - return true; - }).count() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) { - return; - } - } - } - - outEnchants.put(enchantment, level); - })); - - rightEnchants.forEach(((enchantment, integer) -> { - AtomicBoolean doesConflict = new AtomicBoolean(false); - - EnchantmentType.values().forEach(enchantmentType -> { - if (!(enchantment instanceof EcoEnchant enchant)) { - return; - } - if (enchant.getType().equals(enchantmentType) && EcoEnchants.hasAnyOfType(left, enchantmentType) && enchantmentType.isSingular()) { - doesConflict.set(true); - } - }); - - leftEnchants.forEach((enchantment1, integer1) -> { - if (enchantment.conflictsWith(enchantment1)) { - doesConflict.set(true); - } - if (enchantment1.conflictsWith(enchantment)) { - doesConflict.set(true); - } - }); - - boolean canEnchantItem = enchantment.canEnchantItem(left); - if (left.getItemMeta() instanceof EnchantmentStorageMeta) { - canEnchantItem = true; - } - - if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled")) { - if (!player.hasPermission("ecoenchants.anvil.bypasshardcap")) { - if (outEnchants.keySet() - .stream() - .filter(enchant -> { - if (enchant instanceof EcoEnchant) { - return !((EcoEnchant) enchant).hasFlag("hard-cap-ignore"); - } - - return true; - }).count() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) { - doesConflict.set(true); - } - } - } - - if (canEnchantItem && !doesConflict.get()) { - outEnchants.put(enchantment, integer); - } - })); - - // Test if the output is the same as left - if (outEnchants.equals(leftEnchants) && left.getItemMeta().getDisplayName().equals(name) && left.getItemMeta() instanceof Damageable) { - int leftDamage = ((Damageable) left.getItemMeta()).getDamage(); - - if (outDamage == leftDamage) { - return AnvilResult.FAIL; - } - } - - ItemStack output = left.clone(); - - if (output.getItemMeta() instanceof EnchantmentStorageMeta meta) { - meta.getStoredEnchants().forEach(((enchantment, integer) -> { - meta.removeStoredEnchant(enchantment); - })); - - outEnchants.forEach(((enchantment, integer) -> { - meta.addStoredEnchant(enchantment, integer, PLUGIN.getConfigYml().getBool("anvil.allow-existing-unsafe-levels") || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)); - })); - - meta.setDisplayName(name); - - output.setItemMeta(meta); - } else { - ItemMeta meta = output.getItemMeta(); - meta.getEnchants().forEach(((enchantment, integer) -> { - meta.removeEnchant(enchantment); - })); - - outEnchants.forEach(((enchantment, integer) -> { - meta.addEnchant(enchantment, integer, PLUGIN.getConfigYml().getBool("anvil.allow-existing-unsafe-levels") || PLUGIN.getConfigYml().getBool(ALLOW_UNSAFE_KEY)); - })); - - if (output.getItemMeta() instanceof Damageable) { - ((Damageable) meta).setDamage(outDamage); - } - - meta.setDisplayName(name); - - output.setItemMeta(meta); - } - - - // Calculate difference in enchant levels - int totalEnchantLevelDelta; - AtomicInteger outEnchantLevels = new AtomicInteger(); - AtomicInteger inEnchantLevels = new AtomicInteger(); - - outEnchants.forEach(((enchantment, integer) -> { - if (enchantment instanceof EcoEnchant) { - outEnchantLevels.addAndGet(integer); - } - })); - leftEnchants.forEach(((enchantment, integer) -> { - if (enchantment instanceof EcoEnchant) { - outEnchantLevels.addAndGet(integer); - } - })); - - totalEnchantLevelDelta = Math.abs(outEnchantLevels.intValue() - inEnchantLevels.intValue()); - - if (output.equals(left)) { - return AnvilResult.FAIL; - } - - if (PLUGIN.getConfigYml().getBool("anvil.cost-exponent.enabled")) { - double exponent = PLUGIN.getConfigYml().getDouble("anvil.cost-exponent.exponent"); - int prevDelta = totalEnchantLevelDelta; - - double costMultiplier = Math.pow(exponent, totalEnchantLevelDelta); - double modifiedCost = Math.ceil((double) totalEnchantLevelDelta * costMultiplier); - totalEnchantLevelDelta = (int) modifiedCost; - - if (prevDelta > 0 && totalEnchantLevelDelta == 0) { - totalEnchantLevelDelta = prevDelta; - } - } - - return new AnvilResult(output, totalEnchantLevelDelta); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilResult.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilResult.java deleted file mode 100644 index c7f1a7a8..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilResult.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.anvil; - -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.Nullable; - -public record AnvilResult(@Nullable ItemStack result, - @Nullable Integer xp) { - /** - * Fail result. - */ - public static final AnvilResult FAIL = new AnvilResult(null, null); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java deleted file mode 100644 index ea800c32..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneListeners.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.grindstone; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.util.NumberUtils; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.ExperienceOrb; -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.InventoryType; -import org.bukkit.inventory.GrindstoneInventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class GrindstoneListeners extends PluginDependent implements Listener { - /** - * Instantiate grindstone listeners and link them to a specific plugin. - * - * @param plugin The plugin to link to. - */ - public GrindstoneListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called when items are grindstoned. - * - * @param event The event to listen to. - */ - @EventHandler - public void onGrindstone(@NotNull final InventoryClickEvent event) { - Player player = (Player) event.getWhoClicked(); - - if (player.getOpenInventory().getTopInventory().getType() != InventoryType.GRINDSTONE) { - return; - } - if (event.getSlotType() != InventoryType.SlotType.RESULT) { - return; - } - - GrindstoneInventory inventory = (GrindstoneInventory) player.getOpenInventory().getTopInventory(); - - ItemStack top = inventory.getItem(0); - ItemStack bottom = inventory.getItem(1); - ItemStack out = inventory.getItem(2); - - if (out == null) { - return; - } - - List removed = new ArrayList<>(); - - if (top != null) { - removed.addAll(top.getEnchantments().keySet()); - } - - if (bottom != null) { - removed.addAll(bottom.getEnchantments().keySet()); - } - - Map toKeep = GrindstoneMerge.doMerge(top, bottom); - - removed.removeAll(toKeep.keySet()); - - this.getPlugin().getScheduler().runLater(() -> { - if (inventory.getItem(2) != null || event.isCancelled()) { - return; - } - - ItemMeta outMeta = out.getItemMeta(); - - if (outMeta == null) { - return; - } - - if (outMeta instanceof EnchantmentStorageMeta storageMeta) { - toKeep.forEach((enchant, level) -> storageMeta.addStoredEnchant(enchant, level, true)); - out.setItemMeta(storageMeta); - } else { - toKeep.forEach((enchant, level) -> outMeta.addEnchant(enchant, level, true)); - out.setItemMeta(outMeta); - } - - if (!removed.isEmpty()) { - Location loc = player.getLocation().clone().add( - NumberUtils.randFloat(-1, 1), - NumberUtils.randFloat(-1, 1), - NumberUtils.randFloat(-1, 1) - ); - ExperienceOrb orb = (ExperienceOrb) loc.getWorld().spawnEntity(loc, EntityType.EXPERIENCE_ORB); - orb.setExperience(removed.size() * 15); - } - }, 1); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneMerge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneMerge.java deleted file mode 100644 index 0c0d3a98..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/grindstone/GrindstoneMerge.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.merging.grindstone; - -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import lombok.experimental.UtilityClass; -import org.bukkit.Bukkit; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -@UtilityClass -public class GrindstoneMerge { - - /** - * Merge items in a grindstone. - * - * @param top The item at the top of the GUI. - * @param bottom The item at the bottom of the GUI. - * @return All enchantments for the output item to have. - */ - public static Map doMerge(@Nullable final ItemStack top, - @Nullable final ItemStack bottom) { - Map bottomEnchants = FastItemStack.wrap(bottom).getEnchants(true); - Map topEnchants = FastItemStack.wrap(top).getEnchants(true); - - Map toKeep = new HashMap<>(); - - bottomEnchants.forEach(((enchantment, integer) -> { - if (enchantment instanceof EcoEnchant ecoEnchant) { - if (!ecoEnchant.isGrindstoneable()) { - toKeep.putIfAbsent(enchantment, integer); - } - } else { - if (enchantment.isCursed()) { - toKeep.putIfAbsent(enchantment, integer); - } - } - })); - topEnchants.forEach(((enchantment, integer) -> { - if (enchantment instanceof EcoEnchant ecoEnchant) { - if (!ecoEnchant.isGrindstoneable()) { - toKeep.putIfAbsent(enchantment, integer); - } - } else { - if (enchantment.isCursed()) { - toKeep.putIfAbsent(enchantment, integer); - } - } - })); - - return toKeep; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java deleted file mode 100644 index 38bb7133..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/EnchantingListeners.java +++ /dev/null @@ -1,357 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.obtaining; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Color; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Particle; -import org.bukkit.Sound; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.enchantments.EnchantmentOffer; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.enchantment.EnchantItemEvent; -import org.bukkit.event.enchantment.PrepareItemEnchantEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -public class EnchantingListeners extends PluginDependent implements Listener { - /** - * All players currently enchanting a secondary item. - */ - private static final Map CURRENTLY_ENCHANTING_SECONDARY = new HashMap<>(); - - /** - * All enchantments that by default cannot be enchanted in a table but are in EcoEnchants. - */ - private static final Set SECONDARY_ENCHANTABLE = new HashSet<>(); - - /** - * Instantiate enchanting listeners and link them to a specific plugin. - * - * @param plugin The plugin to link to. - */ - public EnchantingListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update from config. - * - * @param plugin Instance of EcoEnchants. - */ - @ConfigUpdater - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - SECONDARY_ENCHANTABLE.clear(); - for (String string : plugin.getTargetYml().getStrings("extra-enchantable-items")) { - SECONDARY_ENCHANTABLE.add(Material.matchMaterial(string.toUpperCase())); - } - } - - /** - * Called on player leave. - * - * @param event The event to listen to. - */ - @EventHandler - public void onPlayerLeave(@NotNull final PlayerQuitEvent event) { - CURRENTLY_ENCHANTING_SECONDARY.remove(event.getPlayer()); - } - - /** - * Called on player enchant item. - * - * @param event The event to listen to. - */ - @EventHandler - public void enchantItem(@NotNull final EnchantItemEvent event) { - Player player = event.getEnchanter(); - ItemStack item = event.getItem(); - int cost = event.getExpLevelCost(); - - Map toAdd = event.getEnchantsToAdd(); - if (!this.getPlugin().getConfigYml().getBool("enchanting-table.enabled")) { - this.getPlugin().getScheduler().runLater(() -> { - ItemStack item0 = event.getInventory().getItem(0); - event.getInventory().setItem(0, item0); - }, 1); - return; - } - - if (SECONDARY_ENCHANTABLE.contains(event.getItem().getType())) { - ItemStack lapis = event.getInventory().getItem(1); - if (!player.getGameMode().equals(GameMode.CREATIVE)) { - if (lapis == null) { - event.setCancelled(true); - return; - } - - if (lapis.getAmount() < event.whichButton() + 1) { - event.setCancelled(true); - return; - } - - lapis.setAmount(lapis.getAmount() - (event.whichButton() + 1)); - - event.getInventory().setItem(1, lapis); - } - } - - double multiplier = 0.01; - if (item.getType().equals(Material.BOOK) || item.getType().equals(Material.ENCHANTED_BOOK)) { - multiplier /= this.getPlugin().getConfigYml().getInt("enchanting-table.book-times-less-likely"); - } - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("enchanting-table.reduce-probability.factor"); - } - - List enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - boolean gotSpecial = false; - - for (EcoEnchant enchantment : enchantments) { - if (!enchantment.canEnchantItem(item)) { - continue; - } - if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getTableProbability() * multiplier) { - continue; - } - if (enchantment.getEnchantmentRarity().getMinimumLevel() > cost) { - continue; - } - if (!enchantment.isEnabled()) { - continue; - } - if (!enchantment.isAvailableFromTable()) { - continue; - } - if (!player.hasPermission("ecoenchants.fromtable." + enchantment.getPermissionName())) { - continue; - } - - AtomicBoolean anyConflicts = new AtomicBoolean(false); - - toAdd.forEach((enchant, integer) -> { - if (enchantment.conflictsWithAny(toAdd.keySet())) { - anyConflicts.set(true); - } - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - if (enchant instanceof EcoEnchant ecoEnchant) { - if (enchantment.getType().equals(ecoEnchant.getType()) && ecoEnchant.getType().isSingular()) { - anyConflicts.set(true); - } - } - }); - if (anyConflicts.get()) { - continue; - } - - int level; - - double maxLevelDouble = enchantment.getMaxLevel(); - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / maxLevelDouble; - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level"); - double enchantlevel1 = (cost / (double) enchantment.getEnchantmentRarity().getMinimumLevel()) / (maxLevel / (double) enchantment.getEnchantmentRarity().getMinimumLevel()); - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1); - double enchantlevel3 = 1 / maxLevelDouble; - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - level = Math.min(level, enchantment.getMaxLevel()); - toAdd.put(enchantment, level); - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.cap-amount.enabled") && toAdd.size() >= this.getPlugin().getConfigYml().getInt("enchanting-table.cap-amount.limit")) { - break; - } - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - gotSpecial = true; - } - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("enchanting-table.reduce-probability.factor"); - } - } - toAdd.forEach(event.getEnchantsToAdd()::putIfAbsent); - - if (SECONDARY_ENCHANTABLE.contains(event.getItem().getType()) && !toAdd.containsKey(EcoEnchants.INDESTRUCTIBILITY)) { - event.getEnchantsToAdd().put(Enchantment.DURABILITY, CURRENTLY_ENCHANTING_SECONDARY.get(player)[event.whichButton()]); - CURRENTLY_ENCHANTING_SECONDARY.remove(player); - } - - if (gotSpecial && this.getPlugin().getConfigYml().getBool("enchanting-table.notify-on-special.enabled")) { - String soundName = this.getPlugin().getConfigYml().getString("enchanting-table.notify-on-special.sound").toUpperCase(); - Sound sound = Sound.valueOf(soundName); - float pitch = (float) this.getPlugin().getConfigYml().getDouble("enchanting-table.notify-on-special.pitch"); - player.playSound( - player.getLocation(), - sound, - 1.0f, - pitch - ); - - if (this.getPlugin().getConfigYml().getBool("enchanting-table.notify-on-special.show-particles")) { - Particle.DustOptions extra = new Particle.DustOptions( - Color.fromRGB(Integer.parseInt( - this.getPlugin().getLangYml().getString("special-particle-color").substring(1), - 16 - )), - 1.0f - ); - - Location location = player.getLocation().clone(); - - location.add(0, 1, 0); - - int limit = this.getPlugin().getConfigYml().getInt("enchanting-table.notify-on-special.particle-amount"); - - for (int i = 0; i < limit; i++) { - Location spawnLoc = location.clone(); - spawnLoc.add( - NumberUtils.randFloat(-2, 2), - NumberUtils.randFloat(-0.3, 1.6), - NumberUtils.randFloat(-2, 2) - ); - - spawnLoc.getWorld().spawnParticle(Particle.REDSTONE, spawnLoc, 1, 0, 0, 0, 0, extra, true); - } - } - - player.sendMessage(this.getPlugin().getLangYml().getMessage("got-special")); - } - - // Ew - this.getPlugin().getScheduler().runLater(() -> { - ItemStack item0 = event.getInventory().getItem(0); - if (item0 == null) { - return; - } - if (item0.getItemMeta() instanceof EnchantmentStorageMeta meta) { - for (Enchantment enchantment : meta.getStoredEnchants().keySet()) { - meta.removeStoredEnchant(enchantment); - } - event.getEnchantsToAdd().forEach(((enchantment, integer) -> { - meta.addStoredEnchant(enchantment, integer, false); - })); - item0.setItemMeta(meta); - } - event.getInventory().setItem(0, item0); - }, 1); - } - - /** - * Called on prepare enchant. - * For secondary enchantments, generates unbreaking tooltips. - * - * @param event The event to listen to. - */ - @EventHandler - public void secondaryEnchant(@NotNull final PrepareItemEnchantEvent event) { - if (!this.getPlugin().getConfigYml().getBool("enchanting-table.enabled")) { - return; - } - - int maxLevel = this.getPlugin().getConfigYml().getInt("enchanting-table.maximum-obtainable-level"); - - try { - event.getOffers()[2].setCost(Math.min(event.getOffers()[2].getCost(), maxLevel)); - } catch (ArrayIndexOutOfBoundsException | NullPointerException ignored) { - } - - if (!SECONDARY_ENCHANTABLE.contains(event.getItem().getType())) { - return; - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(event.getItem().getType())) { - return; - } - - int bonus = event.getEnchantmentBonus(); - if (bonus > 15) { - bonus = 15; - } - if (bonus == 0) { - bonus = 1; - } - - double baseLevel = NumberUtils.randInt(1, 8) + Math.floor((double) bonus / 2) + NumberUtils.randInt(0, bonus); - - int bottomEnchantLevel = (int) Math.ceil(Math.max(baseLevel / 3, 1)); - int midEnchantLevel = (int) ((baseLevel * 2) / 3) + 1; - int topEnchantLevel = (int) Math.max(baseLevel, bonus * 2); - - bottomEnchantLevel *= (int) Math.ceil((double) maxLevel / 30); - midEnchantLevel *= (int) Math.ceil((double) maxLevel / 30); - topEnchantLevel *= (int) Math.ceil((double) maxLevel / 30); - - bottomEnchantLevel = Math.min(bottomEnchantLevel, maxLevel); - - int midUnbreakingLevel = NumberUtils.randInt(1, 3); - if (midUnbreakingLevel < 2) { - midUnbreakingLevel = 2; - } - if (midEnchantLevel < 15) { - midUnbreakingLevel = 1; - } - - int topUnbreakingLevel = 3; - if (topEnchantLevel < 20) { - topUnbreakingLevel = 2; - } - if (topEnchantLevel < 10) { - topUnbreakingLevel = 1; - } - - EnchantmentOffer[] offers = { - new EnchantmentOffer(Enchantment.DURABILITY, 1, bottomEnchantLevel), - new EnchantmentOffer(Enchantment.DURABILITY, midUnbreakingLevel, midEnchantLevel), - new EnchantmentOffer(Enchantment.DURABILITY, topUnbreakingLevel, topEnchantLevel), - }; - - for (int i = 0; i < offers.length; i++) { - event.getOffers()[i] = offers[i]; - } - - CURRENTLY_ENCHANTING_SECONDARY.remove(event.getEnchanter()); - - int[] unbLevels = { - event.getOffers()[0].getEnchantmentLevel(), - event.getOffers()[1].getEnchantmentLevel(), - event.getOffers()[2].getEnchantmentLevel() - }; - - CURRENTLY_ENCHANTING_SECONDARY.put(event.getEnchanter(), unbLevels); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootGenerateListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootGenerateListeners.java deleted file mode 100644 index c3988708..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/LootGenerateListeners.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.obtaining; - -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.world.LootGenerateEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; - -public class LootGenerateListeners extends PluginDependent implements Listener { - /** - * Create a new loot populator. - * - * @param plugin The this.getPlugin(). - */ - public LootGenerateListeners(@NotNull final EcoEnchantsPlugin plugin) { - super(plugin); - } - - @EventHandler - public void onGenerate(@NotNull final LootGenerateEvent event) { - if (!this.getPlugin().getConfigYml().getBool("loot.enabled")) { - return; - } - - for (ItemStack itemStack : event.getLoot()) { - modifyItem(itemStack); - } - } - - private void modifyItem(@Nullable final ItemStack item) { - if (item == null) { - return; - } - if (!EnchantmentTarget.ALL.getMaterials().contains(item.getType())) { - return; - } - if (item.getType().equals(Material.BOOK)) { - return; - } - - Map toAdd = new HashMap<>(); - List existing = FastItemStack.wrap(item).getEnchants(true) - .keySet().stream().filter(enchant -> !(enchant instanceof EcoEnchant)).collect(Collectors.toList()); - - List enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - double multiplier = 0.01; - if (item.getType().equals(Material.BOOK) || item.getType().equals(Material.ENCHANTED_BOOK)) { - multiplier /= this.getPlugin().getConfigYml().getInt("loot.book-times-less-likely"); - } - - if (this.getPlugin().getConfigYml().getBool("loot.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("loot.reduce-probability.factor"); - } - - int cap = 0; - - for (EcoEnchant enchantment : enchantments) { - if (enchantment == null || enchantment.getEnchantmentRarity() == null) { - continue; - } - - if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getLootProbability() * multiplier) { - continue; - } - - if (!enchantment.isAvailableFromLoot()) { - continue; - } - - if (!enchantment.canEnchantItem(item)) { - continue; - } - - if (!enchantment.isEnabled()) { - continue; - } - - AtomicBoolean anyConflicts = new AtomicBoolean(false); - - if (enchantment.conflictsWithAny(existing)) { - anyConflicts.set(true); - } - - toAdd.forEach((enchant, integer) -> { - if (enchantment.conflictsWithAny(toAdd.keySet())) { - anyConflicts.set(true); - } - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - EcoEnchant ecoEnchant = (EcoEnchant) enchant; - if (enchantment.getType().equals(ecoEnchant.getType()) && ecoEnchant.getType().isSingular()) { - anyConflicts.set(true); - } - }); - if (anyConflicts.get()) { - continue; - } - - int level; - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, 1); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - toAdd.put(enchantment, level); - - if (this.getPlugin().getConfigYml().getBool("loot.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("loot.reduce-probability.factor"); - } - - if (!enchantment.hasFlag("hard-cap-ignore")) { - cap++; - } - - if (this.getPlugin().getConfigYml().getBool("anvil.hard-cap.enabled")) { - if (cap >= this.getPlugin().getConfigYml().getInt("anvil.hard-cap.cap")) { - break; - } - } - } - - if (item.getItemMeta() instanceof EnchantmentStorageMeta meta) { - toAdd.forEach(((enchantment, integer) -> meta.addStoredEnchant(enchantment, integer, false))); - item.setItemMeta(meta); - } else { - ItemMeta meta = item.getItemMeta(); - toAdd.forEach(((enchantment, integer) -> meta.addEnchant(enchantment, integer, false))); - item.setItemMeta(meta); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java deleted file mode 100644 index ac35b5bd..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/obtaining/VillagerListeners.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.obtaining; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Particle; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Entity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.VillagerAcquireTradeEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.MerchantRecipe; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -public class VillagerListeners extends PluginDependent implements Listener { - /** - * Create new villager listeners. - * - * @param plugin The plugin. - */ - public VillagerListeners(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Called on villager gain trade. - * - * @param event The event to listen for. - */ - @EventHandler - public void onVillagerGainBookTrade(@NotNull final VillagerAcquireTradeEvent event) { - if (!event.getRecipe().getResult().getType().equals(Material.ENCHANTED_BOOK)) { - return; - } - - if (!this.getPlugin().getConfigYml().getBool("villager.enabled")) { - return; - } - - ItemStack result = event.getRecipe().getResult().clone(); - int uses = event.getRecipe().getUses(); - int maxUses = event.getRecipe().getMaxUses(); - boolean experienceReward = event.getRecipe().hasExperienceReward(); - int villagerExperience = event.getRecipe().getVillagerExperience(); - float priceMultiplier = event.getRecipe().getPriceMultiplier(); - List ingredients = event.getRecipe().getIngredients(); - - if (!(result.getItemMeta() instanceof EnchantmentStorageMeta meta)) { - return; - } - - ArrayList enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - double multiplier = 0.01 / this.getPlugin().getConfigYml().getDouble("villager.book-times-less-likely"); - - EcoEnchant applied = null; - - for (EcoEnchant enchantment : enchantments) { - if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getVillagerProbability() * multiplier) { - continue; - } - - if (!enchantment.isAvailableFromVillager()) { - continue; - } - - if (!enchantment.isEnabled()) { - continue; - } - - int level; - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - int cost = event.getRecipe().getIngredients().get(0).getAmount(); - double enchantlevel1 = (double) cost / 64; - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - meta.getStoredEnchants().forEach(((enchantment1, integer) -> meta.removeStoredEnchant(enchantment1))); - - meta.addStoredEnchant(enchantment, level, false); - - applied = enchantment; - break; - } - - if (applied == null) { - return; - } - - result.setItemMeta(meta); - - MerchantRecipe recipe = new MerchantRecipe(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier); - recipe.setIngredients(ingredients); - event.setRecipe(recipe); - - if (this.getPlugin().getConfigYml().getBool("villager.notify-on-special.enabled")) { - if (applied.getType().equals(EnchantmentType.SPECIAL)) { - showParticles(event.getEntity()); - } - } - } - - /** - * Called on villager gain trade. - * - * @param event The event to listen for. - */ - @EventHandler - public void onVillagerGainItemTrade(@NotNull final VillagerAcquireTradeEvent event) { - - if (!EnchantmentTarget.ALL.getMaterials().contains(event.getRecipe().getResult().getType())) { - return; - } - - if (event.getRecipe().getResult().getType().equals(Material.BOOK)) { - return; - } - - if (!this.getPlugin().getConfigYml().getBool("villager.enabled")) { - return; - } - - ItemStack result = event.getRecipe().getResult().clone(); - int uses = event.getRecipe().getUses(); - int maxUses = event.getRecipe().getMaxUses(); - boolean experienceReward = event.getRecipe().hasExperienceReward(); - int villagerExperience = event.getRecipe().getVillagerExperience(); - float priceMultiplier = event.getRecipe().getPriceMultiplier(); - List ingredients = event.getRecipe().getIngredients(); - - if (result.getItemMeta() instanceof EnchantmentStorageMeta) { - return; - } - - ItemMeta meta = result.getItemMeta(); - - ArrayList enchantments = new ArrayList<>(EcoEnchants.values()); - Collections.shuffle(enchantments); // Prevent list bias towards early enchantments like telekinesis - - Map toAdd = new HashMap<>(); - - Set onItem = FastItemStack.wrap(result).getEnchants(false).keySet(); - - double multiplier = 0.01; - - for (EcoEnchant enchantment : enchantments) { - if (NumberUtils.randFloat(0, 1) > enchantment.getEnchantmentRarity().getVillagerProbability() * multiplier) { - continue; - } - - if (!enchantment.isAvailableFromVillager()) { - continue; - } - - if (!enchantment.canEnchantItem(result)) { - continue; - } - - if (!enchantment.isEnabled()) { - continue; - } - - AtomicBoolean anyConflicts = new AtomicBoolean(false); - toAdd.forEach((enchant, integer) -> { - if (enchantment.conflictsWithAny(toAdd.keySet())) { - anyConflicts.set(true); - } - - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - if (enchantment.conflictsWith(enchant)) { - anyConflicts.set(true); - } - - if (enchantment.getType().equals(enchant.getType()) && enchant.getType().isSingular()) { - anyConflicts.set(true); - } - }); - for (Enchantment enchant : onItem) { - if (enchantment.conflictsWithAny(onItem)) { - anyConflicts.set(true); - } - - if (enchant.conflictsWith(enchantment)) { - anyConflicts.set(true); - } - - if (enchantment.conflictsWith(enchant)) { - anyConflicts.set(true); - } - } - - if (anyConflicts.get()) { - continue; - } - - int level; - - if (enchantment.getType().equals(EnchantmentType.SPECIAL)) { - double enchantlevel1 = NumberUtils.randFloat(0, 1); - double enchantlevel2 = NumberUtils.bias(enchantlevel1, this.getPlugin().getConfigYml().getDouble("enchanting-table.special-bias")); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } else { - int cost = event.getRecipe().getIngredients().get(0).getAmount(); - double enchantlevel1 = (double) cost / 64; - double enchantlevel2 = NumberUtils.triangularDistribution(0, 1, enchantlevel1); - double enchantlevel3 = 1 / (double) enchantment.getMaxLevel(); - level = (int) Math.ceil(enchantlevel2 / enchantlevel3); - } - - toAdd.put(enchantment, level); - - if (this.getPlugin().getConfigYml().getBool("villager.reduce-probability.enabled")) { - multiplier /= this.getPlugin().getConfigYml().getDouble("villager.reduce-probability.factor"); - } - } - - toAdd.forEach(((enchantment, integer) -> meta.addEnchant(enchantment, integer, false))); - - result.setItemMeta(meta); - - MerchantRecipe recipe = new MerchantRecipe(result, uses, maxUses, experienceReward, villagerExperience, priceMultiplier); - recipe.setIngredients(ingredients); - event.setRecipe(recipe); - - if (this.getPlugin().getConfigYml().getBool("villager.notify-on-special.enabled")) { - if (toAdd.keySet().stream().anyMatch(enchant -> enchant.getType().equals(EnchantmentType.SPELL))) { - showParticles(event.getEntity()); - } - } - } - - private void showParticles(@NotNull final Entity villager) { - Particle.DustOptions extra = new Particle.DustOptions( - Color.fromRGB(Integer.parseInt( - this.getPlugin().getLangYml().getString("special-particle-color").substring(1), - 16 - )), - 1.0f - ); - - Location location = villager.getLocation().clone(); - - location.add(0, 1, 0); - - int limit = this.getPlugin().getConfigYml().getInt("villager.notify-on-special.particle-amount"); - - for (int i = 0; i < limit; i++) { - Location spawnLoc = location.clone(); - spawnLoc.add( - NumberUtils.randFloat(-2, 2), - NumberUtils.randFloat(-0.3, 1.6), - NumberUtils.randFloat(-2, 2) - ); - - spawnLoc.getWorld().spawnParticle(Particle.REDSTONE, spawnLoc, 1, 0, 0, 0, 0, extra, true); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java deleted file mode 100644 index fd06eff0..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantmentMetadata.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.vanilla; - -import org.bukkit.NamespacedKey; - -import java.util.Set; - -public record VanillaEnchantmentMetadata( - Integer maxLevel, - Set conflicts -) { -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java deleted file mode 100644 index f4993df3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/vanilla/VanillaEnchantments.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.willfp.ecoenchants.enchantments.support.vanilla; - -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy; -import lombok.experimental.UtilityClass; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -@UtilityClass -public class VanillaEnchantments { - /** - * Vanilla Enchantment Metadata Map. - */ - private static final Map MAP = new HashMap<>(); - - /** - * Get a map of all custom enchantment metadata. - * - * @return The map. - */ - public Map getMetadataMap() { - return MAP; - } - - /** - * Update the map. - * - * @param plugin Instance of EcoEnchants. - */ - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - Map map = new HashMap<>(); - - List enchantments = Arrays.stream(Enchantment.values()) - .filter(enchantment -> enchantment.getClass().getName().contains("CraftEnchantment")).toList(); - - Map maxLevels = plugin.getVanillaEnchantsYml().getStrings("max-levels").stream() - .collect(Collectors.toMap( - s -> Enchantment.getByKey(NamespacedKey.minecraft(s.split(":")[0].toLowerCase())), - s1 -> Integer.parseInt(s1.split(":")[1]) - )); - - Map> conflicts = plugin.getVanillaEnchantsYml().getStrings("conflicts").stream() - .collect(Collectors.toMap( - s -> Enchantment.getByKey(NamespacedKey.minecraft(s.split(":")[0].toLowerCase())), - s1 -> { - String[] split = s1.split(":"); - Set keys = new HashSet<>(); - for (int i = 1; i < split.length; i++) { - keys.add(NamespacedKey.minecraft(split[i])); - } - - keys.removeIf(key -> key.getKey().equalsIgnoreCase("none")); - - return keys; - } - )); - - for (Enchantment enchantment : enchantments) { - VanillaEnchantmentMetadata metadata = new VanillaEnchantmentMetadata(maxLevels.get(enchantment), conflicts.get(enchantment)); - - map.put(enchantment, metadata); - } - - MAP.clear(); - MAP.putAll(map); - - if (plugin.getVanillaEnchantsYml().getBool("enabled")) { - plugin.getProxy(EcoCraftEnchantmentManagerProxy.class).registerNewCraftEnchantments(); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantChecks.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantChecks.java deleted file mode 100644 index bdb67719..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantChecks.java +++ /dev/null @@ -1,409 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - - -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.ArrowUtils; -import com.willfp.eco.util.DurabilityUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import lombok.experimental.UtilityClass; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -@UtilityClass -public class EnchantChecks { - /** - * Does the specified ItemStack have a certain Enchantment present? - * - * @param item The {@link ItemStack} to check - * @param enchantment The enchantment to query - * @return If the item has the queried enchantment - */ - public static boolean item(@Nullable final ItemStack item, - @NotNull final Enchantment enchantment) { - return getItemLevel(item, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the specified ItemStack have? - * - * @param item The {@link ItemStack} to check - * @param enchantment The enchantment to query - * @return The level of the enchantment, or 0 if not found - */ - public static int getItemLevel(@Nullable final ItemStack item, - @NotNull final Enchantment enchantment) { - if (item == null) { - return 0; - } - if (item.getType().equals(Material.AIR)) { - return 0; - } - - return FastItemStack.wrap(item).getEnchantmentLevel(enchantment, false); - } - - /** - * Get all {@link EcoEnchant}s on a specified ItemStack. - * - * @param item The ItemStack to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnItem(@Nullable final ItemStack item) { - if (item == null) { - return new HashMap<>(); - } - if (item.getType().equals(Material.AIR)) { - return new HashMap<>(); - } - - Map ecoEnchants = new HashMap<>(); - for (Map.Entry enchantmentIntegerEntry : FastItemStack.wrap(item).getEnchants(false).entrySet()) { - if (enchantmentIntegerEntry.getKey() instanceof EcoEnchant enchant) { - ecoEnchants.put(enchant, enchantmentIntegerEntry.getValue()); - } - } - - return ecoEnchants; - } - - /** - * Does the specified Arrow have a certain Enchantment present? - *

- * EcoEnchants automatically gives an arrow NBT data consisting of the enchantments present to avoid switching errors. - * - * @param arrow The {@link Arrow} to check. - * @param enchantment The enchantment to query. - * @return If the arrow has the queried enchantment. - */ - public static boolean arrow(@NotNull final Arrow arrow, - @NotNull final Enchantment enchantment) { - return getArrowLevel(arrow, enchantment) != 0; - } - - /** - * What level specified Arrow has of a certain Enchantment present? - *

- * EcoEnchants automatically gives an arrow NBT data consisting of the enchantments present to avoid switching errors. - * - * @param arrow The {@link Arrow} to check. - * @param enchantment The enchantment to query. - * @return The level found on the arrow, or 0 if not found. - */ - public static int getArrowLevel(@NotNull final Arrow arrow, - @NotNull final Enchantment enchantment) { - ItemStack bow = ArrowUtils.getBow(arrow); - - if (bow == null) { - return 0; - } - - return getItemLevel(bow, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a specified Arrow. - * - * @param arrow The Arrow to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnArrow(@NotNull final Arrow arrow) { - ItemStack bow = ArrowUtils.getBow(arrow); - - if (bow == null) { - return new HashMap<>(); - } - - return getEnchantsOnItem(bow); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on the item in their main hand? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean mainhand(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getMainhandLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their main hand item? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found on the mainhand item, or 0 if not found. - */ - public static int getMainhandLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getItemInMainHand(); - - return getItemLevel(item, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s main hand item. - * - * @param entity The entity to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnMainhand(@NotNull final LivingEntity entity) { - if (entity.getEquipment() == null) { - return new HashMap<>(); - } - - ItemStack item = entity.getEquipment().getItemInMainHand(); - - return getEnchantsOnItem(item); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on the item in their offhand? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean offhand(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getOffhandLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their offhand item? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found on the offhand item, or 0 if not found. - */ - public static int getOffhandLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getItemInOffHand(); - - return getItemLevel(item, enchantment); - } - - /** - * Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s offhand item. - * - * @param entity The entity to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the level. - */ - public static Map getEnchantsOnOffhand(@NotNull final LivingEntity entity) { - if (entity.getEquipment() == null) { - return new HashMap<>(); - } - - ItemStack item = entity.getEquipment().getItemInOffHand(); - - return getEnchantsOnItem(item); - } - - /** - * Get a cumulative total of all levels on a {@link LivingEntity}s armor of a certain enchantment. - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The cumulative total of all levels, ie 4 pieces all with level 3 returns 12 - */ - public static int getArmorPoints(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getArmorPoints(entity, enchantment, 0); - } - - /** - * Get a cumulative total of all levels on a {@link LivingEntity}s armor of a certain enchantment. - *

- * Then, apply a specified amount of damage to all items with said enchantment. - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @param damage The amount of damage to deal to all armor pieces. - * @return The cumulative total of all levels, ie 4 pieces all with level 3 returns 12. - */ - public static int getArmorPoints(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment, - final int damage) { - if (entity.getEquipment() == null) { - return 0; - } - - boolean isPlayer = entity instanceof Player; - - AtomicInteger armorPoints = new AtomicInteger(0); - List armor = Arrays.asList(entity.getEquipment().getArmorContents()); - armor.forEach((itemStack -> { - int level = getItemLevel(itemStack, enchantment); - if (level != 0) { - armorPoints.addAndGet(getItemLevel(itemStack, enchantment)); - if (damage > 0 && isPlayer) { - Player player = (Player) entity; - DurabilityUtils.damageItem(player, itemStack, level); - } - } - })); - - return armorPoints.get(); - } - - /** - * Get all {@link EcoEnchant}s on a queried {@link LivingEntity}s armor. - * - * @param entity The entity to query. - * @return A {@link HashMap} of all EcoEnchants, where the key represents the cumulative total levels. - */ - public static Map getEnchantsOnArmor(@NotNull final LivingEntity entity) { - if (entity.getEquipment() == null) { - return new HashMap<>(); - } - - Map ecoEnchants = new HashMap<>(); - - for (ItemStack itemStack : entity.getEquipment().getArmorContents()) { - ecoEnchants.putAll(EnchantChecks.getEnchantsOnItem(itemStack)); - } - - return ecoEnchants; - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their helmet? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean helmet(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getHelmetLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their helmet? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getHelmetLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getHelmet(); - - return getItemLevel(item, enchantment); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their chestplate? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean chestplate(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getChestplateLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their chestplate? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getChestplateLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getChestplate(); - - return getItemLevel(item, enchantment); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their leggings? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean leggings(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getLeggingsLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their leggings? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getLeggingsLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getLeggings(); - - return getItemLevel(item, enchantment); - } - - /** - * Does the specified {@link LivingEntity} have a certain Enchantment present on their boots? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return If the LivingEntity has the enchantment. - */ - public static boolean boots(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - return getBootsLevel(entity, enchantment) != 0; - } - - /** - * What level of the specified enchantment does the queried {@link LivingEntity} have on their boots? - * - * @param entity The entity to query. - * @param enchantment The enchantment to check. - * @return The level found, or 0 if not found. - */ - public static int getBootsLevel(@NotNull final LivingEntity entity, - @NotNull final Enchantment enchantment) { - if (entity.getEquipment() == null) { - return 0; - } - - ItemStack item = entity.getEquipment().getBoots(); - - return getItemLevel(item, enchantment); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java deleted file mode 100644 index 4dc2451e..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/EnchantmentUtils.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -import com.willfp.eco.core.placeholder.PlayerPlaceholder; -import com.willfp.eco.util.NumberUtils; -import com.willfp.eco.util.StringUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import lombok.experimental.UtilityClass; -import org.bukkit.NamespacedKey; -import org.bukkit.block.Block; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -@UtilityClass -@SuppressWarnings({"unchecked", "deprecation"}) -public class EnchantmentUtils { - /** - * If the enchantment has successfully passed its specified chance. - * - * @param enchantment The enchantment to query. - * @param level The level to base the chance off of. - * @return If the enchantment should then be executed. - */ - public static boolean passedChance(@NotNull final EcoEnchant enchantment, - final int level) { - return NumberUtils.randFloat(0, 1) < ((enchantment.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level") * level) / 100); - } - - /** - * If the enchantment has successfully passed its specified chance. - * - * @param enchantment The enchantment to query. - * @param level The level to base the chance off of. - * @return If the enchantment should then be executed. - */ - public static String chancePlaceholder(@NotNull final EcoEnchant enchantment, - final int level) { - return NumberUtils.format(enchantment.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level") * level); - } - - /** - * If attack was fully charged if required. - * - * @param enchantment The enchantment. - * @param entity The attacker. - * @return If was fully charged. - */ - public static boolean isFullyChargeIfRequired(@NotNull final EcoEnchant enchantment, - @NotNull final LivingEntity entity) { - if (entity instanceof Player) { - if (((Player) entity).getAttackCooldown() != 1.0f) { - return enchantment.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "allow-not-fully-charged"); - } - } - - return true; - } - - /** - * Register the placeholders for an enchantment. - * - * @param enchantment The enchantment to register placeholders for. - */ - public static void registerPlaceholders(@NotNull final EcoEnchant enchantment) { - PlaceholderManager.registerPlaceholder( - new PlayerPlaceholder( - enchantment.getPlugin(), - enchantment.getPermissionName() + "_" + "enabled", - player -> String.valueOf(enchantment.isEnabled()) - ) - ); - - enchantment.getConfig().getKeys(true).forEach(string -> { - String key = string.replace(".", "_").replace("-", "_"); - Object object = enchantment.getConfig().get(string); - - PlaceholderManager.registerPlaceholder( - new PlayerPlaceholder( - enchantment.getPlugin(), - enchantment.getPermissionName() + "_" + key, - player -> StringUtils.toNiceString(object) - ) - ); - }); - } - - /** - * Register enchantment with the server. - * - * @param enchantment The enchantment. - */ - public static void register(@NotNull final Enchantment enchantment) { - try { - Field byIdField = Enchantment.class.getDeclaredField("byKey"); - Field byNameField = Enchantment.class.getDeclaredField("byName"); - byIdField.setAccessible(true); - byNameField.setAccessible(true); - Map byKey = (Map) byIdField.get(null); - Map byName = (Map) byNameField.get(null); - byKey.remove(enchantment.getKey()); - byName.remove(enchantment.getName()); - - if (enchantment instanceof EcoEnchant) { - byName.remove(((EcoEnchant) enchantment).getDisplayName()); - } - - Map byNameClone = new HashMap<>(byName); - for (Map.Entry entry : byNameClone.entrySet()) { - if (entry.getValue().getKey().equals(enchantment.getKey())) { - byName.remove(entry.getKey()); - } - } - - if (enchantment instanceof EcoEnchant) { - if (EcoEnchantsPlugin.getInstance().getConfigYml().getBool("advanced.dual-registration.enabled")) { - byName.put(((EcoEnchant) enchantment).getDisplayName(), enchantment); - } - } - - Field f = Enchantment.class.getDeclaredField("acceptingNew"); - f.setAccessible(true); - f.set(null, true); - f.setAccessible(false); - - Enchantment.registerEnchantment(enchantment); - } catch (NoSuchFieldException | IllegalAccessException ignored) { - } - } - - /** - * Unregister enchantment with the server. - * - * @param enchantment The enchantment. - */ - public static void unregister(@NotNull final Enchantment enchantment) { - try { - Field byIdField = Enchantment.class.getDeclaredField("byKey"); - Field byNameField = Enchantment.class.getDeclaredField("byName"); - byIdField.setAccessible(true); - byNameField.setAccessible(true); - Map byKey = (Map) byIdField.get(null); - Map byName = (Map) byNameField.get(null); - byKey.remove(enchantment.getKey()); - byName.remove(enchantment.getName()); - - if (enchantment instanceof EcoEnchant) { - byName.remove(((EcoEnchant) enchantment).getDisplayName()); - } - - Map byNameClone = new HashMap<>(byName); - for (Map.Entry entry : byNameClone.entrySet()) { - if (entry.getValue().getKey().equals(enchantment.getKey())) { - byName.remove(entry.getKey()); - } - } - - Field f = Enchantment.class.getDeclaredField("acceptingNew"); - f.setAccessible(true); - f.set(null, true); - f.setAccessible(false); - } catch (NoSuchFieldException | IllegalAccessException ignored) { - } - } - - /** - * Old method still used for backwards compatibility. - * - * @param player The player. - * @param toBreak The blocks to break. - * @param plugin Instance of EcoEnchants, required for meta. - */ - public static void rehandleBreaking(@NotNull final Player player, - @NotNull final Set toBreak, - @NotNull final EcoPlugin plugin) { - for (Block block : toBreak) { - block.setMetadata("block-ignore", plugin.getMetadataValueFactory().create(true)); - player.breakBlock(block); - block.removeMetadata("block-ignore", plugin); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversionOptions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversionOptions.java deleted file mode 100644 index dcea9e1d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversionOptions.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import lombok.Getter; -import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; - -@UtilityClass -public class ItemConversionOptions { - /** - * Allow reading enchantments from lore-based plugins. - */ - @Getter - private boolean usingLoreGetter = false; - - /** - * Allow reading enchantments from lore-based plugins aggressively. - */ - @Getter - private boolean usingAggressiveLoreGetter = false; - - /** - * If the experimental hide fixer is being used. - */ - @Getter - private boolean usingExperimentalHideFixer = false; - - /** - * If the aggressive experimental hide fixer is being used. - */ - @Getter - private boolean usingAggressiveExperimentalHideFixer = false; - - /** - * If all items should have hide enchants removed. - */ - @Getter - private boolean usingForceHideFixer = false; - - /** - * If above max level enchantments should be clamped. - */ - @Getter - private boolean usingLevelClamp = false; - - /** - * If items with above max level enchantments should be deleted. - */ - @Getter - private boolean usingLevelClampDelete = false; - - /** - * If illegal enchantments should be deleted. - */ - @Getter - private boolean removingIllegal = false; - - /** - * If illegal items should be deleted. - */ - @Getter - private boolean deletingIllegal = false; - - /** - * If hard cap clamp is enabled. - */ - @Getter - private boolean usingHardCapClamp = false; - - /** - * If disabled enchantments should be removed entirely. - */ - @Getter - private boolean removeDisabled = false; - - /** - * Reload the options. - * - * @param plugin Instance of ecoenchants. - */ - @ConfigUpdater - public void reload(@NotNull final EcoPlugin plugin) { - usingLoreGetter = plugin.getConfigYml().getBool("advanced.lore-getter.enabled"); - usingAggressiveLoreGetter = plugin.getConfigYml().getBool("advanced.lore-getter.aggressive"); - usingExperimentalHideFixer = plugin.getConfigYml().getBool("advanced.hide-fixer.enabled"); - usingAggressiveExperimentalHideFixer = plugin.getConfigYml().getBool("advanced.hide-fixer.aggressive"); - usingForceHideFixer = plugin.getConfigYml().getBool("advanced.hide-fixer.force"); - usingLevelClamp = plugin.getConfigYml().getBool("advanced.level-clamp.enabled"); - usingLevelClampDelete = plugin.getConfigYml().getBool("advanced.level-clamp.delete-item"); - removingIllegal = plugin.getConfigYml().getBool("advanced.remove-illegal.enabled"); - deletingIllegal = plugin.getConfigYml().getBool("advanced.remove-illegal.delete-item"); - removeDisabled = plugin.getConfigYml().getBool("advanced.remove-disabled.enabled"); - usingHardCapClamp = plugin.getConfigYml().getBool("advanced.hard-cap-clamp.enabled"); - } - - static { - reload(EcoEnchantsPlugin.getInstance()); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java deleted file mode 100644 index 267ffc5d..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/ItemConversions.java +++ /dev/null @@ -1,509 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.fast.FastItemStack; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryOpenEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.inventory.BlockInventoryHolder; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -@SuppressWarnings("deprecation") -public class ItemConversions extends PluginDependent implements Listener { - /** - * Pass an {@link EcoPlugin} in order to interface with it. - * - * @param plugin The plugin to manage. - */ - public ItemConversions(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * On player hold item. - *

- * Listener for lore conversion. - * - * @param event The event to listen for. - */ - @EventHandler - public void loreConverter(@NotNull final PlayerItemHeldEvent event) { - if (!ItemConversionOptions.isUsingLoreGetter()) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - convertLore(itemStack); - } - - /** - * On player open inventory. - *

- * Listener for lore conversion. - * - * @param event The event to listen for. - */ - @EventHandler - public void aggressiveLoreConverter(@NotNull final InventoryOpenEvent event) { - if (!ItemConversionOptions.isUsingAggressiveLoreGetter()) { - return; - } - - Inventory inventory = event.getInventory(); - - if (inventory.getHolder() == null) { - return; - } - - if (!(inventory.getHolder() instanceof BlockInventoryHolder)) { - return; - } - - for (ItemStack itemStack : inventory.getContents()) { - convertLore(itemStack); - } - } - - private void convertLore(@Nullable final ItemStack itemStack) { - if (itemStack == null) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - Map toAdd = new HashMap<>(); - - List lore = meta.getLore(); - - if (lore == null) { - return; - } - - for (String line : new ArrayList<>(lore)) { - String rawLine = line; - line = ChatColor.stripColor(line); - - EcoEnchant enchant; - int level; - List lineSplit = new ArrayList<>(Arrays.asList(line.split(" "))); - if (lineSplit.size() == 0) { - continue; - } - if (lineSplit.size() == 1) { - enchant = EcoEnchants.getByName(lineSplit.get(0)); - level = 1; - } else { - EcoEnchant attemptFullLine = EcoEnchants.getByName(line); - - if (attemptFullLine != null) { - enchant = attemptFullLine; - level = 1; - } else { - String levelString = lineSplit.get(lineSplit.size() - 1); - lineSplit.remove(levelString); - levelString = levelString.trim(); - - try { - level = NumberUtils.fromNumeral(levelString); - } catch (IllegalArgumentException e) { - continue; - } - - String enchantName = String.join(" ", lineSplit); - enchant = EcoEnchants.getByName(enchantName); - } - } - - if (enchant != null) { - lore.remove(rawLine); - toAdd.put(enchant, level); - } - } - - if (meta instanceof EnchantmentStorageMeta) { - lore.clear(); - toAdd.forEach((enchantment, integer) -> ((EnchantmentStorageMeta) meta).addStoredEnchant(enchantment, integer, true)); - } else { - toAdd.forEach((enchantment, integer) -> meta.addEnchant(enchantment, integer, true)); - } - meta.setLore(lore); - itemStack.setItemMeta(meta); - } - - /** - * On player hold item. - *

- * Listener for hide fixer. - * - * @param event The event to listen for. - */ - @EventHandler - public void hideFixer(@NotNull final PlayerItemHeldEvent event) { - if (!ItemConversionOptions.isUsingExperimentalHideFixer()) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - hideFixItem(itemStack); - } - - /** - * On player open inventory. - *

- * Listener for hide fixer. - * - * @param event The event to listen for. - */ - @EventHandler - public void aggressiveHideFixer(@NotNull final InventoryOpenEvent event) { - if (!ItemConversionOptions.isUsingAggressiveExperimentalHideFixer()) { - return; - } - - Inventory inventory = event.getInventory(); - - if (inventory.getHolder() == null) { - return; - } - - if (!(inventory.getHolder() instanceof BlockInventoryHolder)) { - return; - } - - for (ItemStack itemStack : inventory.getContents()) { - hideFixItem(itemStack); - } - } - - private void hideFixItem(@Nullable final ItemStack itemStack) { - if (itemStack == null) { - return; - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - if (ItemConversionOptions.isUsingForceHideFixer()) { - meta.removeItemFlags(ItemFlag.HIDE_ENCHANTS); - meta.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS); - } else { - if (meta.hasItemFlag(ItemFlag.HIDE_ENCHANTS) && meta.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS)) { - meta.removeItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS); - } - } - - itemStack.setItemMeta(meta); - } - - /** - * On player hold item. - *

- * Listener for hide fixer. - * - * @param event The event to listen for. - */ - @EventHandler - public void levelClamp(@NotNull final PlayerItemHeldEvent event) { - if (!ItemConversionOptions.isUsingLevelClamp()) { - return; - } - - if (event.getPlayer().hasPermission("ecoenchants.bypasslevelclamp")) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand(); - - clampItemLevels(itemStack, event.getPlayer()); - } - - private void clampItemLevels(@Nullable final ItemStack itemStack, - @NotNull final Player player) { - if (itemStack == null) { - return; - } - - if (!EnchantmentTarget.ALL.getMaterials().contains(itemStack.getType())) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - Map levels = FastItemStack.wrap(itemStack).getEnchants(true); - - if (meta instanceof EnchantmentStorageMeta storageMeta) { - levels.forEach((enchantment, integer) -> { - if (integer > enchantment.getMaxLevel()) { - storageMeta.removeStoredEnchant(enchantment); - storageMeta.addStoredEnchant(enchantment, enchantment.getMaxLevel(), true); - } - }); - } else { - levels.forEach((enchantment, integer) -> { - if (integer > enchantment.getMaxLevel()) { - meta.removeEnchant(enchantment); - meta.addEnchant(enchantment, enchantment.getMaxLevel(), true); - } - }); - } - - itemStack.setItemMeta(meta); - - if (ItemConversionOptions.isUsingLevelClampDelete()) { - itemStack.setType(Material.AIR); - itemStack.setAmount(0); - Bukkit.getLogger().warning(player.getName() + " has/had an illegal item!"); - } - } - - /** - * On player hold item. - *

- * Listener for hide fixer. - * - * @param event The event to listen for. - */ - @EventHandler - public void removeDisallowed(@NotNull final PlayerItemHeldEvent event) { - if (!ItemConversionOptions.isRemovingIllegal()) { - return; - } - - if (event.getPlayer().hasPermission("ecoenchants.allowillegal")) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - clampItemLevels(itemStack, event.getPlayer()); - } - - private void removeDisallowed(@Nullable final ItemStack itemStack, - @NotNull final Player player) { - if (itemStack == null) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - if (meta instanceof EnchantmentStorageMeta) { - return; - } - - boolean illegal = false; - - EcoEnchant illegalEnchant = null; - - for (Enchantment enchantment : meta.getEnchants().keySet()) { - if (enchantment instanceof EcoEnchant enchant) { - if (!enchant.getTargetMaterials().contains(itemStack.getType())) { - illegal = true; - illegalEnchant = enchant; - } - } - } - - if (!illegal) { - return; - } - - if (ItemConversionOptions.isDeletingIllegal()) { - itemStack.setType(Material.AIR); - itemStack.setItemMeta(new ItemStack(Material.AIR).getItemMeta()); - itemStack.setItemMeta(meta); - } else { - meta.removeEnchant(illegalEnchant); - } - - Bukkit.getLogger().warning(player.getName() + " has/had an illegal item!"); - } - - - /** - * On player hold item. - *

- * Listener for conversion. - * - * @param event The event to listen for. - */ - @EventHandler - public void invalidRemover(@NotNull final PlayerItemHeldEvent event) { - if (!ItemConversionOptions.isRemoveDisabled()) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - fixInvalid(itemStack); - } - - private void fixInvalid(@Nullable final ItemStack itemStack) { - if (itemStack == null) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - Map enchants = FastItemStack.wrap(itemStack).getEnchants(true); - - for (Enchantment enchantment : new HashSet<>(enchants.keySet())) { - if (enchantment instanceof EcoEnchant enchant) { - if (!enchant.isEnabled()) { - enchants.remove(enchantment); - } - } - } - - if (meta instanceof EnchantmentStorageMeta storageMeta) { - storageMeta.getStoredEnchants().forEach((enchantment, integer) -> { - storageMeta.removeStoredEnchant(enchantment); - }); - - enchants.forEach((enchantment, integer) -> { - storageMeta.addStoredEnchant(enchantment, integer, true); - }); - } else { - meta.getEnchants().forEach((enchantment, integer) -> { - meta.removeEnchant(enchantment); - }); - - enchants.forEach((enchantment, integer) -> { - meta.addEnchant(enchantment, integer, true); - }); - } - - itemStack.setItemMeta(meta); - } - - /** - * On player hold item. - *

- * Listener for conversion. - * - * @param event The event to listen for. - */ - @EventHandler - public void hardCapClamp(@NotNull final PlayerItemHeldEvent event) { - if (!ItemConversionOptions.isUsingHardCapClamp()) { - return; - } - - - if (!this.getPlugin().getConfigYml().getBool("anvil.hard-cap.enabled")) { - return; - } - - if (event.getPlayer().hasPermission("ecoenchants.anvil.bypasshardcap")) { - return; - } - - ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getNewSlot()); - - clampHardCap(itemStack); - } - - private void clampHardCap(@Nullable final ItemStack itemStack) { - if (itemStack == null) { - return; - } - - ItemMeta meta = itemStack.getItemMeta(); - if (meta == null) { - return; - } - - Map enchants = FastItemStack.wrap(itemStack).getEnchants(true); - Map replacement = new HashMap<>(); - - int i = 0; - for (Map.Entry entry : enchants.entrySet()) { - if (i >= this.getPlugin().getConfigYml().getInt("anvil.hard-cap.cap")) { - break; - } - - Enchantment enchantment = entry.getKey(); - if (enchantment instanceof EcoEnchant enchant) { - if (!enchant.hasFlag("hard-cap-ignore")) { - i++; - replacement.put(entry.getKey(), entry.getValue()); - } - } else { - i++; - replacement.put(entry.getKey(), entry.getValue()); - } - } - - for (Map.Entry entry : enchants.entrySet()) { - Enchantment enchantment = entry.getKey(); - if (enchantment instanceof EcoEnchant enchant) { - if (enchant.hasFlag("hard-cap-ignore")) { - replacement.put(entry.getKey(), entry.getValue()); - } - } - } - - if (meta instanceof EnchantmentStorageMeta storageMeta) { - storageMeta.getStoredEnchants().forEach((enchantment, integer) -> { - storageMeta.removeStoredEnchant(enchantment); - }); - - replacement.forEach((enchantment, integer) -> { - storageMeta.addStoredEnchant(enchantment, integer, true); - }); - } else { - meta.getEnchants().forEach((enchantment, integer) -> { - meta.removeEnchant(enchantment); - }); - - replacement.forEach((enchantment, integer) -> { - meta.addEnchant(enchantment, integer, true); - }); - } - - itemStack.setItemMeta(meta); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/LazyHealthFixListener.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/LazyHealthFixListener.java deleted file mode 100644 index 4b109237..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/LazyHealthFixListener.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -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.jetbrains.annotations.NotNull; - -public class LazyHealthFixListener extends PluginDependent implements Listener { - public LazyHealthFixListener(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @EventHandler - public void onJoin(@NotNull final PlayerJoinEvent event) { - Player player = event.getPlayer(); - - if (player.getHealth() >= 19.0) { - this.getPlugin().getScheduler().runLater(3, () -> player.setHealth( - player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() - )); - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellActivateEvent.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellActivateEvent.java deleted file mode 100644 index d67a4d6a..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/SpellActivateEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import lombok.Getter; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; -import org.jetbrains.annotations.NotNull; - -public class SpellActivateEvent extends PlayerEvent implements Cancellable { - /** - * Internal, for bukkit. - */ - private static final HandlerList HANDLERS = new HandlerList(); - - /** - * The spell that was activated. - */ - @Getter - private final Spell spell; - - /** - * If the spell activation was cancelled. - */ - private boolean cancelled; - - /** - * Create new SpellActivateEvent. - * - * @param player The player. - * @param spell The spell. - */ - public SpellActivateEvent(@NotNull final Player player, - @NotNull final Spell spell) { - super(player); - - this.spell = spell; - this.cancelled = false; - } - - /** - * Bukkit parity. - * - * @return The handler list. - */ - public static HandlerList getHandlerList() { - return HANDLERS; - } - - @Override - public boolean isCancelled() { - return cancelled; - } - - @Override - public void setCancelled(final boolean cancel) { - this.cancelled = cancel; - } - - @NotNull - @Override - public HandlerList getHandlers() { - return HANDLERS; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/TimedRunnable.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/TimedRunnable.java deleted file mode 100644 index e6f399f3..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/TimedRunnable.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -public interface TimedRunnable extends Runnable { - /** - * Get the time between repetitions. - * - * @return The time. - */ - long getTime(); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/VelocityChecks.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/VelocityChecks.java deleted file mode 100644 index 3ec2e29b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/VelocityChecks.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class VelocityChecks { - /** - * Checks to see if the velocity is unsafe. This is taken from Papers 0054-Add-velocity-warnings.patch. - * - * @param vel The velocity. - * @return If unsafe. - */ - public static boolean isUnsafeVelocity(@NotNull final Vector vel) { - final double x = vel.getX(); - final double y = vel.getY(); - final double z = vel.getZ(); - - return x > 4 || x < -4 || y > 4 || y < -4 || z > 4 || z < -4; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/Watcher.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/Watcher.java deleted file mode 100644 index cd9f8251..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/Watcher.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.eco.core.events.ArmorEquipEvent; -import org.bukkit.block.Block; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Trident; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.jetbrains.annotations.NotNull; - -public interface Watcher { - - /** - * Called when an entity shoots another entity with an arrow. - * - * @param attacker The shooter. - * @param victim The victim. - * @param arrow The arrow entity. - * @param level The level of the enchantment on the arrow. - * @param event The event that called this watcher. - */ - default void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity damages another entity with a trident throw. - * - * @param attacker The shooter. - * @param victim The victim. - * @param trident The trident entity. - * @param level The level of the enchantment on the trident. - * @param event The event that called this watcher. - */ - default void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player jumps. - * - * @param player The player. - * @param level The level of the enchantment found on the player's armor. - * @param event The event that called this watcher. - */ - default void onJump(@NotNull final Player player, - final int level, - @NotNull final PlayerMoveEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity attacks another entity with a melee attack. - * - * @param attacker The attacker. - * @param victim The victim. - * @param level The level of the enchantment found on the attacker's weapon. - * @param event The event that called this watcher. - */ - default void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity shoots a bow. - * - * @param shooter The entity that shot the bow. - * @param arrow The arrow that was shot. - * @param level The level of the enchantment found on the bow. - * @param event The event that called this watcher. - */ - default void onBowShoot(@NotNull final LivingEntity shooter, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityShootBowEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity shoots a projectile. - * - * @param shooter The entity that shot the bow. - * @param projectile The projectile that was shot. - * @param level The level of the enchantment found on the projectile. - * @param event The event that called this watcher. - */ - default void onProjectileLaunch(@NotNull final LivingEntity shooter, - @NotNull final Projectile projectile, - final int level, - @NotNull final ProjectileLaunchEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity takes fall damage. - * - * @param faller The entity that took the fall damage. - * @param level The level of the enchantment found on the entity's armor. - * @param event The event that called this watcher. - */ - default void onFallDamage(@NotNull final LivingEntity faller, - final int level, - @NotNull final EntityDamageEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an arrow hits a block or entity. - * - * @param shooter The entity that shot the arrow. - * @param level The level of the enchantment found on the arrow. - * @param event The event that called this watcher. - */ - default void onArrowHit(@NotNull final LivingEntity shooter, - final int level, - @NotNull final ProjectileHitEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a trident hits a block or entity. - * - * @param shooter The entity that threw the trident. - * @param level The level of the enchantment found on the trident. - * @param event The event that called this watcher. - */ - default void onTridentHit(@NotNull final LivingEntity shooter, - final int level, - @NotNull final ProjectileHitEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player breaks a block. - * - * @param player The player. - * @param block The block that was broken. - * @param level The level of the enchantment found on the player's main hand item. - * @param event The event that called this watcher. - */ - default void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity takes damage wearing armor. - * - * @param victim The entity that took damage. - * @param level The level of the enchantment found on the entity's armor. - * @param event The event that called this watcher. - */ - default void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity puts on or takes off armor with an enchantment. - * - * @param player The player that equipped the armor. - * @param level The level of the enchantment found on the player's armor. - * @param event The event that called this watcher. - */ - @Deprecated - default void onArmorEquip(@NotNull final Player player, - final int level, - @NotNull final ArmorEquipEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity puts on or takes off armor with an enchantment. - * - * @param player The player that equipped the armor. - * @param level The level of the enchantment found on the player's armor. - * @param event The event that called this watcher. - */ - default void onArmorEquip(@NotNull final Player player, - final int level, - @NotNull final ArmorChangeEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player damages a block. - * - * @param player The player that damaged the block. - * @param block The damaged block. - * @param level The level of the enchantment found on the player's main hand. - * @param event The event that called this watcher. - */ - default void onDamageBlock(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockDamageEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when an entity throws a trident. - * - * @param shooter The entity that threw the trident. - * @param trident The trident that was thrown. - * @param level The level of the enchantment found on the trident. - * @param event The event that called this watcher. - */ - default void onTridentLaunch(@NotNull final LivingEntity shooter, - @NotNull final Trident trident, - final int level, - @NotNull final ProjectileLaunchEvent event) { - // Empty default as enchantments only override required watchers. - } - - /** - * Called when a player blocks an attack with a shield. - * - * @param blocker The player that blocked the attack. - * @param attacker The attacker. - * @param level The level of the enchantment found on the shield. - * @param event The event that called this watcher. - */ - default void onDeflect(@NotNull final Player blocker, - @NotNull final LivingEntity attacker, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - // Empty default as enchantments only override required watchers. - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java deleted file mode 100644 index b6859840..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java +++ /dev/null @@ -1,779 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.PluginDependent; -import com.willfp.eco.core.config.updating.ConfigUpdater; -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.eco.core.events.PlayerJumpEvent; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.eco.core.integrations.mcmmo.McmmoManager; -import com.willfp.eco.util.PlayerUtils; -import com.willfp.ecoenchants.EcoEnchantsPlugin; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.libreforge.LibReforgeUtils; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.AbstractArrow; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.Map; - -public class WatcherTriggers extends PluginDependent implements Listener { - /** - * If watchers should be triggered against npcs. - */ - private static boolean allowOnNPC = false; - - /** - * Create new listener for watcher events. - * - * @param plugin The plugin to link the events to. - */ - public WatcherTriggers(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - /** - * Update if allowed on npc. - * - * @param plugin Instance of EcoEnchants. - */ - @ConfigUpdater - public static void update(@NotNull final EcoEnchantsPlugin plugin) { - allowOnNPC = plugin.getConfigYml().getBool("allow-on-npc"); - } - - /** - * Called when an entity shoots another entity with an arrow. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onArrowDamage(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getDamager() instanceof Arrow arrow)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - if (((Arrow) event.getDamager()).getShooter() == null) { - return; - } - - if (!(((Arrow) event.getDamager()).getShooter() instanceof LivingEntity attacker)) { - return; - } - - if (!allowOnNPC) { - if (victim.hasMetadata("NPC")) { - return; - } - } - - if (attacker instanceof Player && !AntigriefManager.canInjure((Player) attacker, victim)) { - return; - } - - if (event.isCancelled()) { - return; - } - - EnchantChecks.getEnchantsOnArrow(arrow).forEach(((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(attacker)) { - return; - } - - enchant.onArrowDamage(attacker, victim, arrow, level, event); - })); - } - - /** - * Called when an entity damages another entity with a trident throw. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onTridentDamage(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getDamager() instanceof Trident trident)) { - return; - } - - if (!(((Trident) event.getDamager()).getShooter() instanceof LivingEntity attacker)) { - return; - } - - if (((Trident) event.getDamager()).getShooter() == null) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - if (event.isCancelled()) { - return; - } - - ItemStack item = trident.getItem(); - - if (!allowOnNPC) { - if (victim.hasMetadata("NPC")) { - return; - } - } - - if (attacker instanceof Player && !AntigriefManager.canInjure((Player) attacker, victim)) { - return; - } - - EnchantChecks.getEnchantsOnItem(item).forEach(((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(attacker)) { - return; - } - - enchant.onTridentDamage(attacker, victim, trident, level, event); - })); - } - - /** - * Called when a player jumps. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onJump(@NotNull final PlayerJumpEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - - EnchantChecks.getEnchantsOnArmor(player).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(player)) { - return; - } - - enchant.onJump(player, level, event); - }); - } - - /** - * Called when an entity attacks another entity with a melee attack. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onMeleeAttack(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getDamager() instanceof LivingEntity attacker)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (event.getCause() == EntityDamageEvent.DamageCause.THORNS) { - return; - } - - if (!allowOnNPC) { - if (victim.hasMetadata("NPC")) { - return; - } - } - - if (attacker instanceof Player && !AntigriefManager.canInjure((Player) attacker, victim)) { - return; - } - - EnchantChecks.getEnchantsOnMainhand(attacker).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(attacker.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(attacker)) { - return; - } - - enchant.onMeleeAttack(attacker, victim, level, event); - }); - } - - /** - * Called when an entity shoots a bow. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onBowShoot(@NotNull final EntityShootBowEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (event.getProjectile().getType() != EntityType.ARROW) { - return; - } - - LivingEntity shooter = event.getEntity(); - Arrow arrow = (Arrow) event.getProjectile(); - - EnchantChecks.getEnchantsOnMainhand(shooter).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(shooter)) { - return; - } - - enchant.onBowShoot(shooter, arrow, level, event); - }); - } - - /** - * Called when an entity launches a projectile. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onProjectileLaunch(@NotNull final ProjectileLaunchEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof AbstractArrow)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof Player)) { - return; - } - - LivingEntity shooter = (LivingEntity) event.getEntity().getShooter(); - - Projectile projectile = event.getEntity(); - - if (shooter.getEquipment() == null) { - return; - } - - ItemStack item = shooter.getEquipment().getItemInMainHand(); - - if (projectile instanceof Trident trident) { - item = trident.getItem(); - } - - EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(shooter)) { - return; - } - - enchant.onProjectileLaunch(shooter, projectile, level, event); - }); - } - - /** - * Called when an entity takes fall damage. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onFallDamage(@NotNull final EntityDamageEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!event.getCause().equals(EntityDamageEvent.DamageCause.FALL)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - EnchantChecks.getEnchantsOnArmor(victim).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(victim.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(victim)) { - return; - } - - enchant.onFallDamage(victim, level, event); - }); - } - - /** - * Called when an arrow hits a block or entity. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onArrowHit(@NotNull final ProjectileHitEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof LivingEntity shooter)) { - return; - } - - if (!(event.getEntity() instanceof Arrow arrow)) { - return; - } - - if (event.getEntity().getShooter() == null) { - return; - } - - EnchantChecks.getEnchantsOnArrow(arrow).forEach(((enchant, level) -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(shooter)) { - return; - } - - enchant.onArrowHit(shooter, level, event); - })); - } - - /** - * Called when a trident hits a block or entity. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onTridentHit(@NotNull final ProjectileHitEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof LivingEntity shooter)) { - return; - } - - if (event.getEntity().getShooter() == null) { - return; - } - - if (!(event.getEntity() instanceof Trident trident)) { - return; - } - - ItemStack item = trident.getItem(); - - EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(shooter)) { - return; - } - - enchant.onTridentHit(shooter, level, event); - }); - } - - /** - * Called when a player breaks a block. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onBlockBreak(@NotNull final BlockBreakEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (!AntigriefManager.canBreakBlock(player, block)) { - return; - } - - if (event.isCancelled()) { - return; - } - - EnchantChecks.getEnchantsOnMainhand(player).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(player)) { - return; - } - - enchant.onBlockBreak(player, block, level, event); - }); - } - - /** - * Called when an entity takes damage wearing armor. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onDamageWearingArmor(@NotNull final EntityDamageEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity victim)) { - return; - } - - EnchantChecks.getEnchantsOnArmor(victim).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(victim.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(victim)) { - return; - } - - enchant.onDamageWearingArmor(victim, level, event); - }); - } - - /** - * Called when an entity puts on or takes off armor with an enchantment. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - @Deprecated - public void onArmorEquip(@NotNull final ArmorEquipEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - - this.getPlugin().getScheduler().runLater(() -> EcoEnchants.values().forEach(enchant -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(player)) { - return; - } - - int level = EnchantChecks.getArmorPoints(player, enchant); - enchant.onArmorEquip(player, level, event); - }), 1); - } - - /** - * Called when an entity puts on or takes off armor with an enchantment. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onArmorChange(@NotNull final ArmorChangeEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - - EcoEnchants.values().forEach(enchant -> { - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(player)) { - return; - } - - int level = EnchantChecks.getArmorPoints(player, enchant); - enchant.onArmorEquip(player, level, event); - }); - } - - /** - * Called when a player damages a block. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onDamageBlock(@NotNull final BlockDamageEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (event.getBlock().getDrops(player.getInventory().getItemInMainHand()).isEmpty()) { - return; - } - - EnchantChecks.getEnchantsOnMainhand(player).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(player)) { - return; - } - - enchant.onDamageBlock(player, block, level, event); - }); - } - - /** - * Called when an entity throws a trident. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onTridentLaunch(@NotNull final ProjectileLaunchEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof Trident trident)) { - return; - } - - if (!(event.getEntity().getShooter() instanceof LivingEntity)) { - return; - } - - LivingEntity shooter = (LivingEntity) trident.getShooter(); - ItemStack item = trident.getItem(); - assert shooter != null; - - EnchantChecks.getEnchantsOnItem(item).forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(shooter.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(shooter)) { - return; - } - - enchant.onTridentLaunch(shooter, trident, level, event); - }); - } - - /** - * Called when a player blocks an attack with a shield. - * - * @param event The event to listen for. - */ - @EventHandler(ignoreCancelled = true) - public void onDeflect(@NotNull final EntityDamageByEntityEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - - if (!(event.getEntity() instanceof Player blocker)) { - return; - } - - LivingEntity attacker = PlayerUtils.tryAsPlayer(event.getDamager()); - - if (attacker == null) { - return; - } - - if (attacker.equals(blocker)) { - return; - } - - if (!blocker.isBlocking()) { - return; - } - - if (!AntigriefManager.canInjure(blocker, attacker)) { - return; - } - - Map enchants = blocker.getInventory().getItemInMainHand().getType() == Material.SHIELD - ? EnchantChecks.getEnchantsOnMainhand(blocker) - : EnchantChecks.getEnchantsOnOffhand(blocker); - - enchants.forEach((enchant, level) -> { - if (event.isCancelled()) { - return; - } - - if (!enchant.isEnabled()) { - return; - } - - if (enchant.getDisabledWorlds().contains(blocker.getWorld())) { - return; - } - - if (!enchant.areRequirementsMet(blocker)) { - return; - } - - enchant.onDeflect(blocker, attacker, level, event); - }); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WeakMetadata.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WeakMetadata.java deleted file mode 100644 index 70bac110..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WeakMetadata.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util; - -import org.bukkit.entity.Entity; - -import java.util.Map; -import java.util.WeakHashMap; - -/** - * Weak metadata to prevent memory leaks. - *

- * @author Akiranya (Nailm) - */ -public class WeakMetadata { - - /** - * Summoned entities by the summoning enchantments. - *

- *

K: summoned entity - *

V: the target of the summoned entity - */ - public static final Map SUMMONED_ENTITY_MEMORY = new WeakHashMap<>(); - - /** - * Victim entities which the summoned entities target at. - *

- *

K: entity which the summoned entities target at - *

V: nothing (passing null is fine) - */ - public static final Map SUMMONED_ENTITY_TARGET = new WeakHashMap<>(); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/Requirement.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/Requirement.java deleted file mode 100644 index 8e27c7ea..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/Requirement.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public interface Requirement { - /** - * If the requirement is met for a player. - * - * @param player The player. - * @param args The args. - * @return If met. - */ - boolean isMetBy(@NotNull Player player, - @NotNull List args); -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementHasPermission.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementHasPermission.java deleted file mode 100644 index 92e50022..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementHasPermission.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class RequirementHasPermission implements Requirement { - @Override - public boolean isMetBy(@NotNull final Player player, - @NotNull final List args) { - if (args.isEmpty()) { - return false; - } - - return player.hasPermission(args.get(0)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderEquals.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderEquals.java deleted file mode 100644 index c51dcedb..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderEquals.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class RequirementPlaceholderEquals implements Requirement { - @Override - public boolean isMetBy(@NotNull final Player player, - @NotNull final List args) { - if (args.size() < 2) { - return false; - } - - return PlaceholderManager.translatePlaceholders( - args.get(0), - player - ).equalsIgnoreCase(args.get(1)); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderGreaterThan.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderGreaterThan.java deleted file mode 100644 index 8562660f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderGreaterThan.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class RequirementPlaceholderGreaterThan implements Requirement { - @Override - public boolean isMetBy(@NotNull final Player player, - @NotNull final List args) { - if (args.size() < 2) { - return false; - } - - try { - return Double.parseDouble(PlaceholderManager.translatePlaceholders( - args.get(0), - player - )) >= Double.parseDouble(args.get(1)); - } catch (NumberFormatException e) { - return false; - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderLessThan.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderLessThan.java deleted file mode 100644 index 6f4694c2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementPlaceholderLessThan.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import com.willfp.eco.core.integrations.placeholder.PlaceholderManager; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class RequirementPlaceholderLessThan implements Requirement { - @Override - public boolean isMetBy(@NotNull final Player player, - @NotNull final List args) { - if (args.size() < 2) { - return false; - } - - try { - return Double.parseDouble(PlaceholderManager.translatePlaceholders( - args.get(0), - player - )) < Double.parseDouble(args.get(1)); - } catch (NumberFormatException e) { - return false; - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementTrue.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementTrue.java deleted file mode 100644 index 6a556b01..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/RequirementTrue.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class RequirementTrue implements Requirement { - @Override - public boolean isMetBy(@NotNull final Player player, - @NotNull final List args) { - return true; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/Requirements.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/Requirements.java deleted file mode 100644 index fcf1a1e2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/requirements/Requirements.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.willfp.ecoenchants.enchantments.util.requirements; - -import org.jetbrains.annotations.NotNull; - -public final class Requirements { - /** - * Requires a player to have a permission. - */ - public static final Requirement HAS_PERMISSION = new RequirementHasPermission(); - - /** - * Placeholder equals value. - */ - public static final Requirement PLACEHOLDER_EQUALS = new RequirementPlaceholderEquals(); - - /** - * Numeric placeholder greater than value. - */ - public static final Requirement PLACEHOLDER_GREATER_THAN = new RequirementPlaceholderGreaterThan(); - - /** - * Numeric placeholder less than value. - */ - public static final Requirement PLACEHOLDER_LESS_THAN = new RequirementPlaceholderLessThan(); - - /** - * Get Requirements matching ID. - * - * @param name The ID to search for. - * @return The matching Requirements. - */ - @NotNull - public static Requirement getByID(@NotNull final String name) { - return switch (name.toLowerCase()) { - case "has-permission" -> HAS_PERMISSION; - case "placeholder-equals" -> PLACEHOLDER_EQUALS; - case "placeholder-greater-than" -> PLACEHOLDER_GREATER_THAN; - case "placeholder-less-than" -> PLACEHOLDER_LESS_THAN; - default -> new RequirementTrue(); - }; - } - - private Requirements() { - throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); - } -} \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/MythicMobsManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/MythicMobsManager.java deleted file mode 100644 index edeca773..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/MythicMobsManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.willfp.ecoenchants.integrations.mythicmobs; - -import lombok.experimental.UtilityClass; -import org.bukkit.entity.Entity; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -@UtilityClass -public class MythicMobsManager { - /** - * All registered MythicMobs integrations. - */ - private static final Set REGISTERED = new HashSet<>(); - - /** - * Register a new MythicMobs integration. - * - * @param integration The integration to register. - */ - public static void register(@NotNull final MythicMobsWrapper integration) { - REGISTERED.add(integration); - } - - /** - * Check if given entity should drop items or not. - * - * @param entity - The entity to check. - * @return - If given entity can drop items or not. - */ - public static boolean canDropItems(@NotNull final Entity entity) { - for (MythicMobsWrapper wrapper : REGISTERED) { - if (!wrapper.canDropItems(entity)) { - return false; - } - } - - return true; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/MythicMobsWrapper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/MythicMobsWrapper.java deleted file mode 100644 index 43e21e35..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/MythicMobsWrapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.integrations.mythicmobs; - -import com.willfp.eco.core.integrations.Integration; -import org.bukkit.entity.Entity; -import org.jetbrains.annotations.NotNull; - -public interface MythicMobsWrapper extends Integration { - /** - * If an entity can drop items. - * - * @param entity The entity. - * @return If can drop items. - * @see MythicMobsManager#canDropItems(Entity) - */ - boolean canDropItems(@NotNull Entity entity); -} - diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/plugins/IntegrationMythicMobs.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/plugins/IntegrationMythicMobs.java deleted file mode 100644 index 94abebea..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/mythicmobs/plugins/IntegrationMythicMobs.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.willfp.ecoenchants.integrations.mythicmobs.plugins; - -import com.willfp.ecoenchants.integrations.mythicmobs.MythicMobsWrapper; -import io.lumine.mythic.bukkit.MythicBukkit; -import org.bukkit.entity.Entity; -import org.jetbrains.annotations.NotNull; - -public class IntegrationMythicMobs implements MythicMobsWrapper { - @Override - public boolean canDropItems(@NotNull final Entity entity) { - if (!MythicBukkit.inst().getAPIHelper().isMythicMob(entity)) { - return true; - } - - return !MythicBukkit.inst().getAPIHelper().getMythicMobInstance(entity).getType().getPreventMobKillDrops() - && !MythicBukkit.inst().getAPIHelper().getMythicMobInstance(entity).getType().getPreventOtherDrops(); - } - - @Override - public String getPluginName() { - return "MythicMobs"; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/RegistrationManager.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/RegistrationManager.java deleted file mode 100644 index 72eb903f..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/RegistrationManager.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.integrations.registration; - -import lombok.experimental.UtilityClass; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -import java.util.HashSet; -import java.util.Set; - -@UtilityClass -public class RegistrationManager { - /** - * All registered essentials integrations. - */ - private static final Set REGISTERED = new HashSet<>(); - - /** - * Register a new essentials integration. - * - * @param essentials The integration to register. - */ - public static void register(@NotNull final RegistrationWrapper essentials) { - REGISTERED.add(essentials); - } - - /** - * Register all {@link com.willfp.ecoenchants.enchantments.EcoEnchant}s with Essentials. - */ - public static void registerEnchantments() { - for (RegistrationWrapper wrapper : REGISTERED) { - try { - wrapper.registerAllEnchantments(); - } catch (Exception e) { - Bukkit.getLogger().warning("Failed to register enchantments for plugin " + wrapper.getPluginName()); - } - } - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/RegistrationWrapper.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/RegistrationWrapper.java deleted file mode 100644 index 2804f63b..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/RegistrationWrapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.willfp.ecoenchants.integrations.registration; - -import com.willfp.eco.core.integrations.Integration; - -public interface RegistrationWrapper extends Integration { - /** - * @see RegistrationManager#registerEnchantments(); - */ - void registerAllEnchantments(); -} - diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationCMI.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationCMI.java deleted file mode 100644 index ff6b241c..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationCMI.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.integrations.registration.plugins; - -import com.willfp.ecoenchants.integrations.registration.RegistrationWrapper; -import net.Zrips.CMILib.Enchants.CMIEnchantment; - -public class IntegrationCMI implements RegistrationWrapper { - @Override - public void registerAllEnchantments() { - CMIEnchantment.initialize(); - CMIEnchantment.saveEnchants(); - } - - @Override - public String getPluginName() { - return "CMI"; - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java deleted file mode 100644 index 2d1c01f2..00000000 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/integrations/registration/plugins/IntegrationEssentials.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.willfp.ecoenchants.integrations.registration.plugins; - -import com.earth2me.essentials.Enchantments; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.integrations.registration.RegistrationWrapper; - -public class IntegrationEssentials implements RegistrationWrapper { - @Override - public void registerAllEnchantments() { - for (EcoEnchant enchantment : EcoEnchants.values()) { - Enchantments.registerEnchantment(enchantment.getKey().getKey(), enchantment); - Enchantments.registerAlias(enchantment.getPermissionName(), enchantment); - } - } - - @Override - public String getPluginName() { - return "Essentials"; - } -} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt new file mode 100644 index 00000000..bc031662 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt @@ -0,0 +1,90 @@ +package com.willfp.ecoenchants + +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.eco.core.display.DisplayModule +import com.willfp.eco.core.integrations.IntegrationLoader +import com.willfp.ecoenchants.commands.CommandEcoEnchants +import com.willfp.ecoenchants.commands.CommandEnchantInfo +import com.willfp.ecoenchants.config.RarityYml +import com.willfp.ecoenchants.config.TargetsYml +import com.willfp.ecoenchants.config.TypesYml +import com.willfp.ecoenchants.config.VanillaEnchantsYml +import com.willfp.ecoenchants.display.EnchantDisplay +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.enchants.impl.EnchantmentTelekinesis +import com.willfp.ecoenchants.integrations.EnchantRegistrations +import com.willfp.ecoenchants.integrations.plugins.CMIIntegration +import com.willfp.ecoenchants.integrations.plugins.EssentialsIntegration +import com.willfp.ecoenchants.mechanics.AnvilSupport +import com.willfp.ecoenchants.mechanics.EnchantingTableSupport +import com.willfp.ecoenchants.mechanics.LootSupport +import com.willfp.ecoenchants.mechanics.VillagerSupport +import com.willfp.ecoenchants.target.ActiveEnchantUpdateListeners +import com.willfp.ecoenchants.target.EnchantLookup.heldEnchantLevels +import com.willfp.libreforge.LibReforgePlugin +import org.bukkit.event.Listener + +class EcoEnchantsPlugin : LibReforgePlugin() { + val targetsYml = TargetsYml(this) + val rarityYml = RarityYml(this) + val typesYml = TypesYml(this) + val vanillaEnchantsYml = VanillaEnchantsYml(this) + + init { + instance = this + } + + override fun handleEnableAdditional() { + copyConfigs("enchants") + + registerHolderProvider { it.heldEnchantLevels } + } + + override fun handleReloadAdditional() { + // Load hardcoded enchantments + EnchantmentTelekinesis(this) + + logger.info(EcoEnchants.values().size.toString() + " Enchants Loaded") + } + + override fun loadListeners(): List { + return listOf( + ActiveEnchantUpdateListeners(this), + VillagerSupport(this), + EnchantingTableSupport(this), + LootSupport(this), + AnvilSupport(this) + ) + } + + override fun loadAdditionalIntegrations(): List { + return listOf( + IntegrationLoader("Essentials") { EnchantRegistrations.register(EssentialsIntegration()) }, + IntegrationLoader("CMI") { EnchantRegistrations.register(CMIIntegration()) } + ) + } + + override fun loadPluginCommands(): List { + return listOf( + CommandEcoEnchants(this), + CommandEnchantInfo(this) + ) + } + + override fun createDisplayModule(): DisplayModule { + return EnchantDisplay(this) + } + + override fun getMinimumEcoVersion(): String { + return "6.38.0" + } + + companion object { + /** + * Instance of EcoEnchants. + */ + @JvmStatic + lateinit var instance: EcoEnchantsPlugin + private set + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandEcoEnchants.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandEcoEnchants.kt new file mode 100644 index 00000000..15635fc0 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandEcoEnchants.kt @@ -0,0 +1,18 @@ +package com.willfp.ecoenchants.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import org.bukkit.command.CommandSender + +class CommandEcoEnchants(plugin: EcoPlugin) : PluginCommand(plugin, "ecoenchants", "ecoenchants.command.ecoenchants", false) { + override fun onExecute(sender: CommandSender, args: List) { + sender.sendMessage( + plugin.langYml.getMessage("invalid-command") + ) + } + + init { + addSubcommand(CommandReload(plugin)) + .addSubcommand(CommandToggleDescriptions(plugin)) + } +} \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandEnchantInfo.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandEnchantInfo.kt new file mode 100644 index 00000000..122f5ccb --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandEnchantInfo.kt @@ -0,0 +1,64 @@ +package com.willfp.ecoenchants.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.enchants.EnchantInfo +import org.bukkit.ChatColor +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player +import org.bukkit.util.StringUtil + + +class CommandEnchantInfo(plugin: EcoPlugin) : PluginCommand( + plugin, "enchantinfo", "ecoenchants.command.enchantinfo", true +) { + override fun onExecute(sender: CommandSender, args: List) { + sender as Player + + if (args.isEmpty()) { + sender.sendMessage(this.plugin.langYml.getMessage("missing-enchant")) + return + } + + val nameBuilder = StringBuilder() + + args.forEach { arg -> nameBuilder.append(arg).append(" ") } + var searchName = nameBuilder.toString() + searchName = searchName.substring(0, searchName.length - 1) + + val enchantment = EcoEnchants.getByName(searchName) + + if (enchantment == null) { + val message = plugin.langYml.getMessage("not-found").replace("%name%", searchName) + sender.sendMessage(message) + return + } + + EnchantInfo.open(sender, plugin, enchantment) + } + + override fun tabComplete(sender: CommandSender, args: List): List { + val completions = mutableListOf() + + val names = EcoEnchants.values().mapNotNull { ChatColor.stripColor(it.displayName) } + + if (args.isEmpty()) { + // Currently, this case is not ever reached + return names + } + + StringUtil.copyPartialMatches(args.joinToString(" "), names, completions) + + if (args.size > 1) { // Remove all previous words from the candidate of completions + val finishedArgs = args.toMutableList() + finishedArgs.drop(args.size - 1) + val prefix = finishedArgs.joinToString(" ") + completions.clear() + completions.stream().map { it.removePrefix(prefix).trim() } + } + + completions.sort() + return completions + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandReload.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandReload.kt new file mode 100644 index 00000000..eba928cc --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandReload.kt @@ -0,0 +1,15 @@ +package com.willfp.ecoenchants.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.Subcommand +import com.willfp.eco.util.StringUtils +import org.bukkit.command.CommandSender + +class CommandReload(plugin: EcoPlugin) : Subcommand(plugin, "reload", "ecoenchants.command.reload", false) { + override fun onExecute(sender: CommandSender, args: List) { + sender.sendMessage( + plugin.langYml.getMessage("reloaded", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS) + .replace("%time%", plugin.reloadWithTime().toString()) + ) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandToggleDescriptions.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandToggleDescriptions.kt new file mode 100644 index 00000000..366cc1f6 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/commands/CommandToggleDescriptions.kt @@ -0,0 +1,50 @@ +package com.willfp.ecoenchants.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.Subcommand +import com.willfp.eco.core.data.keys.PersistentDataKey +import com.willfp.eco.core.data.keys.PersistentDataKeyType +import com.willfp.eco.core.data.profile +import com.willfp.eco.util.NamespacedKeyUtils +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +class CommandToggleDescriptions(plugin: EcoPlugin) : Subcommand( + plugin, + "toggledescriptions", + "ecoenchants.command.toggledescriptions", + true +) { + + override fun onExecute( + player: CommandSender, + args: List + ) { + player as Player + + if (!plugin.configYml.getBool("display.descriptions.enabled")) { + player.sendMessage(plugin.langYml.getMessage("descriptions-disabled")) + return + } + + var currentStatus = player.profile.read(descriptionsKey) + currentStatus = !currentStatus + player.profile.write(descriptionsKey, currentStatus) + if (currentStatus) { + player.sendMessage(plugin.langYml.getMessage("enabled-descriptions")) + } else { + player.sendMessage(plugin.langYml.getMessage("disabled-descriptions")) + } + } + + companion object { + private val descriptionsKey = PersistentDataKey( + NamespacedKeyUtils.create("ecoenchants", "descriptions_enabled"), + PersistentDataKeyType.BOOLEAN, + true + ).player() + + val Player.seesEnchantmentDescriptions: Boolean + get() = this.profile.read(descriptionsKey) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt new file mode 100644 index 00000000..c12dd272 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/config/Configs.kt @@ -0,0 +1,10 @@ +package com.willfp.ecoenchants.config + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.config.BaseConfig +import com.willfp.eco.core.config.ConfigType + +class TypesYml(plugin: EcoPlugin) : BaseConfig("types", plugin, true, ConfigType.YAML) +class TargetsYml(plugin: EcoPlugin) : BaseConfig("targets", plugin, true, ConfigType.YAML) +class RarityYml(plugin: EcoPlugin) : BaseConfig("rarity", plugin, true, ConfigType.YAML) +class VanillaEnchantsYml(plugin: EcoPlugin) : BaseConfig("vanillaenchants", plugin, true, ConfigType.YAML) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/EnchantDisplay.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/EnchantDisplay.kt new file mode 100644 index 00000000..2e8968c0 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/EnchantDisplay.kt @@ -0,0 +1,118 @@ +package com.willfp.ecoenchants.display + +import com.willfp.eco.core.display.Display +import com.willfp.eco.core.display.DisplayModule +import com.willfp.eco.core.display.DisplayPriority +import com.willfp.eco.core.display.DisplayProperties +import com.willfp.eco.core.fast.fast +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.commands.CommandToggleDescriptions.Companion.seesEnchantmentDescriptions +import com.willfp.ecoenchants.display.EnchantSorter.sortForDisplay +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.wrap +import com.willfp.ecoenchants.target.EnchantmentTargets.isEnchantable +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemFlag +import org.bukkit.inventory.ItemStack +import org.bukkit.persistence.PersistentDataType + +@Suppress("DEPRECATION") +class EnchantDisplay(private val plugin: EcoEnchantsPlugin) : DisplayModule(plugin, DisplayPriority.HIGH) { + private val internalHideEnchants = + plugin.namespacedKeyFactory.create("ecoenchantlore-skip") // Same for backwards compatibility + + override fun display( + itemStack: ItemStack, + player: Player?, + props: DisplayProperties, + vararg args: Any + ) { + if (!itemStack.isEnchantable) { + return + } + + val fast = itemStack.fast() + val pdc = fast.persistentDataContainer + + if ( + fast.hasItemFlag(ItemFlag.HIDE_ENCHANTS) + || fast.hasItemFlag(ItemFlag.HIDE_POTION_EFFECTS) + || pdc.has(internalHideEnchants, PersistentDataType.INTEGER) + ) { + fast.addItemFlags(ItemFlag.HIDE_ENCHANTS) + if (itemStack.type == Material.ENCHANTED_BOOK) { + fast.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS) + } + pdc.set(internalHideEnchants, PersistentDataType.INTEGER, 1) + return + } + + val lore = fast.lore + val enchantLore = mutableListOf() + + // Get enchants mapped to EcoEnchantLike + val unsorted = fast.getEnchants(true) + val enchants = unsorted.keys.sortForDisplay() + .associateWith { unsorted[it]!! } + + val shouldCollapse = plugin.configYml.getBool("display.collapse.enabled") && + enchants.size > plugin.configYml.getInt("display.collapse.threshold") + + val shouldDescribe = (plugin.configYml.getBool("display.descriptions.enabled") && + enchants.size <= plugin.configYml.getInt("display.descriptions.threshold") + && player?.seesEnchantmentDescriptions ?: true) + || pdc.has(plugin.namespacedKeyFactory.create("force-describe"), PersistentDataType.INTEGER) + + val formattedNames = mutableMapOf() + + val notMetLines = mutableListOf() + + for ((enchant, level) in enchants) { + if (player != null && enchant is EcoEnchant) { + notMetLines.addAll(enchant.getLevel(level).getNotMetLines(player).map { Display.PREFIX + it }) + } + + formattedNames[DisplayableEnchant(enchant.wrap(), level)] = enchant.wrap().getFormattedName(level) + } + + if (shouldCollapse) { + val perLine = plugin.configYml.getInt("display.collapse.per-line") + for (names in formattedNames.values.chunked(perLine)) { + enchantLore.add( + Display.PREFIX + names.joinToString( + plugin.configYml.getFormattedString("display.collapse.delimiter") + ) + ) + } + } else { + for ((displayable, formattedName) in formattedNames) { + val (enchant, level) = displayable + + enchantLore.add(Display.PREFIX + formattedName) + + if (shouldDescribe) { + enchantLore.addAll(enchant.getFormattedDescription(level).map { Display.PREFIX + it }) + } + } + } + + fast.addItemFlags(ItemFlag.HIDE_ENCHANTS) + if (itemStack.type == Material.ENCHANTED_BOOK) { + fast.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS) + } + + fast.lore = enchantLore + lore + notMetLines + } + + override fun revert(itemStack: ItemStack) { + val fast = itemStack.fast() + val pdc = fast.persistentDataContainer + + if (!pdc.has(internalHideEnchants, PersistentDataType.INTEGER)) { + fast.removeItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ENCHANTS) + } + + pdc.remove(internalHideEnchants) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/EnchantmentFormatting.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/EnchantmentFormatting.kt new file mode 100644 index 00000000..99d17e51 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/EnchantmentFormatting.kt @@ -0,0 +1,77 @@ +package com.willfp.ecoenchants.display + +import com.github.benmanes.caffeine.cache.Cache +import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.eco.util.NumberUtils +import com.willfp.eco.util.StringUtils +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchantLike +import org.apache.commons.lang.WordUtils + +// This is an object to be able to invalidate the cache on reload +object DisplayCache { + val nameCache: Cache = Caffeine.newBuilder() + .build() + + val descriptionCache: Cache> = Caffeine.newBuilder() + .build() + + @JvmStatic + @ConfigUpdater + fun onReload() { + nameCache.invalidateAll() + descriptionCache.invalidateAll() + } +} + +data class DisplayableEnchant( + val enchant: EcoEnchantLike, + val level: Int +) + +fun EcoEnchantLike.getFormattedName(level: Int): String { + val plugin = EcoEnchantsPlugin.instance + + return DisplayCache.nameCache.get(DisplayableEnchant(this, level)) { + val numerals = plugin.configYml.getBool("display.numerals.enabled") && + level <= plugin.configYml.getInt("display.numerals.threshold") + + val typeFormat = this.type.format + val name = this.unformattedDisplayName + val number = if (numerals) NumberUtils.toNumeral(level) else level.toString() + val dontShowNumber = (level == 1 && this.enchant.maxLevel == 1) || level < 1 + + if (plugin.configYml.getBool("display.above-max-level.enabled") && level > this.enchant.maxLevel) { + val format = plugin.configYml.getString("display.above-max-level.format") + val levelOnly = plugin.configYml.getBool("display.above-max-level.level-only") + + if (levelOnly) { + StringUtils.format("$typeFormat$name $format$number") + } else { + StringUtils.format("$format$name $number") + } + } else { + if (dontShowNumber) { + StringUtils.format("$typeFormat$name") + } else { + StringUtils.format("$typeFormat$name $number") + } + } + } +} + +fun EcoEnchantLike.getFormattedDescription(level: Int): List { + val plugin = EcoEnchantsPlugin.instance + + return DisplayCache.descriptionCache.get(DisplayableEnchant(this, level)) { + val descriptionFormat = plugin.configYml.getString("display.descriptions.format") + val wrap = plugin.configYml.getInt("display.descriptions.word-wrap") + + val description = this.getUnformattedDescription(level) + + WordUtils.wrap(description, wrap, "\n", false) + .lines() + .map { StringUtils.format(descriptionFormat + it) } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/Sorters.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/Sorters.kt new file mode 100644 index 00000000..c957f48b --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/display/Sorters.kt @@ -0,0 +1,113 @@ +package com.willfp.ecoenchants.display + +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.wrap +import com.willfp.ecoenchants.rarity.EnchantmentRarities +import com.willfp.ecoenchants.rarity.EnchantmentRarity +import com.willfp.ecoenchants.type.EnchantmentType +import com.willfp.ecoenchants.type.EnchantmentTypes +import org.bukkit.ChatColor +import org.bukkit.enchantments.Enchantment + +interface EnchantmentSorter { + fun sort(enchantments: Collection, children: List): List +} + +object EnchantSorter { + private val sorters = mutableListOf() + + @JvmStatic + @ConfigUpdater + fun update(plugin: EcoEnchantsPlugin) { + sorters.clear() + + if (plugin.configYml.getBool("display.sort.rarity")) { + sorters.add(RaritySorter) + } + + if (plugin.configYml.getBool("display.sort.type")) { + sorters.add(TypeSorter) + } + + if (plugin.configYml.getBool("display.sort.length")) { + sorters.add(LengthSorter) + } + } + + fun Collection.sortForDisplay(): List = + sorters.getSafely(0).sort(this, sorters.drop(1)) +} + +fun List.getSafely(index: Int) = + this.getOrNull(index) ?: AlphabeticSorter + +object AlphabeticSorter : EnchantmentSorter { + override fun sort(enchantments: Collection, children: List): List { + return enchantments.sortedBy { ChatColor.stripColor(it.wrap().displayName) } + } +} + +object LengthSorter : EnchantmentSorter { + override fun sort(enchantments: Collection, children: List): List { + return enchantments.sortedBy { ChatColor.stripColor(it.wrap().displayName)!!.length } + } +} + +object TypeSorter : EnchantmentSorter { + private val types = mutableListOf() + + @JvmStatic + @ConfigUpdater + fun update(plugin: EcoEnchantsPlugin) { + types.clear() + types.addAll(plugin.configYml.getStrings("display.sort.type-order").mapNotNull { + EnchantmentTypes.getByID(it) + }) + } + + override fun sort(enchantments: Collection, children: List): List { + val enchants = mutableListOf() + + for (type in types) { + for (enchantment in children.getSafely(0).sort(enchantments, children.drop(1))) { + if (type != enchantment.wrap().type) { + continue + } + + enchants.add(enchantment) + } + } + + return enchants + } +} + +object RaritySorter : EnchantmentSorter { + private val rarities = mutableListOf() + + @JvmStatic + @ConfigUpdater + fun update(plugin: EcoEnchantsPlugin) { + rarities.clear() + rarities.addAll(plugin.configYml.getStrings("display.sort.rarity-order").mapNotNull { + EnchantmentRarities.getByID(it) + }) + } + + override fun sort(enchantments: Collection, children: List): List { + val enchants = mutableListOf() + + for (rarity in rarities) { + for (enchantment in children.getSafely(0).sort(enchantments, children.drop(1))) { + if (rarity != enchantment.wrap().rarity) { + continue + } + + enchants.add(enchantment) + } + } + + return enchants + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt new file mode 100644 index 00000000..0a194e89 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchant.kt @@ -0,0 +1,301 @@ +package com.willfp.ecoenchants.enchants + +import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.eco.core.config.ConfigType +import com.willfp.eco.core.config.TransientConfig +import com.willfp.eco.core.config.config +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.fast.fast +import com.willfp.eco.core.placeholder.InjectablePlaceholder +import com.willfp.eco.core.placeholder.PlaceholderInjectable +import com.willfp.eco.core.placeholder.PlayerStaticPlaceholder +import com.willfp.eco.core.placeholder.StaticPlaceholder +import com.willfp.eco.util.NumberUtils +import com.willfp.eco.util.StringUtils +import com.willfp.eco.util.containsIgnoreCase +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.display.getFormattedName +import com.willfp.ecoenchants.rarity.EnchantmentRarities +import com.willfp.ecoenchants.target.EnchantLookup.getEnchantLevel +import com.willfp.ecoenchants.target.EnchantmentTargets +import com.willfp.ecoenchants.target.TargetSlot +import com.willfp.ecoenchants.type.EnchantmentTypes +import com.willfp.libreforge.conditions.Conditions +import com.willfp.libreforge.conditions.ConfiguredCondition +import net.kyori.adventure.text.Component +import org.bukkit.Bukkit +import org.bukkit.Material +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment +import org.bukkit.enchantments.EnchantmentTarget +import org.bukkit.entity.EntityCategory +import org.bukkit.event.Listener +import org.bukkit.inventory.EquipmentSlot +import org.bukkit.inventory.ItemStack +import org.bukkit.permissions.Permission +import org.bukkit.permissions.PermissionDefault +import java.io.File +import java.util.* + + +@Suppress("DEPRECATION") +abstract class EcoEnchant( + val id: String, + configProvider: (EcoEnchant) -> Config, + protected val plugin: EcoEnchantsPlugin +) : Enchantment(NamespacedKey.minecraft(id)), EcoEnchantLike { + internal val config by lazy { configProvider(this) } + override val enchant by lazy { this } + + private val levels = Caffeine.newBuilder() + .build() + + override val displayName = config.getFormattedString("display-name") + override val unformattedDisplayName = config.getString("display-name") + + val conditions: Set + + val targets = config.getStrings("targets") + .mapNotNull { EnchantmentTargets.getByID(it) } + + val slots: Set + get() = targets.map { it.slot }.toSet() + + override val type = EnchantmentTypes.getByID(config.getString("type")) ?: EnchantmentTypes.values().first() + + override val rarity = + EnchantmentRarities.getByID(config.getString("rarity")) ?: EnchantmentRarities.values().first() + + private val conflictNames = config.getStrings("conflicts") + + val conflicts: Collection + get() = conflictNames.mapNotNull { getByKey(NamespacedKey.minecraft(it)) } + + constructor( + config: Config, + plugin: EcoEnchantsPlugin + ) : this(config.getString("id"), { config }, plugin) + + constructor( + id: String, + config: Config, + plugin: EcoEnchantsPlugin + ) : this(id, { config }, plugin) + + @JvmOverloads + constructor( + id: String, + plugin: EcoEnchantsPlugin, + force: Boolean = true + ) : this( + id, + { + if (force) { + EnchantmentConfig(id, it::class.java, plugin) + } else { + val file = File(plugin.dataFolder, "enchants") + .walk() + .firstOrNull { file -> file.nameWithoutExtension == id } + + if (file == null) { + // If config is deleted, don't register it + config { + "dont-register" to true + } + } else { + TransientConfig(file, ConfigType.YAML) + } + } + }, + plugin + ) + + init { + config.injectPlaceholders( + PlayerStaticPlaceholder( + "level" + ) { p -> + p.getEnchantLevel(this).toString() + } + ) + + conditions = config.getSubsections("conditions").mapNotNull { + Conditions.compile(it, "Enchantment $id") + }.toSet() + + if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.$id") == null) { + val permission = Permission( + "ecoenchants.fromtable.$id", + "Allows getting $id from an Enchanting Table", + PermissionDefault.TRUE + ) + permission.addParent( + Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.*")!!, + true + ) + Bukkit.getPluginManager().addPermission(permission) + } + + // Non-forced enchantments with deleted configs will have this as their entire config (see above), + // and that way the enchantment isn't registered. + if (!config.getBool("dont-register")) { + register() + } + } + + private fun register() { + EcoEnchants.addNewEnchant(this) + } + + fun getLevel(level: Int): EcoEnchantLevel = levels.get(level) { + createLevel(it) + } + + open fun createLevel(level: Int) = + EcoEnchantLevel(this, level, emptySet(), conditions) + + fun registerListener(listener: Listener) { + this.plugin.eventManager.registerListener(listener) + } + + override fun getUnformattedDescription(level: Int): String { + val placeholderValue = NumberUtils.evaluateExpression( + config.getString("placeholder"), + null, + object : PlaceholderInjectable { + override fun getPlaceholderInjections(): List { + return listOf( + StaticPlaceholder( + "level", + ) { level.toString() } + ) + } + + override fun clearInjectedPlaceholders() { + // Do nothing + } + } + ) + + return config.getString("description") + .replace("%placeholder%", NumberUtils.format(placeholderValue)) + } + + @Deprecated( + message = "getName is a legacy Spigot API", + replaceWith = ReplaceWith("this.displayName(level)") + ) + override fun getName(): String = this.id.uppercase() + + override fun getMaxLevel(): Int = this.config.getInt("max-level") + + override fun getStartLevel(): Int = 1 + + @Deprecated( + message = "getItemTargets is an incompatible Spigot API", + replaceWith = ReplaceWith("this.targets") + ) + override fun getItemTarget(): EnchantmentTarget = EnchantmentTarget.ALL + + val isEnchantable: Boolean = this.config.getBool("enchantable") + + @Deprecated( + message = "Treasure enchantments do not exist in EcoEnchants", + replaceWith = ReplaceWith("this.isEnchantable") + ) + override fun isTreasure(): Boolean = !isEnchantable + + override fun isCursed(): Boolean { + return false + } + + fun conflictsWithDirectly(other: Enchantment): Boolean { + return conflictNames.containsIgnoreCase(other.key.key) + } + + override fun conflictsWith(other: Enchantment): Boolean { + if (conflictsWithDirectly(other)) { + return true + } + + if (other !is EcoEnchant) { + return false + } + + return other.conflictsWithDirectly(this) + } + + override fun canEnchantItem(item: ItemStack): Boolean { + if ( + item.fast().getEnchants(true).keys + .filterIsInstance() + .count { it.type == this.type } >= this.type.limit + ) { + return false + } + + if (item.fast().getEnchants(true).any { (enchant, _) -> enchant.conflictsWithDeep(this) }) { + return false + } + + if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) { + return true + } + + return targets.any { it.matches(item) } + } + + override fun displayName(level: Int): Component { + return StringUtils.toComponent(this.wrap().getFormattedName(level)) + } + + override fun isTradeable(): Boolean = this.config.getBool("tradeable") + + override fun isDiscoverable(): Boolean = this.config.getBool("discoverable") + + @Deprecated( + message = "EcoEnchants do not have damage increase, this method is for sharpness/boa/smite", + replaceWith = ReplaceWith("0.0f") + ) + override fun getDamageIncrease(level: Int, entityCategory: EntityCategory): Float = 0.0f + + @Deprecated( + message = "getActiveSlots is an incompatible Paper API", + replaceWith = ReplaceWith("this.slots") + ) + override fun getActiveSlots() = emptySet() + + @Suppress("DeprecatedCallableAddReplaceWith") + @Deprecated( + message = "Enchant display overrides this system" + ) + override fun translationKey(): String = "ecoenchants:enchantment.$id" + + @Deprecated( + message = "EcoEnchants uses a custom system for enchantment rarity", + replaceWith = ReplaceWith("this.enchantRarity") + ) + override fun getRarity(): io.papermc.paper.enchantments.EnchantmentRarity { + return io.papermc.paper.enchantments.EnchantmentRarity.RARE + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + if (other !is EcoEnchant) { + return false + } + + return other.id == this.id + } + + override fun hashCode(): Int { + return Objects.hash(id) + } + + override fun toString(): String { + return "EcoEnchant{$key}" + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt new file mode 100644 index 00000000..782ff3a4 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt @@ -0,0 +1,69 @@ +package com.willfp.ecoenchants.enchants + +import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.rarity.EnchantmentRarities +import com.willfp.ecoenchants.rarity.EnchantmentRarity +import com.willfp.ecoenchants.type.EnchantmentType +import com.willfp.ecoenchants.type.EnchantmentTypes +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment +import java.util.* + +interface EcoEnchantLike { + val type: EnchantmentType + val displayName: String + val unformattedDisplayName: String + val enchant: Enchantment + val rarity: EnchantmentRarity + + fun getUnformattedDescription(level: Int): String +} + +private val ecoEnchantLikes = Caffeine.newBuilder() + .build() + +fun Enchantment.wrap(): EcoEnchantLike { + if (this is EcoEnchant) { + return this + } + return ecoEnchantLikes.get(this.key) { + VanillaEcoEnchantLike(this, EcoEnchantsPlugin.instance) // Jank + } +} + +fun Enchantment.conflictsWithDeep(other: Enchantment): Boolean { + return this.conflictsWith(other) || other.conflictsWith(this) +} + +class VanillaEcoEnchantLike( + override val enchant: Enchantment, + private val plugin: EcoEnchantsPlugin +) : EcoEnchantLike { + override val type: EnchantmentType = + EnchantmentTypes.getByID(plugin.vanillaEnchantsYml.getString("${enchant.key.key}.type")) + ?: EnchantmentTypes.values().first() + + override val rarity: EnchantmentRarity = + EnchantmentRarities.getByID(plugin.vanillaEnchantsYml.getString("${enchant.key.key}.rarity")) + ?: EnchantmentRarities.values().first() + + override val displayName = plugin.vanillaEnchantsYml.getFormattedString("${enchant.key.key}.name") + override val unformattedDisplayName = plugin.vanillaEnchantsYml.getString("${enchant.key.key}.name") + + override fun getUnformattedDescription(level: Int): String { + return plugin.vanillaEnchantsYml.getString("${enchant.key.key}.description") + } + + override fun equals(other: Any?): Boolean { + if (other !is VanillaEcoEnchantLike) { + return false + } + + return this.enchant == other.enchant + } + + override fun hashCode(): Int { + return Objects.hash(this.enchant) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt new file mode 100644 index 00000000..1fb04b44 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt @@ -0,0 +1,138 @@ +package com.willfp.ecoenchants.enchants + +import com.google.common.collect.HashBiMap +import com.google.common.collect.ImmutableSet +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.integrations.EnchantRegistrations +import com.willfp.ecoenchants.rarity.EnchantmentRarities +import com.willfp.ecoenchants.target.EnchantmentTargets +import com.willfp.ecoenchants.type.EnchantmentTypes +import org.bukkit.ChatColor +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +@Suppress("UNUSED") +object EcoEnchants { + private val BY_KEY = HashBiMap.create() + private val BY_NAME = HashBiMap.create() + + /** + * Get all registered [EcoEnchant]s. + * + * @return A list of all [EcoEnchant]s. + */ + @JvmStatic + fun values(): Set { + return ImmutableSet.copyOf(BY_KEY.values) + } + + /** + * Get [String]s for all registered [EcoEnchant]s. + * + * @return A list of all [EcoEnchant]s. + */ + @JvmStatic + fun keySet(): Set { + return ImmutableSet.copyOf(BY_KEY.keys) + } + + /** + * Get [EcoEnchant] matching key. + * + * @param key The key to search for. + * @return The matching [EcoEnchant], or null if not found. + */ + @JvmStatic + fun getByKey(key: String?): EcoEnchant? { + return if (key == null) { + null + } else BY_KEY[key] + } + + /** + * Get [EcoEnchant] matching name. + * + * @param name The name to search for. + * @return The matching [EcoEnchant], or null if not found. + */ + @JvmStatic + fun getByName(name: String?): EcoEnchant? { + return if (name == null) { + null + } else BY_NAME[name] + } + + /** + * Update all [EcoEnchant]s. + * + * @param plugin Instance of EcoEnchants. + */ + @JvmStatic + @ConfigUpdater + fun update(plugin: EcoEnchantsPlugin) { + EnchantmentRarities.update(plugin) + EnchantmentTargets.update(plugin) + EnchantmentTypes.update(plugin) + + for (enchant in values()) { + removeEnchant(enchant) + } + + for ((id, config) in plugin.fetchConfigs("enchants")) { + if (config.has("effects")) { + LibReforgeEcoEnchant(id, config, plugin) + } + } + } + + /** + * Remove [EcoEnchant] from EcoEnchants. + * + * @param enchant The [EcoEnchant] to remove. + */ + @JvmStatic + @Suppress("UNCHECKED_CAST", "DEPRECATION") + fun removeEnchant(enchant: EcoEnchant) { + BY_KEY.remove(enchant.id) + BY_NAME.remove(enchant.id) + + Enchantment::class.java.getDeclaredField("byKey") + .apply { + isAccessible = true + (get(null) as MutableMap).apply { remove(enchant.key) } + } + + Enchantment::class.java.getDeclaredField("byName") + .apply { + isAccessible = true + (get(null) as MutableMap).apply { remove(enchant.name) } + } + + EnchantRegistrations.removeEnchant(enchant) + } + + /** + * Add new [EcoEnchant] to EcoEnchants. + * + * Only for internal use, enchants are automatically added in the constructor. + * + * @param enchant The [EcoEnchant] to add. + */ + @Suppress("UNCHECKED_CAST", "DEPRECATION") + internal fun addNewEnchant(enchant: EcoEnchant) { + removeEnchant(enchant) + + Enchantment::class.java.getDeclaredField("acceptingNew") + .apply { + isAccessible = true + set(null, true) + } + + BY_KEY[enchant.id] = enchant + BY_NAME[ChatColor.stripColor(enchant.displayName)] = enchant + + Enchantment.registerEnchantment(enchant) + EnchantRegistrations.registerEnchantments() + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EnchantInfo.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EnchantInfo.kt new file mode 100644 index 00000000..88561408 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EnchantInfo.kt @@ -0,0 +1,74 @@ +package com.willfp.ecoenchants.enchants + +import com.github.benmanes.caffeine.cache.Cache +import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.items.builder.EnchantedBookBuilder +import com.willfp.eco.util.formatEco +import com.willfp.ecoenchants.display.getFormattedName +import org.bukkit.entity.Player +import org.bukkit.persistence.PersistentDataType + +object EnchantInfo { + private val menus: Cache = Caffeine.newBuilder() + .build() + + fun open(player: Player, plugin: EcoPlugin, enchant: EcoEnchant) { + menus.get(enchant) { + val level = if (plugin.configYml.getBool("enchantinfo.item.show-max-level")) { + enchant.maxLevel + } else { + 1 + } + + menu(plugin.configYml.getInt("enchantinfo.rows")) { + setTitle(enchant.getFormattedName(0)) + + setSlot( + plugin.configYml.getInt("enchantinfo.item.row"), + plugin.configYml.getInt("enchantinfo.item.column"), + slot( + EnchantedBookBuilder() + .addStoredEnchantment(enchant, level) + .writeMetaKey( + plugin.namespacedKeyFactory.create("force-describe"), + PersistentDataType.INTEGER, + 1 + ) + .addLoreLines { + plugin.configYml.getStrings("enchantinfo.item.lore") + .map { + it.replace("%max_level%", enchant.maxLevel.toString()) + .replace("%rarity%", enchant.rarity.displayName) + .replace( + "%targets%", + enchant.targets.joinToString(", ") { target -> target.displayName } + ) + .replace( + "%conflicts%", + enchant.conflicts.joinToString(", ") { conflict -> + conflict.wrap().getFormattedName(0) + }.ifEmpty { plugin.langYml.getFormattedString("no-conflicts") } + ) + } + .formatEco() + } + .build() + ) + ) + + setMask( + FillerMask( + MaskItems.fromItemNames(plugin.configYml.getStrings("enchantinfo.mask.items")), + *plugin.configYml.getStrings("enchantinfo.mask.pattern").toTypedArray() + ) + ) + } + }.open(player) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EnchantmentConfigs.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EnchantmentConfigs.kt new file mode 100644 index 00000000..2424b409 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EnchantmentConfigs.kt @@ -0,0 +1,18 @@ +package com.willfp.ecoenchants.enchants + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.config.ConfigType +import com.willfp.eco.core.config.ExtendableConfig + +class EnchantmentConfig( + name: String, + source: Class<*>, + plugin: EcoPlugin +) : ExtendableConfig( + name, + true, + plugin, + source, + "enchants/", + ConfigType.YAML +) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/LibReforgeEcoEnchant.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/LibReforgeEcoEnchant.kt new file mode 100644 index 00000000..ee81a940 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/LibReforgeEcoEnchant.kt @@ -0,0 +1,55 @@ +package com.willfp.ecoenchants.enchants + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.libreforge.Holder +import com.willfp.libreforge.conditions.ConfiguredCondition +import com.willfp.libreforge.effects.ConfiguredEffect +import com.willfp.libreforge.effects.Effects +import java.util.* + +class LibReforgeEcoEnchant( + id: String, + config: Config, + plugin: EcoEnchantsPlugin +) : EcoEnchant( + id, + config, + plugin +) { + private val effects: Set + + init { + effects = config.getSubsections("effects").mapNotNull { + Effects.compile(it, "Enchantment $id") + }.toSet() + } + + override fun createLevel(level: Int): EcoEnchantLevel = + EcoEnchantLevel(this, level, effects, conditions) +} + +class EcoEnchantLevel( + parent: EcoEnchant, + level: Int, + override val effects: Set, + override val conditions: Set +) : Holder { + override val id = "${parent.id}_$level" + + override fun equals(other: Any?): Boolean { + if (other !is EcoEnchantLevel) { + return false + } + + return this.id == other.id + } + + override fun toString(): String { + return id + } + + override fun hashCode(): Int { + return Objects.hash(this.id) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentTelekinesis.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentTelekinesis.kt new file mode 100644 index 00000000..17ca76c0 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/impl/EnchantmentTelekinesis.kt @@ -0,0 +1,121 @@ +package com.willfp.ecoenchants.enchants.impl + +import com.willfp.eco.core.drops.DropQueue +import com.willfp.eco.core.events.EntityDeathByEntityEvent +import com.willfp.eco.core.integrations.antigrief.AntigriefManager +import com.willfp.eco.util.TelekinesisUtils +import com.willfp.eco.util.tryAsPlayer +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.target.EnchantLookup.hasEnchant +import com.willfp.ecoenchants.target.EnchantLookup.hasEnchantActive +import org.bukkit.GameMode +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.block.BlockBreakEvent +import org.bukkit.event.block.BlockDropItemEvent + +class EnchantmentTelekinesis( + plugin: EcoEnchantsPlugin +) : EcoEnchant( + "telekinesis", + plugin, + force = false +) { + init { + this.registerListener(TelekinesisHandler(this)) + TelekinesisUtils.registerTest { it.hasEnchantActive(this) } + } + + private class TelekinesisHandler( + private val enchant: EcoEnchant + ) : Listener { + @EventHandler( + priority = EventPriority.HIGH, + ignoreCancelled = true + ) + fun handle(event: BlockDropItemEvent) { + val player = event.player + val block = event.block + + if (!AntigriefManager.canBreakBlock(player, block)) { + return + } + + val drops = event.items.map { it.itemStack } + event.items.clear() + + DropQueue(player) + .setLocation(block.location) + .addItems(drops) + .push() + } + + @EventHandler( + priority = EventPriority.HIGH, + ignoreCancelled = true + ) + fun handle(event: BlockBreakEvent) { + val player = event.player + val block = event.block + + if (!AntigriefManager.canBreakBlock(player, block)) { + return + } + + if (player.gameMode == GameMode.CREATIVE || player.gameMode == GameMode.SPECTATOR) { + return + } + + // Filter out telekinesis spawner xp to prevent dupe + if (block.type == Material.SPAWNER && player.hasEnchant(enchant)) { + event.expToDrop = 0 + } + + DropQueue(player) + .setLocation(block.location) + .addXP(event.expToDrop) + .push() + + event.expToDrop = 0 + } + + + @EventHandler( + priority = EventPriority.HIGH, + ignoreCancelled = true + ) + fun handle(event: EntityDeathByEntityEvent) { + val victim = event.victim + + if (victim is Player && enchant.config.getBool("not-on-players")) { + return + } + + val player = event.killer.tryAsPlayer() ?: return + + // Only DropQueue-ify entity drops with telekinesis + if (!player.hasEnchantActive(enchant)) { + return + } + + val xp = event.xp + val drops = event.drops + + drops.removeAll { it == null } + + DropQueue(player) + .addItems(drops) + .setLocation(victim.location) + .addXP(xp) + .forceTelekinesis() + .push() + + event.deathEvent.droppedExp = 0 + event.deathEvent.drops.clear() + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/EnchantRegistrationIntegration.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/EnchantRegistrationIntegration.kt new file mode 100644 index 00000000..07a279b5 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/EnchantRegistrationIntegration.kt @@ -0,0 +1,34 @@ +package com.willfp.ecoenchants.integrations + +import com.willfp.eco.core.integrations.Integration +import com.willfp.ecoenchants.enchants.EcoEnchant +import org.jetbrains.annotations.NotNull + + +interface EnchantRegistrationIntegration : Integration { + fun registerEnchants() + + fun removeEnchant(enchantment: EcoEnchant) { + + } +} + +object EnchantRegistrations { + private val registered = mutableSetOf() + + fun register(@NotNull integration: EnchantRegistrationIntegration) { + registered.add(integration) + } + + internal fun registerEnchantments() { + for (integration in registered) { + runCatching { integration.registerEnchants() } + } + } + + fun removeEnchant(enchantment: EcoEnchant) { + for (integration in registered) { + runCatching { integration.removeEnchant(enchantment) } + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/plugins/CMIIntegration.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/plugins/CMIIntegration.kt new file mode 100644 index 00000000..4198e35a --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/plugins/CMIIntegration.kt @@ -0,0 +1,13 @@ +package com.willfp.ecoenchants.integrations.plugins + +import com.willfp.ecoenchants.integrations.EnchantRegistrationIntegration +import net.Zrips.CMILib.Enchants.CMIEnchantment + +class CMIIntegration: EnchantRegistrationIntegration { + override fun registerEnchants() { + CMIEnchantment.initialize() + CMIEnchantment.saveEnchants() + } + + override fun getPluginName() = "CMI" +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/plugins/EssentialsIntegration.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/plugins/EssentialsIntegration.kt new file mode 100644 index 00000000..ed74eebc --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/integrations/plugins/EssentialsIntegration.kt @@ -0,0 +1,31 @@ +package com.willfp.ecoenchants.integrations.plugins + +import com.earth2me.essentials.Enchantments +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.integrations.EnchantRegistrationIntegration +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +class EssentialsIntegration: EnchantRegistrationIntegration { + override fun registerEnchants() { + for (enchantment in EcoEnchants.values()) { + Enchantments.registerEnchantment(enchantment.id, enchantment) + } + } + + @Suppress("UNCHECKED_CAST", "DEPRECATION") + override fun removeEnchant(enchantment: EcoEnchant) { + Enchantment::class.java.getDeclaredField("ENCHANTMENTS") + .apply { + isAccessible = true + (get(null) as MutableMap).apply { + for (enchant in values.filterIsInstance()) { + remove(enchant.key) + } + } + } + } + + override fun getPluginName() = "Essentials" +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt new file mode 100644 index 00000000..898c32b9 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt @@ -0,0 +1,224 @@ +package com.willfp.ecoenchants.mechanics + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.fast.fast +import com.willfp.eco.core.proxy.ProxyConstants +import com.willfp.eco.util.StringUtils +import org.bukkit.ChatColor +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.inventory.PrepareAnvilEvent +import org.bukkit.inventory.ItemStack +import org.bukkit.inventory.meta.Damageable +import org.bukkit.inventory.meta.EnchantmentStorageMeta +import org.jetbrains.annotations.NotNull +import java.util.* +import kotlin.math.abs +import kotlin.math.max +import kotlin.math.min +import kotlin.math.pow +import kotlin.math.roundToInt + +data class AnvilResult( + val result: ItemStack?, + val xp: Int? +) + +fun Int.infiniteIfNegative() = if (this < 1) Int.MAX_VALUE else this + +private val FAIL = AnvilResult(null, null) + +@Suppress("DEPRECATION") +class AnvilSupport( + private val plugin: EcoPlugin +) : Listener { + /** + * Map to prevent incrementing cost several times as inventory events are fired 3 times. + */ + private val antiRepeat = mutableSetOf() + + /** + * Class for AnvilGUI wrappers to ignore them. + */ + private val anvilGuiClass = "net.wesjd.anvilgui.version.Wrapper" + + ProxyConstants.NMS_VERSION.substring(1) + + "\$AnvilContainer" + + /** + * Called when items are placed into an anvil. + * + * @param event The event to listen to. + */ + @EventHandler(priority = EventPriority.HIGHEST) + fun onAnvilPrepare(@NotNull event: PrepareAnvilEvent) { + val player = event.viewers.getOrNull(0) as? Player ?: return + + // TODO: Implement proxies + /* + if (this.getPlugin().getProxy(OpenInventoryProxy::class.java).getOpenInventory(player).getClass().toString() + .equals(ANVIL_GUI_CLASS) + ) { + return + } + */ + + if (antiRepeat.contains(player.uniqueId)) { + return + } + + antiRepeat.add(player.uniqueId) + + this.plugin.scheduler.run { + antiRepeat.remove(player.uniqueId) + + val left = event.inventory.getItem(0)?.clone() + val old = left?.clone() + val right = event.inventory.getItem(1)?.clone() + + event.result = null + event.inventory.setItem(2, null) + + val result = doMerge( + left, + right, + event.inventory.renameText ?: "", + player + ) + + val price = result.xp ?: 0 + val outItem = result.result ?: ItemStack(Material.AIR) + + val oldCost = event.inventory.repairCost + + val oldLeft = event.inventory.getItem(0) + + if (oldLeft == null || oldLeft.type != outItem.type) { + return@run + } + + if (result == FAIL || left == old) { + return@run + } + + val cost = oldCost + price + + if (cost == 0) { + return@run + } + + /* + Transplanted anti-dupe bodge from pre-recode. + */ + val leftEnchants = left?.fast()?.getEnchants(true) ?: emptyMap() + val outEnchants = outItem.fast().getEnchants(true) + + if (event.inventory.getItem(1) == null && leftEnchants != outEnchants) { + return@run + } + + if (plugin.configYml.getBool("anvil.use-rework-penalty")) { + val repairCost = outItem.fast().repairCost + outItem.fast().repairCost = (repairCost + 1) * 2 - 1 + } + + event.inventory.repairCost = cost + event.result = outItem + event.inventory.setItem(2, outItem) + } + } + + private fun doMerge( + left: ItemStack?, + right: ItemStack?, + itemName: String, + player: Player + ): AnvilResult { + if (left == null || left.type == Material.AIR) { + return FAIL + } + + val formattedItemName = if (player.hasPermission("ecoenchants.anvil.color")) { + StringUtils.format(itemName) + } else { + ChatColor.stripColor(itemName) + }.let { if (it.isNullOrEmpty()) left.fast().displayName else it } + + if (right == null || right.type == Material.AIR) { + if (left.fast().displayName == formattedItemName) { + return FAIL + } + + left.fast().displayName = formattedItemName.let { "§o$it" } // Not a great way to make it italic, but it works + + return AnvilResult(left, 0) + } + + if (left.type != right.type) { + return FAIL + } + + left.fast().displayName = formattedItemName.let { "§o$it" } // Same again, it works though + + val leftEnchants = left.fast().getEnchants(true) + val rightEnchants = right.fast().getEnchants(true) + + val outEnchants = leftEnchants.toMutableMap() + + for ((enchant, level) in rightEnchants) { + if (enchant.canEnchantItem(left) && !outEnchants.containsKey(enchant)) { + if (outEnchants.size < plugin.configYml.getInt("anvil.enchant-limit").infiniteIfNegative()) { + outEnchants[enchant] = level + } + } + + if (outEnchants.containsKey(enchant)) { + val currentLevel = outEnchants[enchant]!! + outEnchants[enchant] = if (level == currentLevel) { + min(enchant.maxLevel, level + 1) + } else { + max(level, currentLevel) + } + } + } + + val leftMeta = left.itemMeta + val rightMeta = right.itemMeta + + if (leftMeta is Damageable && rightMeta is Damageable) { + val maxDamage = left.type.maxDurability.toInt() + val leftDurability = maxDamage - leftMeta.damage + val rightDurability = maxDamage - rightMeta.damage + val damage = maxDamage - max(maxDamage, leftDurability + rightDurability) + + leftMeta.damage = damage + } + + if (leftMeta is EnchantmentStorageMeta) { + for (storedEnchant in leftMeta.storedEnchants.keys.toSet()) { + leftMeta.removeStoredEnchant(storedEnchant) + } + + for ((enchant, level) in outEnchants) { + leftMeta.addStoredEnchant(enchant, level, true) + } + } else { + for (storedEnchant in leftMeta.enchants.keys.toSet()) { + leftMeta.removeEnchant(storedEnchant) + } + + for ((enchant, level) in outEnchants) { + leftMeta.addEnchant(enchant, level, true) + } + } + + left.itemMeta = leftMeta + + val enchantLevelDiff = abs(leftEnchants.values.sum() - outEnchants.values.sum()) + val xpCost = plugin.configYml.getDouble("anvil.cost-exponent").pow(enchantLevelDiff) * enchantLevelDiff + + return AnvilResult(left, xpCost.roundToInt()) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt new file mode 100644 index 00000000..42e9adaa --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt @@ -0,0 +1,217 @@ +package com.willfp.ecoenchants.mechanics + +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.TestableItem +import com.willfp.eco.core.recipe.parts.EmptyTestableItem +import com.willfp.eco.util.NumberUtils +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.enchants.conflictsWithDeep +import org.bukkit.GameMode +import org.bukkit.Material +import org.bukkit.enchantments.Enchantment +import org.bukkit.enchantments.EnchantmentOffer +import org.bukkit.event.EventHandler +import org.bukkit.event.Listener +import org.bukkit.event.enchantment.EnchantItemEvent +import org.bukkit.event.enchantment.PrepareItemEnchantEvent +import org.bukkit.event.player.PlayerQuitEvent +import java.util.* +import kotlin.math.ceil +import kotlin.math.floor +import kotlin.math.min + + +class EnchantingTableSupport( + private val plugin: EcoEnchantsPlugin +) : Listener { + @EventHandler + fun onLeave(event: PlayerQuitEvent) { + ExtraItemSupport.currentlyEnchantingExtraItem.remove(event.player.uniqueId) + } + + @EventHandler + fun onEnchant(event: EnchantItemEvent) { + val player = event.enchanter + val item = event.item + val cost = event.expLevelCost + val toAdd = event.enchantsToAdd + + if (!plugin.configYml.getBool("enchanting-table.enabled")) { + return + } + + val isExtraEnchantable = ExtraItemSupport.extraEnchantableItems.any { it.matches(item) } + + if (isExtraEnchantable) { + val lapis = event.inventory.getItem(1) + + if (player.gameMode != GameMode.CREATIVE) { + if (lapis == null) { + event.isCancelled = true + return + } + + val lapisCost = event.whichButton() + 1 + + if (lapis.amount < lapisCost) { + event.isCancelled = true + return + } + + lapis.amount -= lapisCost + + event.inventory.setItem(1, lapis) + } + } + + var multiplier = 0.01 + if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) { + multiplier *= plugin.configYml.getDouble("enchanting-table.book-multiplier") + } + + val enchantments = EcoEnchants.values().shuffled() + + for (enchantment in enchantments) { + if (!enchantment.isEnchantable) { + continue + } + + if (!enchantment.canEnchantItem(item)) { + continue + } + + if (!player.hasPermission("ecoenchants.fromtable.${enchantment.id}")) { + continue + } + + if (NumberUtils.randFloat(0.0, 1.0) > enchantment.rarity.tableChance * multiplier) { + continue + } + + if (enchantment.rarity.minimumLevel > cost) { + continue + } + + if (toAdd.size >= this.plugin.configYml.getInt("enchanting-table.cap")) { + break + } + + if (toAdd.size > plugin.configYml.getInt("anvil.enchant-limit").infiniteIfNegative()) { + break + } + + if (toAdd.any { (it, _) -> enchantment.conflictsWithDeep(it) }) { + continue + } + + if ( + toAdd.keys.filterIsInstance() + .count { it.type == enchantment.type } >= enchantment.type.limit + ) { + continue + } + + val maxLevel = enchantment.maxLevel + val maxObtainableLevel = plugin.configYml.getInt("enchanting-table.maximum-obtainable-level") + + val levelPart1 = cost / maxObtainableLevel.toDouble() + val levelPart2 = NumberUtils.bias(levelPart1, enchantment.type.highLevelBias) + val levelPart3 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart2) + val level = ceil(levelPart3 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt() + + multiplier /= this.plugin.configYml.getDouble("enchanting-table.reduction") + + toAdd[enchantment] = level + } + + toAdd.forEach(event.enchantsToAdd::putIfAbsent) + + if (toAdd.isEmpty() && isExtraEnchantable) { + toAdd[Enchantment.DURABILITY] = + ExtraItemSupport.currentlyEnchantingExtraItem[player.uniqueId]!![event.whichButton()] + ExtraItemSupport.currentlyEnchantingExtraItem.remove(player.uniqueId) + } + } + + @EventHandler + fun handleExtraItem(event: PrepareItemEnchantEvent) { + if (!plugin.configYml.getBool("enchanting-table.enabled")) { + return + } + + val item = event.item + + if (!ExtraItemSupport.extraEnchantableItems.any { it.matches(item) }) { + return + } + + val maxObtainableLevel = plugin.configYml.getInt("enchanting-table.maximum-obtainable-level") + + /* + I have no clue how this code works, it's transplanted from old EcoEnchants, and I know it works + perfectly, it's effectively 1:1 with vanilla if memory serves, so I'm not going to rewrite it. + */ + + event.offers.getOrNull(2)?.cost = min(event.offers[2].cost, maxObtainableLevel) + + val bonus = event.enchantmentBonus.coerceIn(1..15) + + val baseLevel = NumberUtils.randInt(1, 8) + floor(bonus / 2.0) + NumberUtils.randInt(0, bonus) + + val levelScale = ceil(maxObtainableLevel / 30.0).toInt() + + val bottomEnchantLevel = (ceil((baseLevel / 3).coerceAtLeast(1.0)).toInt() * levelScale).coerceAtMost(maxObtainableLevel) + val midEnchantLevel = ((baseLevel * 2 / 3).toInt() + 1) * levelScale + val topEnchantLevel = baseLevel.coerceAtLeast(bonus * 2.0).toInt() * levelScale + + var midUnbreakingLevel = NumberUtils.randInt(1, 3) + if (midUnbreakingLevel < 2) { + midUnbreakingLevel = 2 + } + if (midEnchantLevel < 15) { + midUnbreakingLevel = 1 + } + + var topUnbreakingLevel = 3 + if (topEnchantLevel < 20) { + topUnbreakingLevel = 2 + } + if (topEnchantLevel < 10) { + topUnbreakingLevel = 1 + } + + val offers = arrayOf( + EnchantmentOffer(Enchantment.DURABILITY, 1, bottomEnchantLevel), + EnchantmentOffer(Enchantment.DURABILITY, midUnbreakingLevel, midEnchantLevel), + EnchantmentOffer(Enchantment.DURABILITY, topUnbreakingLevel, topEnchantLevel) + ) + + for (i in offers.indices) { + event.offers[i] = offers[i] + } + + ExtraItemSupport.currentlyEnchantingExtraItem[event.enchanter.uniqueId] = arrayOf( + event.offers[0].enchantmentLevel, + event.offers[1].enchantmentLevel, + event.offers[2].enchantmentLevel + ) + } +} + +object ExtraItemSupport { + internal val currentlyEnchantingExtraItem = mutableMapOf>() + + internal val extraEnchantableItems = mutableListOf() + + @JvmStatic + @ConfigUpdater + fun reload(plugin: EcoEnchantsPlugin) { + extraEnchantableItems.clear() + extraEnchantableItems.addAll(plugin.targetsYml.getStrings("extra-enchantable-items").map { + Items.lookup(it) + }.filterNot { it is EmptyTestableItem }) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/LootSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/LootSupport.kt new file mode 100644 index 00000000..727f0fb1 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/LootSupport.kt @@ -0,0 +1,94 @@ +package com.willfp.ecoenchants.mechanics + +import com.willfp.eco.core.fast.fast +import com.willfp.eco.util.NumberUtils +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.enchants.conflictsWithDeep +import com.willfp.ecoenchants.target.EnchantmentTargets.isEnchantable +import org.bukkit.Material +import org.bukkit.event.EventHandler +import org.bukkit.event.Listener +import org.bukkit.event.world.LootGenerateEvent +import org.bukkit.inventory.ItemStack +import org.bukkit.inventory.meta.EnchantmentStorageMeta +import kotlin.math.ceil + +class LootSupport( + private val plugin: EcoEnchantsPlugin +) : Listener { + @EventHandler + fun onGenerate(event: LootGenerateEvent) { + if (!this.plugin.configYml.getBool("loot.enabled")) { + return + } + + for (itemStack in event.loot) { + modifyItem(itemStack) + } + } + + private fun modifyItem(item: ItemStack) { + if (!item.isEnchantable) { + return + } + + val enchants = item.fast().getEnchants(true) + + var multiplier = 0.01 + + if (item.type == Material.BOOK || item.type == Material.ENCHANTED_BOOK) { + multiplier *= plugin.configYml.getDouble("loot.book-multiplier") + } + + val enchantments = EcoEnchants.values().shuffled() + + for (enchantment in enchantments) { + if (!enchantment.isDiscoverable) { + continue + } + + if (!enchantment.canEnchantItem(item)) { + continue + } + + if (NumberUtils.randFloat(0.0, 1.0) > enchantment.rarity.lootChance * multiplier) { + continue + } + + if (enchants.any { (it, _) -> enchantment.conflictsWithDeep(it) }) { + continue + } + + if (enchants.size > plugin.configYml.getInt("anvil.enchant-limit").infiniteIfNegative()) { + break + } + + if ( + enchants.keys.filterIsInstance() + .count { it.type == enchantment.type } >= enchantment.type.limit + ) { + continue + } + + val maxLevel = enchantment.maxLevel + + val levelPart1 = NumberUtils.bias(NumberUtils.randFloat(0.7, 1.0), enchantment.type.highLevelBias) + val levelPart2 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart1) + val level = ceil(levelPart2 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt() + + multiplier /= this.plugin.configYml.getDouble("villager.reduction") + + enchants[enchantment] = level + } + + val meta = item.itemMeta + if (meta is EnchantmentStorageMeta) { + enchants.forEach { (enchant, level) -> meta.addStoredEnchant(enchant, level, true) } + } else { + enchants.forEach { (enchant, level) -> meta.addEnchant(enchant, level, true) } + } + item.itemMeta = meta + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt new file mode 100644 index 00000000..cfc282d4 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt @@ -0,0 +1,104 @@ +package com.willfp.ecoenchants.mechanics + +import com.willfp.eco.core.fast.fast +import com.willfp.eco.util.NumberUtils +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.enchants.conflictsWithDeep +import com.willfp.ecoenchants.target.EnchantmentTargets.isEnchantable +import org.bukkit.Material +import org.bukkit.event.EventHandler +import org.bukkit.event.Listener +import org.bukkit.event.entity.VillagerAcquireTradeEvent +import org.bukkit.inventory.MerchantRecipe +import org.bukkit.inventory.meta.EnchantmentStorageMeta +import kotlin.math.ceil + + +class VillagerSupport( + private val plugin: EcoEnchantsPlugin +) : Listener { + @EventHandler + fun onTrade(event: VillagerAcquireTradeEvent) { + if (!this.plugin.configYml.getBool("villager.enabled")) { + return + } + + val result = event.recipe.result.clone() + + if (!result.isEnchantable) { + return + } + + val enchants = result.fast().getEnchants(true) + + var multiplier = 0.01 + + if (result.type == Material.BOOK || result.type == Material.ENCHANTED_BOOK) { + multiplier *= plugin.configYml.getDouble("villager.book-multiplier") + } + + val enchantments = EcoEnchants.values().shuffled() + + for (enchantment in enchantments) { + if (!enchantment.isTradeable) { + continue + } + + if (!enchantment.canEnchantItem(result)) { + continue + } + + if (NumberUtils.randFloat(0.0, 1.0) > enchantment.rarity.villagerChance * multiplier) { + continue + } + + if (enchants.any { (it, _) -> enchantment.conflictsWithDeep(it) }) { + continue + } + + if (enchants.size > plugin.configYml.getInt("anvil.enchant-limit").infiniteIfNegative()) { + break + } + + if ( + enchants.keys.filterIsInstance() + .count { it.type == enchantment.type } >= enchantment.type.limit + ) { + continue + } + + val maxLevel = enchantment.maxLevel + + val levelPart1 = event.recipe.ingredients[0].amount / 64.0 + val levelPart2 = NumberUtils.bias(levelPart1, enchantment.type.highLevelBias) + val levelPart3 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart2) + val level = ceil(levelPart3 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt() + + multiplier /= this.plugin.configYml.getDouble("villager.reduction") + + enchants[enchantment] = level + } + + val meta = result.itemMeta + if (meta is EnchantmentStorageMeta) { + enchants.forEach { (enchant, level) -> meta.addStoredEnchant(enchant, level, true) } + } else { + enchants.forEach { (enchant, level) -> meta.addEnchant(enchant, level, true) } + } + result.itemMeta = meta + + val recipe = MerchantRecipe( + result, + event.recipe.uses, + event.recipe.maxUses, + event.recipe.hasExperienceReward(), + event.recipe.villagerExperience, + event.recipe.priceMultiplier + ) + + recipe.ingredients = event.recipe.ingredients + event.recipe = recipe + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/rarity/EnchantmentRarities.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/rarity/EnchantmentRarities.kt new file mode 100644 index 00000000..ce0c073d --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/rarity/EnchantmentRarities.kt @@ -0,0 +1,82 @@ +package com.willfp.ecoenchants.rarity + +import com.google.common.collect.HashBiMap +import com.google.common.collect.ImmutableSet +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchants + +@Suppress("UNUSED") +object EnchantmentRarities { + private val BY_ID = HashBiMap.create() + + /** + * Get all registered [EnchantmentRarity]s. + * + * @return A list of all [EnchantmentRarity]s. + */ + @JvmStatic + fun values(): Set { + return ImmutableSet.copyOf(BY_ID.values) + } + + /** + * Get [String]s for all registered [EnchantmentRarity]s. + * + * @return A list of all [EnchantmentRarity]s. + */ + @JvmStatic + fun keySet(): Set { + return ImmutableSet.copyOf(BY_ID.keys) + } + + /** + * Get [EnchantmentRarity] matching key. + * + * @param id The key to search for. + * @return The matching [EnchantmentRarity], or null if not found. + */ + @JvmStatic + fun getByID(id: String?): EnchantmentRarity? { + return if (id == null) { + null + } else BY_ID[id] + } + + /** + * Update all [EnchantmentRarity]s. + * + * @param plugin Instance of EcoEnchants. + */ + @JvmStatic + fun update(plugin: EcoEnchantsPlugin) { + for (type in values()) { + removeRarity(type) + } + for (config in plugin.rarityYml.getSubsections("rarities")) { + EnchantmentRarity(config) + } + } + + /** + * Remove [EnchantmentRarity] from EcoEnchants. + * + * @param rarity The [EnchantmentRarity] to remove. + */ + @JvmStatic + fun removeRarity(rarity: EnchantmentRarity) { + BY_ID.remove(rarity.id) + } + + /** + * Add new [EnchantmentRarity] to EcoEnchants. + * + * Only for internal use, rarities are automatically added in the constructor. + * + * @param rarity The [EnchantmentRarity] to add. + */ + internal fun addNewRarity(rarity: EnchantmentRarity) { + BY_ID.remove(rarity.id) + BY_ID[rarity.id] = rarity + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/rarity/EnchantmentRarity.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/rarity/EnchantmentRarity.kt new file mode 100644 index 00000000..e0a30aaf --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/rarity/EnchantmentRarity.kt @@ -0,0 +1,40 @@ +package com.willfp.ecoenchants.rarity + +import com.willfp.eco.core.config.interfaces.Config +import java.util.* + +@Suppress("DEPRECATION") +class EnchantmentRarity( + internal val config: Config +) { + val id = config.getString("id") + val displayName = config.getFormattedString("display-name") + val tableChance = config.getDouble("table-chance") + val minimumLevel = config.getInt("minimum-level") + val villagerChance = config.getDouble("villager-chance") + val lootChance = config.getDouble("loot-chance") + + init { + EnchantmentRarities.addNewRarity(this) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + if (other !is EnchantmentRarity) { + return false + } + + return other.id == this.id + } + + override fun hashCode(): Int { + return Objects.hash(id) + } + + override fun toString(): String { + return "EnchantmentType{$id}" + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/ActiveEnchantUpdateListeners.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/ActiveEnchantUpdateListeners.kt new file mode 100644 index 00000000..2e72760e --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/ActiveEnchantUpdateListeners.kt @@ -0,0 +1,74 @@ +package com.willfp.ecoenchants.target + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.events.ArmorChangeEvent +import com.willfp.ecoenchants.target.EnchantLookup.clearEnchantCache +import com.willfp.ecoenchants.target.EnchantmentTargets.isEnchantable +import com.willfp.libreforge.updateEffects +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.Listener +import org.bukkit.event.entity.EntityPickupItemEvent +import org.bukkit.event.inventory.InventoryClickEvent +import org.bukkit.event.player.PlayerDropItemEvent +import org.bukkit.event.player.PlayerItemHeldEvent +import org.bukkit.event.player.PlayerJoinEvent + +@Suppress("UNUSED", "UNUSED_PARAMETER") +class ActiveEnchantUpdateListeners(private val plugin: EcoPlugin) : Listener { + @EventHandler + fun onItemPickup(event: EntityPickupItemEvent) { + if (event.entity !is Player) { + return + } + val player = event.entity as Player + + if (!event.item.itemStack.isEnchantable) { + return + } + + refreshPlayer(player) + } + + @EventHandler + fun onPlayerJoin(event: PlayerJoinEvent) { + refresh() + } + + @EventHandler + fun onInventoryDrop(event: PlayerDropItemEvent) { + if (!event.itemDrop.itemStack.isEnchantable) { + return + } + + refreshPlayer(event.player) + } + + @EventHandler + fun onChangeSlot(event: PlayerItemHeldEvent) { + refreshPlayer(event.player) + plugin.scheduler.run { refreshPlayer(event.player) } + } + + @EventHandler + fun onArmorChange(event: ArmorChangeEvent) { + refreshPlayer(event.player) + } + + @EventHandler + fun onInventoryClick(event: InventoryClickEvent) { + if (event.whoClicked !is Player) { + return + } + refreshPlayer(event.whoClicked as Player) + } + + private fun refresh() { + plugin.server.onlinePlayers.forEach { player: Player -> refreshPlayer(player) } + } + + private fun refreshPlayer(player: Player) { + player.clearEnchantCache() + player.updateEffects() + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt new file mode 100644 index 00000000..69eec908 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantLookup.kt @@ -0,0 +1,138 @@ +package com.willfp.ecoenchants.target + +import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.eco.core.fast.fast +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchantLevel +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import java.util.concurrent.TimeUnit + +typealias SlotProvider = (Player) -> Map + +object EnchantLookup { + private val plugin = EcoEnchantsPlugin.instance + + private val slotProviders = mutableSetOf<(Player) -> Map>() + + private val itemCache = Caffeine.newBuilder() + .expireAfterWrite(2, TimeUnit.SECONDS) + .build>() + + private val enchantCache = Caffeine.newBuilder() + .expireAfterWrite(2, TimeUnit.SECONDS) + .build>() + + @JvmStatic + fun registerProvider(provider: SlotProvider) { + slotProviders.add { + val found = mutableMapOf() + for ((item, slot) in provider(it)) { + if (item != null && slot != null) { + found[item] = slot + } + } + found + } + } + + private fun provide(player: Player): Map { + return itemCache.get(player) { + val found = mutableMapOf() + for (provider in slotProviders) { + found.putAll(provider(player)) + } + + found + } + } + + val Player.heldEnchants: Map + get() { + return enchantCache.get(player) { + val found = mutableMapOf() + + for ((itemStack, slot) in provide(this)) { + val enchants = itemStack.fast().enchants + + for ((enchant, level) in enchants) { + if (enchant !is EcoEnchant) { + continue + } + + if (enchant.slots.contains(slot) || slot == TargetSlot.ANY) { + found[enchant] = found.getOrDefault(enchant, 0) + level + } + } + } + + found + } + } + + val Player.activeEnchants: Map + get() { + return this.heldEnchants.filter { (enchant, level) -> + enchant.getLevel(level).conditions.all { it.isMet(this) } + } + } + + fun Player.getEnchantLevel(enchant: EcoEnchant): Int { + return this.heldEnchants[enchant] ?: 0 + } + + fun Player.getActiveEnchantLevel(enchant: EcoEnchant): Int { + return this.activeEnchants[enchant] ?: 0 + } + + fun Player.hasEnchant(enchant: EcoEnchant): Boolean { + return this.getEnchantLevel(enchant) > 0 + } + + fun Player.hasEnchantActive(enchant: EcoEnchant): Boolean { + return this.getActiveEnchantLevel(enchant) > 0 + } + + val Player.heldEnchantLevels: List + get() = this.heldEnchants + .map { (enchant, level) -> enchant.getLevel(level) } + + /** + * Clear item and enchant cache. + */ + fun Player.clearEnchantCache() { + itemCache.invalidate(player) + enchantCache.invalidate(player) + } + + init { + registerProvider { + mapOf( + Pair( + it.inventory.itemInMainHand, + TargetSlot.HANDS + ) + ) + } + + if (!plugin.configYml.getBool("no-offhand")) { + registerProvider { + mapOf( + Pair( + it.inventory.itemInOffHand, + TargetSlot.HANDS + ) + ) + } + } + + registerProvider { + val items = mutableMapOf() + for (stack in it.inventory.armorContents) { + items[stack] = TargetSlot.ARMOR + } + items + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt new file mode 100644 index 00000000..b5e0f581 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt @@ -0,0 +1,73 @@ +package com.willfp.ecoenchants.target + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.TestableItem +import com.willfp.eco.core.recipe.parts.EmptyTestableItem +import com.willfp.ecoenchants.EcoEnchantsPlugin +import org.bukkit.inventory.ItemStack +import java.util.* + +interface EnchantmentTarget { + val id: String + val displayName: String + val slot: TargetSlot + val items: List + + fun matches(itemStack: ItemStack): Boolean { + for (item in items) { + if (item.matches(itemStack)) { + return true + } + } + return false + } +} + +class ConfiguredEnchantmentTarget( + private val config: Config +) : EnchantmentTarget { + override val id = config.getString("id") + override val displayName = config.getFormattedString("display-name") + + override val slot = TargetSlot.valueOf(config.getString("slot").uppercase()) + + override val items = config.getStrings("items") + .map { Items.lookup(it) } + .filterNot { it is EmptyTestableItem } + + init { + EnchantmentTargets.addNewTarget(this) + } + + override fun equals(other: Any?): Boolean { + if (other !is EnchantmentTarget) { + return false + } + + return this.id == other.id + } + + override fun hashCode(): Int { + return Objects.hash(this.id) + } +} + +internal object AllEnchantmentTarget : EnchantmentTarget { + override val id = "all" + override val displayName = EcoEnchantsPlugin.instance.langYml.getFormattedString("all") + override val slot = TargetSlot.ANY + override val items = EnchantmentTargets.values() + .filterNot { it == this } + .flatMap { it.items } + + override fun equals(other: Any?): Boolean { + return other is AllEnchantmentTarget + } +} + +enum class TargetSlot { + HANDS, + ARMOR, + ANY +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTargets.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTargets.kt new file mode 100644 index 00000000..ce8abb15 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTargets.kt @@ -0,0 +1,88 @@ +package com.willfp.ecoenchants.target + +import com.google.common.collect.ImmutableSet +import com.willfp.ecoenchants.EcoEnchantsPlugin +import org.bukkit.Material +import org.bukkit.inventory.ItemStack + +object EnchantmentTargets { + private val BY_ID = mutableMapOf() + + init { + BY_ID["all"] = AllEnchantmentTarget + update(EcoEnchantsPlugin.instance) + } + + /** + * Get EnchantTarget matching name. + * + * @param name The name to search for. + * @return The matching EnchantTarget, or null if not found. + */ + @JvmStatic + fun getByID(name: String): EnchantmentTarget? { + return BY_ID[name] + } + + /** + * Get target from item. + * + * @param item The item. + * @return The target. + */ + @JvmStatic + fun getForItem(item: ItemStack): List { + return BY_ID.values + .filter { !it.id.equals("all", ignoreCase = true) } + .filter { it.matches(item) } + } + + val ItemStack.isEnchantable: Boolean + get() = getForItem(this).isNotEmpty() || this.type == Material.BOOK || this.type == Material.ENCHANTED_BOOK + + /** + * Get all targets. + * + * @return A set of all targets. + */ + @JvmStatic + fun values(): Set { + return ImmutableSet.copyOf(BY_ID.values) + } + + @JvmStatic + fun update(plugin: EcoEnchantsPlugin) { + for (target in values()) { + if (target is AllEnchantmentTarget) { + continue + } + removeTarget(target) + } + + for (config in plugin.targetsYml.getSubsections("targets")) { + ConfiguredEnchantmentTarget(config) + } + } + + /** + * Remove [EnchantmentTarget] from EcoEnchants. + * + * @param target The [EnchantmentTarget] to remove. + */ + @JvmStatic + fun removeTarget(target: EnchantmentTarget) { + BY_ID.remove(target.id) + } + + /** + * Add new [EnchantmentTarget] to EcoEnchants. + * + * Only for internal use, targets are automatically added in the constructor. + * + * @param target The [EnchantmentTarget] to add. + */ + internal fun addNewTarget(target: EnchantmentTarget) { + BY_ID.remove(target.id) + BY_ID[target.id] = target + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt new file mode 100644 index 00000000..4496a917 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt @@ -0,0 +1,39 @@ +package com.willfp.ecoenchants.type + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.ecoenchants.mechanics.infiniteIfNegative +import java.util.* + +@Suppress("DEPRECATION") +class EnchantmentType( + internal val config: Config +) { + val id = config.getString("id") + val format = config.getString("format") + val limit = config.getInt("limit").infiniteIfNegative() + val highLevelBias = config.getDouble("high-level-bias") + + init { + EnchantmentTypes.addNewType(this) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + if (other !is EnchantmentType) { + return false + } + + return other.id == this.id + } + + override fun hashCode(): Int { + return Objects.hash(id) + } + + override fun toString(): String { + return "EnchantmentType{$id}" + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentTypes.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentTypes.kt new file mode 100644 index 00000000..3aa386f4 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentTypes.kt @@ -0,0 +1,84 @@ +package com.willfp.ecoenchants.type + +import com.google.common.collect.HashBiMap +import com.google.common.collect.ImmutableSet +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.enchants.EcoEnchants +import com.willfp.ecoenchants.rarity.EnchantmentRarities +import com.willfp.ecoenchants.target.EnchantmentTargets + +@Suppress("UNUSED") +object EnchantmentTypes { + private val BY_ID = HashBiMap.create() + + /** + * Get all registered [EnchantmentType]s. + * + * @return A list of all [EnchantmentType]s. + */ + @JvmStatic + fun values(): Set { + return ImmutableSet.copyOf(BY_ID.values) + } + + /** + * Get [String]s for all registered [EnchantmentType]s. + * + * @return A list of all [EnchantmentType]s. + */ + @JvmStatic + fun keySet(): Set { + return ImmutableSet.copyOf(BY_ID.keys) + } + + /** + * Get [EnchantmentType] matching key. + * + * @param id The key to search for. + * @return The matching [EnchantmentType], or null if not found. + */ + @JvmStatic + fun getByID(id: String?): EnchantmentType? { + return if (id == null) { + null + } else BY_ID[id] + } + + /** + * Update all [EnchantmentType]s. + * + * @param plugin Instance of EcoEnchants. + */ + @JvmStatic + fun update(plugin: EcoEnchantsPlugin) { + for (type in values()) { + removeType(type) + } + for (config in plugin.typesYml.getSubsections("types")) { + EnchantmentType(config) + } + } + + /** + * Remove [EnchantmentType] from EcoEnchants. + * + * @param type The [EnchantmentType] to remove. + */ + @JvmStatic + fun removeType(type: EnchantmentType) { + BY_ID.remove(type.id) + } + + /** + * Add new [EnchantmentType] to EcoEnchants. + * + * Only for internal use, types are automatically added in the constructor. + * + * @param type The [EnchantmentType] to add. + */ + internal fun addNewType(type: EnchantmentType) { + BY_ID.remove(type.id) + BY_ID[type.id] = type + } +} diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml index 85d63fb5..7493a38d 100644 --- a/eco-core/core-plugin/src/main/resources/config.yml +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -3,142 +3,106 @@ # by Auxilor # -allow-on-npc: false # If enchantments should activate against NPCs. - -commands: - enchantinfo: - show-target-group: true # Show name of target group rather than individual items - -anvil: - rework-cost: false # Use vanilla rework penalty - allow-unsafe-levels: false # Allow unsafe enchantments like Sharpness 6 by combining 2 Sharp 5. - allow-combining-unsafe: false # Allow further combining unsafe levels, eg Sharp 6 + Sharp 6 = Sharp 7. - allow-existing-unsafe-levels: true # Allow combining existing unsafe enchantments like Sharpness 6 - - cost-exponent: # Increase value of each extra level by the exponent^levels - enabled: true # Use exponent - exponent: 0.95 # Exponent. Beware that slight changes to this value may cause huge changes in cost. - - hard-cap: # Completely limit the amount of enchantments that can be placed on an item - enabled: false # Enable a hard cap - cap: 10 # Most enchantments allowed on an item - -lore: - use-numerals: true - use-numbers-above-threshold: 10 # After level 10, enchantments will display as Name Number, eg: Sharpness 25 instead of Sharpness XXV - - above-other-lore: true # If enchantments should be displayed above other lore - - # If above max level enchantments should be formatted differently - # Format is available in lang.yml - above-max-level: - reformat: true - numbers-only: true # If only the numbers should be reformatted - - sort-by-type: false # Sort enchantments by type - sort-by-length: false # Sort enchantments by length - sort-by-rarity: false # Sort enchantments by rarity. - # Any combination of the above options is valid - - require-target: true # Only display items included in target.yml - - type-ordering: # Only used if sort-by-type is enabled - top to bottom - - normal - - special - - artifact - - spell - - curse - - rarity-ordering: # Only used if sort-by-rarity is enabled - top to bottom - - common - - uncommon - - rare - - epic - - legendary - - special - - veryspecial - - describe: # Describe enchantments in lore - enabled: false - before-lines: 5 # Describe before or equal to number of enchantments - wrap: 30 # Word wrap after number of characters - at-bottom: false # If descriptions should be shown after all enchantments rather than under each one - only-on-books: false # If descriptions should only be shown on books - - # Ensure that describe and shrink have no overlap as this may cause errors - - shrink: # Collapse large amount of enchantments - enabled: true - after-lines: 9 # Collapse after number of enchantments - maximum-per-line: 2 # Maximum number of enchantments to have in 1 line - - prefix: [] # Lines used above the enchantments - suffix: [] # Lines used below the enchantments - prefix-on-books: false # If the prefix/suffix should work on books as well as items +# If the hand slot shouldn't work in the players offhand +no-offhand: false # Restart your server after this option, doesn't work with /ecoenchants reload +# Options for enchanting items in the enchanting table enchanting-table: - enabled: true # Enable EcoEnchants through an enchanting table - book-times-less-likely: 2 # Times less likely to get an EcoEnchant on a book to balance them out. Don't recommend editing. - maximum-obtainable-level: 30 # Max level for enchanting table. Vanilla default is 30, change if you have a plugin that edits this. - special-bias: 0.7 # Value between 0-1 dictating rarity of high-level special enchantments. 0 is no extra bias, 1 is only level 1. - notify-on-special: # Tell player in chat and make a sound when they get a special enchantment - enabled: true - sound: ENTITY_PLAYER_LEVELUP - pitch: 1.5 - show-particles: true - particle-amount: 26 - - cap-amount: # Prevent getting above a certain amount of enchantments - enabled: true # Enable capping - limit: 5 # Cap at amount - - reduce-probability: # Reduce probability of adding new enchantment by factor after each enchantment added - enabled: true # Enable reduction - factor: 2.2 # Factor to reduce probability by. Done as compound, so second pass is (factor) times less likely than first, third less likely than second, etc + enabled: true # If custom enchantments should be available from enchanting tables + book-multiplier: 0.5 # Multiplier applied to the chance of getting an enchantment on a book (to balance enchant numbers) + maximum-obtainable-level: 30 # The max level for the enchanting table. EcoEnchants doesn't change the limit, but if you have a plugin that does, adjust this to match. + cap: 5 # The maximum amount of enchantments to get at any given time + reduction: 2.2 # The chance to get each subsequent enchantment is divided by this number, e.g. 2nd enchant is 2.2x less likely than 1st, 3rd is 2.2x less likely again, etc +# Options for obtaining custom enchants from villagers villager: - enabled: true # Enable EcoEnchants through villagers - book-times-less-likely: 7 # Times less likely to get an enchantment from a book with a villager. Recommended to be higher as books can only have one enchantment on them. - notify-on-special: # Show particles when the villager unlocks a special enchantment trade - enabled: true - particle-amount: 14 - - reduce-probability: # Reduce probability of adding new enchantment by factor after each enchantment added. Does not apply to books as they only ever contain one enchantment. - enabled: true # Enable reduction - factor: 5 # Factor to reduce probability by. Done as compound, so second pass is (factor) times less likely than first, third less likely than second, etc + enabled: true # If custom enchantments should be available from villagers + book-multiplier: 0.14 # Multiplier applied to the chance of getting an enchantment on a book (to balance enchant numbers) + reduction: 5 # The chance to get each subsequent enchantment is divided by this number, e.g. 2nd enchant is 5x less likely than 1st, 3rd is 5x less likely again, etc +# Options for obtaining custom enchants in natural loot loot: - enabled: true # Enable EcoEnchants through loot chests - book-times-less-likely: 2 + enabled: true # If custom enchantments should be available from natural loot + book-multiplier: 0.5 # Multiplier applied to the chance of getting an enchantment on a book (to balance enchant numbers) + reduction: 7.5 # The chance to get each subsequent enchantment is divided by this number, e.g. 2nd enchant is 7.5x less likely than 1st, 3rd is 7.5x less likely again, etc - reduce-probability: # Reduce probability of adding new enchantment by factor after each enchantment added. Does not apply to books as they only ever contain one enchantment. - enabled: true # Enable reduction - factor: 7.5 # Factor to reduce probability by. Done as compound, so second pass is (factor) times less likely than first, third less likely than second, etc +# Options for merging items in an anvil +anvil: + cost-exponent: 0.95 # The exponent for each enchant level to prevent constant "Too Expensive!" problems + enchant-limit: -1 # The limit for the amount of enchantments on an item (-1 to disable) + use-rework-penalty: true # If the rework penalty should be applied -types: - special: - allow-multiple: false # Allow multiple special enchantments on a single item - cooldown-in-actionbar: true # Show cooldown messages in the action bar rather than in chat - artifact: - allow-multiple: false # Allow multiple artifacts on a single item (can cause lag!) +# Options for how enchantments are displayed on items +display: + numerals: + enabled: true # If numerals should be used for the enchantment levels + threshold: 10 # Above this, numbers will be used instead of numerals -rarity: - vanilla-rarity: uncommon # Vanilla enchantments do not have an EcoEnchants rarity - what rarity should they have? - vanilla-treasure-rarity: legendary # Treasure enchantments do not appear in vanilla enchanting tables (Mending, Soul Speed, Frost Walker) - # The above options *do not* affect actual enchantment rarities. They are purely for cosmetic purposes, like in item lores. + above-max-level: + enabled: true # If enchantments above their max level should have a custom format + format: "" # The format to apply + level-only: true # If only the level should be formatted -use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements -raytrace-distance: 80 # The distance that alt_click should check for a location -block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes) + sort: + type: false # If enchantments should be sorted by time + type-order: # The order for types to be sorted in. Types not in this list will not be displayed if type sorting is enabled. + - normal + - special + - curse -cooldown: # For custom enchantments + length: false # If enchantments should be sorted by length + + rarity: false # If enchantments should be sorted by rarity + rarity-order: # The order for rarities to be sorted in. Rarities not in this list will not be displayed if rarity sorting is enabled. + - common + - uncommon + - rare + - epic + - legendary + - special + - veryspecial + + collapse: + enabled: true # If enchantments should be collapsed in lore + threshold: 9 # Above this amount, enchantments will be collapsed + per-line: 2 # The amount of enchantments to put in each line + delimiter: ", " # The delimiter between enchantments + + descriptions: + enabled: true # If enchantment descriptions should be shown in lore + threshold: 5 # Above this amount, enchantment descriptions will not be shown + word-wrap: 30 # Number of characters to have on each line + format: "&8" + +# Options for the /enchantinfo GUI +enchantinfo: + rows: 3 # How many rows for the GUI + mask: # The background material + items: + - black_stained_glass_pane + pattern: # 1 for the first item, 2 for the second item, etc + - "111111111" + - "111101111" + - "111111111" + item: + row: 2 + column: 5 + show-max-level: true # Whether the book should be the max level or level 1 + lore: # The description is automatically appended + - "" + - "&fMax Level: &a%max_level%" + - "&fRarity: &a%rarity%" + - "&fApplicable to: &a%targets%" + - "&fConflicts with: &a%conflicts%" + +cooldown: in-actionbar: true sound: enabled: true sound: "BLOCK_NOTE_BLOCK_PLING" pitch: 0.5 -cannot-afford: # For custom enchantments +cannot-afford: in-actionbar: true sound: enabled: true @@ -155,6 +119,10 @@ cannot-afford-type: point-names: # If you have point names that look ugly (eg g_souls) then you can map them to nice names to be shown to players. example_point: "Nicely Formatted Point" +use-faster-move-trigger: true # Disable if you want move trigger to detect sub-1-block movements +raytrace-distance: 80 # The distance that alt_click should check for a location +block-item-drop-place-check: true # If the block_item_drop trigger should only fire on naturally placed blocks (prevents dupes) + potions: icon: permanent: true @@ -164,63 +132,4 @@ potions: triggered: true particles: permanent: false - triggered: true - -advanced: - force-dropqueue: true - # When combined with collate, this massively reduces calls to getItemMeta, which can hurt performance when many enchants are on an item. - # Enabling this option makes all drops go through telekinesis listeners - lore-getter: - # This converts enchantments with matching names from other enchantment plugins from lore into real enchantments. - # This is experimental not recommended to be used for extended periods of time: enchantments are automatically converted. - # Only use this if absolutely necessary as it may cause some bugs. - enabled: false - aggressive: false - # Aggressive mode converts all items in all inventories when opened. - # This will most likely have a significant performance penalty. - hide-fixer: - # Fixes some items obtained in older versions with a bug that caused enchantments to be hidden. - # Works both in packets to display the enchants to the client as well as changing the server-side item too. - # Only use this option if you've encountered this bug as it may strip HideEnchants from items that you might not expect it to. - enabled: false - aggressive: false - # Aggressive mode converts all items in all inventories whenever revealed. - # This may impact performance. - force: false # If **all** items should have hide enchants removed - absolute last ditch effort, most likely to break other things. - hard-disable: - # Fixes potential problems with other plugins where the enchantments are still present when disabled. - # Enabling this prevents the enchantments from being registered with the server at all when disabled. - # There may be some unknown problems with this, but will fix bugs with plugins such as Slimefun. - # Hard disabled enchantments will not update on /ecoreload. You will have to restart your server. - enabled: false - dual-registration: - # Fixes potential plugin conflicts/serialization issues when updating from a version before 7.3.0. - # Registers byName both the internal enchantment name (new method) and the display name (old method). - # There may be potential bugs with having duplicate enchantments, so enable this only if you need it. - enabled: true - level-clamp: - # Helps reverse players who have illegal above-max-level enchantments. - # When holding an item, any enchantments above their max level will be set to the max level in order to prevent illegal items. - # Players with ecoenchants.bypasslevelclamp permission will be ignored. - # This may impact performance. - enabled: false - # If the item should be deleted rather than have the enchantment level capped. - delete-item: false - remove-illegal: - # Helps reverse players who have enchantments on illegal items. - # When holding an item, any enchantments present on the item that shouldn't be will be removed. - # Players with ecoenchants.allowillegal permission will be ignored. - # This may impact performance. - enabled: false - # If the item should be deleted rather than have the enchantment removed. - delete-item: false - remove-disabled: - # Remove invalid / disabled enchantments from items server-side - # Useful if you're disabling enchantments permanently and don't mind removing them from existing players - # Also helps remove deleted enchantments or enchantments from old plugins - enabled: false - hard-cap-clamp: - # Helps reverse players who have items with more enchants than the hard cap. - # Players with ecoenchants.anvil.bypasshardcap permission will be ignored. - # This may impact performance. - enabled: false + triggered: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/customenchants.yml b/eco-core/core-plugin/src/main/resources/customenchants.yml deleted file mode 100644 index 25b976bd..00000000 --- a/eco-core/core-plugin/src/main/resources/customenchants.yml +++ /dev/null @@ -1,66 +0,0 @@ -chains: - - id: example_chain - effects: - - id: teleport - - id: potion_effect - args: - effect: blindness - level: 3 - duration: 30 - apply_to_player: true - - id: send_message - args: - message: "&fYou have been teleported!" - action_bar: true - - id: play_sound - args: - sound: entity_dragon_fireball_explode - pitch: 1.5 - volume: 4 - -enchants: - - id: escape - type: normal - name: "Escape" - description: Gain a short burst of speed %value% after taking damage - - obtaining: - table: true - villager: true - loot: true - rarity: epic - - general-config: - flags: [ ] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [ ] - not-met-lore: [ ] - conflicts: [ ] - - levels: - - effects: - - id: potion_effect - args: - effect: speed - level: 1 - duration: 30 - apply_to_player: true - triggers: - - take_damage - conditions: [ ] - value-placeholder: I - - effects: - - id: potion_effect - args: - effect: speed - level: 2 - duration: 30 - apply_to_player: true - triggers: - - take_damage - conditions: [ ] - value-placeholder: II \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/_example.yml b/eco-core/core-plugin/src/main/resources/enchants/_example.yml new file mode 100644 index 00000000..7b81cfe5 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/enchants/_example.yml @@ -0,0 +1,35 @@ +# The ID of the enchantment is the name of the .yml file, +# for example razor.yml has the ID of razor +# You can place enchantments anywhere in this folder, +# including in subfolders if you want to organize your enchantment configs +# _example.yml is not loaded. + +display-name: "Example" # The name of the enchantment in-game +description: "Gives a &a%placeholder%%&8 bonus to damage" # The description of the enchantment +placeholder: "%level% * 20" # The placeholder to show in the enchantment description +type: normal # The enchantment type, from types.yml + +targets: # The items that the enchantment can be applied to, see targets.yml + - sword +conflicts: # The enchantments that conflict with this + - sharpness +rarity: common # The rarity of the enchantment, see rarity.yml +max-level: 4 # The max level of the enchantment + +tradeable: true # If the enchantment can be obtained from villagers +discoverable: true # If the enchantment can generate naturally in chests +enchantable: true # If the enchantment can be obtained from enchanting tables + +# The effects of the enchantment (i.e. the functionality) +# See here: https://plugins.auxilor.io/effects/configuring-an-effect +# Use %level% as a placeholder for the enchantment level +effects: + - id: damage_multiplier + args: + multiplier: 1 + 0.2 * %level% + triggers: + - melee_attack + +# The conditions required to use the enchantment, +# you can use %level% as a placeholder here too +conditions: [ ] diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/angerartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/angerartifact.yml deleted file mode 100644 index 00b5e6a9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/angerartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Anger Artifact EcoEnchant -# - -name: "Anger Artifact" -description: Creates angry villager particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/ashartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/ashartifact.yml deleted file mode 100644 index d258d5a1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/ashartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Ash Artifact EcoEnchant -# - -name: "Ash Artifact" -description: Creates basalt deltas particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/cloudsartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/cloudsartifact.yml deleted file mode 100644 index c8efb2fc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/cloudsartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Clouds Artifact EcoEnchant -# - -name: "Clouds Artifact" -description: Creates cloud particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/copperartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/copperartifact.yml deleted file mode 100644 index e2befc47..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/copperartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copper Artifact EcoEnchant -# - -name: "Copper Artifact" -description: Creates copper particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/crimsonartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/crimsonartifact.yml deleted file mode 100644 index 3b284bae..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/crimsonartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Crimson Artifact EcoEnchant -# - -name: "Crimson Artifact" -description: Creates crimson forest particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/damageartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/damageartifact.yml deleted file mode 100644 index 9f29eb7f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/damageartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Damage Artifact EcoEnchant -# - -name: "Damage Artifact" -description: Creates damage particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/dragonartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/dragonartifact.yml deleted file mode 100644 index faedcd4c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/dragonartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Dragon Artifact EcoEnchant -# - -name: "Dragon Artifact" -description: Creates dragon breath particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/dustartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/dustartifact.yml deleted file mode 100644 index 02e98599..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/dustartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Dust Artifact EcoEnchant -# - -name: "Dust Artifact" -description: Creates dust particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/emeraldartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/emeraldartifact.yml deleted file mode 100644 index 721caba6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/emeraldartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Emerald Artifact EcoEnchant -# - -name: "Emerald Artifact" -description: Creates emerald particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/enchantmentartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/enchantmentartifact.yml deleted file mode 100644 index 1f21052e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/enchantmentartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Enchantment Artifact EcoEnchant -# - -name: "Enchantment Artifact" -description: Creates enchantment particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/endartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/endartifact.yml deleted file mode 100644 index 2c742e12..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/endartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# End Artifact EcoEnchant -# - -name: "End Artifact" -description: Creates end rod particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/fireartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/fireartifact.yml deleted file mode 100644 index 07b6666b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/fireartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Fire Artifact EcoEnchant -# - -name: "Fire Artifact" -description: Creates fire particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/glowartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/glowartifact.yml deleted file mode 100644 index cda72d9f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/glowartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Glow Artifact EcoEnchant -# - -name: "Glow Artifact" -description: Creates glow particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/heartartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/heartartifact.yml deleted file mode 100644 index 6d81756e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/heartartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Heart Artifact EcoEnchant -# - -name: "Heart Artifact" -description: Creates heart particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/honeyartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/honeyartifact.yml deleted file mode 100644 index f28dbe35..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/honeyartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Honey Artifact EcoEnchant -# - -name: "Honey Artifact" -description: Creates dripping honey particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false| - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/inkartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/inkartifact.yml deleted file mode 100644 index 6199b60f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/inkartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Ink Artifact EcoEnchant -# - -name: "Ink Artifact" -description: Creates ink particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/lavaartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/lavaartifact.yml deleted file mode 100644 index e463c68d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/lavaartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Lava Artifact EcoEnchant -# - -name: "Lava Artifact" -description: Creates dripping lava particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/lightartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/lightartifact.yml deleted file mode 100644 index 502aaf76..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/lightartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Light Artifact EcoEnchant -# - -name: "Light Artifact" -description: Creates light particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/limeartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/limeartifact.yml deleted file mode 100644 index 50d7f157..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/limeartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Lime Artifact EcoEnchant -# - -name: "Lime Artifact" -description: Creates lime particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/magicartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/magicartifact.yml deleted file mode 100644 index e14ae873..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/magicartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Magic Artifact EcoEnchant -# - -name: "Magic Artifact" -description: Creates magic particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/magmaartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/magmaartifact.yml deleted file mode 100644 index d96e1b69..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/magmaartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Magma Artifact EcoEnchant -# - -name: "Magma Artifact" -description: Creates lava pop particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/musicartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/musicartifact.yml deleted file mode 100644 index 5c2520ec..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/musicartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Music Artifact EcoEnchant -# - -name: "Music Artifact" -description: Creates note particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/nautilusartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/nautilusartifact.yml deleted file mode 100644 index a9ce20b5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/nautilusartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Nautilus Artifact EcoEnchant -# - -name: "Nautilus Artifact" -description: Creates nautilus particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/netherartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/netherartifact.yml deleted file mode 100644 index 1ce4871e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/netherartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Nether Artifact EcoEnchant -# - -name: "Nether Artifact" -description: Creates nether portal particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/rainartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/rainartifact.yml deleted file mode 100644 index 16f7c820..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/rainartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Rain Artifact EcoEnchant -# - -name: "Rain Artifact" -description: Creates rain particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/redstoneartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/redstoneartifact.yml deleted file mode 100644 index cd855918..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/redstoneartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Redstone Artifact EcoEnchant -# - -name: "Redstone Artifact" -description: Creates redstone particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/skulkartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/skulkartifact.yml deleted file mode 100644 index 617f6ddd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/skulkartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Skulk Artifact EcoEnchant -# - -name: "Skulk Artifact" -description: Creates skulk vibration particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/slimeartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/slimeartifact.yml deleted file mode 100644 index 4e6669fe..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/slimeartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Slime Artifact EcoEnchant -# - -name: "Slime Artifact" -description: Creates slime particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/smokeartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/smokeartifact.yml deleted file mode 100644 index 52bb4eec..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/smokeartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Smoke Artifact EcoEnchant -# - -name: "Smoke Artifact" -description: Creates smoke particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/snowartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/snowartifact.yml deleted file mode 100644 index ff41cf4b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/snowartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Snow Artifact EcoEnchant -# - -name: "Snow Artifact" -description: Creates snow particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/soulartifact.yml deleted file mode 100644 index 770eaaad..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Soul Artifact EcoEnchant -# - -name: "Soul Artifact" -description: Creates soul particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulfireartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/soulfireartifact.yml deleted file mode 100644 index 34043f21..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/soulfireartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Soul Fire Artifact EcoEnchant -# - -name: "Soul Fire Artifact" -description: Creates soul flame particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkartifact.yml deleted file mode 100644 index c26e0123..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Spark Artifact EcoEnchant -# - -name: "Spark Artifact" -description: Creates spark particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkleartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkleartifact.yml deleted file mode 100644 index a5734403..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/sparkleartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Sparkle Artifact EcoEnchant -# - -name: "Sparkle Artifact" -description: Creates firework particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/sporeartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/sporeartifact.yml deleted file mode 100644 index 38836cf5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/sporeartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Spore Artifact EcoEnchant -# - -name: "Spore Artifact" -description: Creates dripleaf spore particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/sweepartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/sweepartifact.yml deleted file mode 100644 index a2f7fd52..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/sweepartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Sweep Artifact EcoEnchant -# - -name: "Sweep Artifact" -description: Creates sweep attack particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/tearartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/tearartifact.yml deleted file mode 100644 index 4730ed6c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/tearartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Tear Artifact EcoEnchant -# - -name: "Tear Artifact" -description: Creates crying obsidian particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/totemartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/totemartifact.yml deleted file mode 100644 index 65d2131f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/totemartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Totem Artifact EcoEnchant -# - -name: "Totem Artifact" -description: Creates totem particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/villagerartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/villagerartifact.yml deleted file mode 100644 index 6b8c2131..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/villagerartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Villager Artifact EcoEnchant -# - -name: "Villager Artifact" -description: Creates happy villager particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/warpedartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/warpedartifact.yml deleted file mode 100644 index d1416fbf..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/warpedartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Warped Artifact EcoEnchant -# - -name: "Warped Artifact" -description: Creates warped forest particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/waterartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/waterartifact.yml deleted file mode 100644 index 342b00ed..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/waterartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Water Artifact EcoEnchant -# - -name: "Water Artifact" -description: Creates dripping water particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/waxartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/waxartifact.yml deleted file mode 100644 index 6c492353..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/waxartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Wax Artifact EcoEnchant -# - -name: "Wax Artifact" -description: Creates wax particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/witchartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/witchartifact.yml deleted file mode 100644 index ac6dd89b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/witchartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Witch Artifact EcoEnchant -# - -name: "Witch Artifact" -description: Creates witch particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/artifact/zapartifact.yml b/eco-core/core-plugin/src/main/resources/enchants/artifact/zapartifact.yml deleted file mode 100644 index 6ea67985..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/artifact/zapartifact.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Zap Artifact EcoEnchant -# - -name: "Zap Artifact" -description: Creates electric particles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: artifact - -general-config: - flags: [] - targets: - - pickaxe - - sword - - axe - - elytra - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - # For Attack - radius: 1 - y-delta: 0.07 - radius-multiplier: 5 - use-double-helix: false - - # For Arrows + Tridents - particle-tick-delay: 2 - - # For Pickaxes - amount: 10 - on-blocks: - - diamond_ore - - deepslate_diamond_ore - - gold_ore - - deepslate_gold_ore - - lapis_ore - - deepslate_lapis_ore - - redstone_ore - - deepslate_redstone_ore - - iron_ore - - deepslate_iron_ore - - copper_ore - - deepslate_copper_ore - - emerald_ore - - deepslate_emerald_ore - - obsidian - - ancient_debris \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/breaklessnesscurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/breaklessnesscurse.yml deleted file mode 100644 index ba6632ef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/breaklessnesscurse.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Curse of Breaklessness EcoEnchant -# - -name: "Curse of Breaklessness" -description: '&a%value%%&r chance to prevent block breaking.' -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - - axe - - hoe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/callingcurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/callingcurse.yml deleted file mode 100644 index 8995c7a2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/callingcurse.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Curse of Calling EcoEnchant -# - -name: "Curse of Calling" -description: Angers all mobs within &a%value%&r blocks. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: false - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - mending - -config: - repeat-ticks: 20 # How often (in ticks) to call entities - distance: 20 # Entity Range \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/decaycurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/decaycurse.yml deleted file mode 100644 index 19a79ff8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/decaycurse.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Curse of Decay EcoEnchant -# - -name: "Curse of Decay" -description: Automatically damages items when not held. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - mending - - repairing - -config: - repeat-ticks: 100 # How often (in ticks) to repair items - multiplier: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/fragilitycurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/fragilitycurse.yml deleted file mode 100644 index 38b78e1a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/fragilitycurse.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Curse of Fragility EcoEnchant -# - -name: "Curse of Fragility" -description: Decreases item durability by &a%value%&r times. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - all - grindstoneable: false - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - unbreaking - -config: - minimum-extra-durability: 2 #minimum extra durability lost on each usage - maximum-extra-durability: 8 #maximum extra durability lost on each usage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/harmlessnesscurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/harmlessnesscurse.yml deleted file mode 100644 index 67404d6b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/harmlessnesscurse.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Curse of Harmlessness EcoEnchant -# - -name: "Curse of Harmlessness" -description: '&a%value%%&r chance for attacks to do nothing.' -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: false - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/hungercurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/hungercurse.yml deleted file mode 100644 index 671e2a7d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/hungercurse.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Curse of Hunger EcoEnchant -# - -name: "Curse of Hunger" -description: Increases hunger loss by &a%value%&rx. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - grindstoneable: false - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sating - -config: - times-more-hunger: 2 diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/inaccuracycurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/inaccuracycurse.yml deleted file mode 100644 index c33ca926..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/inaccuracycurse.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Curse of Inaccuracy EcoEnchant -# - -name: "Curse of Inaccuracy" -description: Arrows fire incorrectly. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - spread: 0.2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/misfortunecurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/misfortunecurse.yml deleted file mode 100644 index 44978722..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/misfortunecurse.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Curse of Misfortune EcoEnchant -# - -name: "Curse of Misfortune" -description: '&a%value%%&r chance for blocks to not drop items.' -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - - axe - - hoe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - fortune - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/curse/permanencecurse.yml b/eco-core/core-plugin/src/main/resources/enchants/curse/permanencecurse.yml deleted file mode 100644 index 85dc0176..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/curse/permanencecurse.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Curse of Permanence EcoEnchant -# - -name: "Curse of Permanence" -description: Prevents item from being modified in an anvil. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - all - grindstoneable: false - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - mending - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/abattoir.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/abattoir.yml deleted file mode 100644 index 75528abc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/abattoir.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Abattoir EcoEnchant -# - -name: "Abattoir" -description: Increases damage against passive mobs by &a%value%&r. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - conflicts: - - serrated - - bladed - - phantasm - - pacify - - arachnid - - impaling - maximum-level: 5 - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/abrasion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/abrasion.yml deleted file mode 100644 index 2ee1926e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/abrasion.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Abrasion EcoEnchant -# - -name: "Abrasion" -description: Damages your opponents armor by &a%value%&r. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - allow-not-fully-charged: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/aerial.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/aerial.yml deleted file mode 100644 index 0fc94135..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/aerial.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Aerial EcoEnchant -# - -name: "Aerial" -description: Increases arrow damage by &a%value%%&r when shot while in air. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.06 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/aquatic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/aquatic.yml deleted file mode 100644 index e0db2c1b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/aquatic.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Aquatic EcoEnchant -# - -name: "Aquatic" -description: Trident deals &a%value%%&r more damage when shot from water. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.05 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/arachnid.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/arachnid.yml deleted file mode 100644 index 2dd3950a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/arachnid.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Arachnid EcoEnchant -# - -name: "Arachnid" -description: Increases damage against spiders by &a%value%%&r. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - serrated - - bladed - - phantasm - - pacify - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/arborist.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/arborist.yml deleted file mode 100644 index 82f4cc7e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/arborist.yml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Arborist EcoEnchant -# - -name: "Arborist" -description: Get more sticks, apples, and saplings from leaves. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - axe - - shears - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - silk_touch - maximum-level: 4 - -config: - items: - - stick - - apple - - acacia_sapling - - birch_sapling - - dark_oak_sapling - - jungle_sapling - - oak_sapling - - spruce_sapling - chance-per-level: 3 # Chance to drop item. \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/arcanic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/arcanic.yml deleted file mode 100644 index 562b0343..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/arcanic.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Arcanic EcoEnchant -# - -name: "Arcanic" -description: '&a%value%%&r chance to ignore potion damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 2 #Chance of ignoring potion damage = Total points (16 points * 3 chance = 48% chance) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/atmospheric.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/atmospheric.yml deleted file mode 100644 index 77e00d26..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/atmospheric.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Atmospheric EcoEnchant -# - -name: "Atmospheric" -description: Increases trident damage by &a%value%%&r when you are in air. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.06 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/backstab.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/backstab.yml deleted file mode 100644 index 8345a02c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/backstab.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Backstab EcoEnchant -# - -name: "Backstab" -description: Deal &a%value%%&r more damage from behind. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.1 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/beheading.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/beheading.yml deleted file mode 100644 index 9a4881ac..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/beheading.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Beheading EcoEnchant -# - -name: "Beheading" -description: '&a%value%%&r chance of getting player or mob head.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 10 # chance of dropping skull per level - custom-heads: # custom heads for mobs (mob_type::texture_value::display name) - - "enderman::eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTZjMGIzNmQ1M2ZmZjY5YTQ5YzdkNmYzOTMyZjJiMGZlOTQ4ZTAzMjIyNmQ1ZTgwNDVlYzU4NDA4YTM2ZTk1MSJ9fX0=::Enderman's Head" - - "spider::eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2Q1NDE1NDFkYWFmZjUwODk2Y2QyNThiZGJkZDRjZjgwYzNiYTgxNjczNTcyNjA3OGJmZTM5MzkyN2U1N2YxIn19fQ==::Spider's Head" - - "cave_spider::eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDE2NDVkZmQ3N2QwOTkyMzEwN2IzNDk2ZTk0ZWViNWMzMDMyOWY5N2VmYzk2ZWQ3NmUyMjZlOTgyMjQifX19::Cave Spider's Head" \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml deleted file mode 100644 index 9e1a2006..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blastmining.yml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Blast Mining EcoEnchant -# - -name: "Blast Mining" -description: Mines blocks in a 3x3 area. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - drill - - vein - maximum-level: 3 - -config: - chance-per-level: 20 - disable-on-sneak: true - enable-sound: true # Play explosion sound - hardness-check: true # Only break blocks with hardness less than or equal to first block - blacklisted-blocks: - - bedrock - - end_portal_frame - - end_portal - - end_gateway \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/bleed.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/bleed.yml deleted file mode 100644 index 47a32965..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/bleed.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Bleed EcoEnchant -# - -name: "Bleed" -description: '&a%value%%&r chance to cause your opponent to bleed, damaging them repeatedly.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 1.5 #chance of bleeding per level - allow-not-fully-charged: false #dont require sword attack to be at full charge - bleed-damage: 1 - amount-per-level: 1 # Bleed number per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blind.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blind.yml deleted file mode 100644 index 4ffdb66e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blind.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Blind EcoEnchant -# - -name: "Blind" -description: '&a%value%%&r chance of blinding your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1 #as percentage - duration-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/blockbreather.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/blockbreather.yml deleted file mode 100644 index 29861575..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/blockbreather.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Block Breather EcoEnchant -# - -name: "Block Breather" -description: '&a%value%%&r chance to ignore suffocation damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/bosshunter.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/bosshunter.yml deleted file mode 100644 index 64461b50..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/bosshunter.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Boss Hunter EcoEnchant -# - -name: "Boss Hunter" -description: Increases damage against bosses. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/buckshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/buckshot.yml deleted file mode 100644 index 3404766c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/buckshot.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Buckshot EcoEnchant -# - -name: "Buckshot" -description: Shoots multiple arrows spread out. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - succession - - pentashot - - tripleshot - maximum-level: 2 - -config: - amount-per-level: 3 # Arrows to shoot per level - spread-per-level: 0.2 # Spread randomness per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/butchering.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/butchering.yml deleted file mode 100644 index 67fd5214..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/butchering.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Butchering EcoEnchant -# - -name: "Butchering" -description: Increases damage against passive mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - defusion - - razor - - ender_slayer - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to creepers = base damage + (level * bonus), eg Defusion 5 will do 12.5 more damage to creepers \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cerebral.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cerebral.yml deleted file mode 100644 index 4c332eb8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cerebral.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Cerebral EcoEnchant -# - -name: "Cerebral" -description: Increases damage on headshots. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.03 # Damage = level * multiplier + 1. Headshot with Cerebral 5 = 5 * 0.05 + 1 = 1.25x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/chopless.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/chopless.yml deleted file mode 100644 index 1aef37c0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/chopless.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Chopless EcoEnchant -# - -name: "Chopless" -description: Reduces damage dealt by axes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - percent-less-per-level: 0.8 # Points * Percent less / 100 * damage = damage taken \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cleave.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cleave.yml deleted file mode 100644 index 931c3f6a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cleave.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cleave EcoEnchant -# - -name: "Cleave" -description: Damage all entities around attacked entity. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - carve - maximum-level: 8 - -config: - damage-percentage-per-level: 2.5 - radius-per-level: 0.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/collateral.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/collateral.yml deleted file mode 100644 index cdc6b68b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/collateral.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Collateral EcoEnchant -# - -name: "Collateral" -description: Arrows can go through entities. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: -# No config is available for this enchantment diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/conclude.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/conclude.yml deleted file mode 100644 index 7d0650aa..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/conclude.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Conclude EcoEnchant -# - -name: "Conclude" -description: '&a%value%%&r chance to instantly kill entities on low health.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Conclude 5 kills any mobs below 2.5 hearts - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/corrosive.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/corrosive.yml deleted file mode 100644 index 253840ab..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/corrosive.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Corrosive EcoEnchant -# - -name: "Corrosive" -description: Damages your opponents armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cranial.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cranial.yml deleted file mode 100644 index 62b5655d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cranial.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Cranial EcoEnchant -# - -name: "Cranial" -description: Increases damage on headshots. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.03 # Damage = level * multiplier + 1. Headshot with Cranial 5 = 5 * 0.05 + 1 = 1.25x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/criticals.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/criticals.yml deleted file mode 100644 index 10404213..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/criticals.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Criticals EcoEnchant -# - -name: "Criticals" -description: Increases critical damage by &a%value%%&r. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.1 # 1 + (Level * Multiplier) is multiplied with the damage - use-additive: false # Multiply base damage rather than vanilla critical damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/cubism.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/cubism.yml deleted file mode 100644 index 2c8f800e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/cubism.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Cubism EcoEnchant -# - -name: "Cubism" -description: Increases damage dealt against slimes and magma cubes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - multiplier: 0.035 # Damage = level * multiplier + 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/defender.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/defender.yml deleted file mode 100644 index 5cee7eee..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/defender.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Defender EcoEnchant -# - -name: "Defender" -description: Prevents damaging your own pets. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: -# No config available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/deflection.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/deflection.yml deleted file mode 100644 index 7bf0fac8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/deflection.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Deflection EcoEnchant -# - -name: "Deflection" -description: Rebounds some incoming damage back to your attacker. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - percent-deflected-per-level: 5 # Percent of damage to deal to attacker per level (can go above 100) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/defusion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/defusion.yml deleted file mode 100644 index b35f43a0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/defusion.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Defusion EcoEnchant -# - -name: "Defusion" -description: Increases damage against creepers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - butchering - - razor - - ender_slayer - - introversion - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to creepers = base damage + (level * bonus), eg Defusion 5 will do 12.5 more damage to creepers \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dexterous.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dexterous.yml deleted file mode 100644 index 6d8390a4..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dexterous.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Dexterous EcoEnchant -# - -name: "Dexterous" -description: Increases attack speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - add-speed-per-level: 0.2 #Bonus to attack speed, default 4.0 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/disable.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/disable.yml deleted file mode 100644 index efc7f1fa..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/disable.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Disable EcoEnchant -# - -name: "Disable" -description: '&a%value%%&r chance of giving your opponent extreme mining fatigue.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false - chance-per-level: 2 #as percentage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/disappear.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/disappear.yml deleted file mode 100644 index 6e099365..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/disappear.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Disappear EcoEnchant -# - -name: "Disappear" -description: Go invisble if damaged on low health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - ticks-per-level: 2 - threshold: 5 # If health is below threshold after being damaged, go invisble diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/diurnal.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/diurnal.yml deleted file mode 100644 index e30f61f0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/diurnal.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Diurnal EcoEnchant -# - -name: "Diurnal" -description: Increases damage dealt at daytime. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - nocturnal - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/diverse.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/diverse.yml deleted file mode 100644 index 6b3e4f33..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/diverse.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Diverse EcoEnchant -# - -name: "Diverse" -description: Increases damage dealt against players holding swords. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - multiplier: 0.05 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dousing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dousing.yml deleted file mode 100644 index e6755792..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dousing.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Dousing EcoEnchant -# - -name: "Dousing" -description: '&a%value%%&r chance to put out fire on block.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [ ] - not-met-lore: [ ] - conflicts: - - ignite - maximum-level: 8 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/drill.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/drill.yml deleted file mode 100644 index 02d554b1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/drill.yml +++ /dev/null @@ -1,41 +0,0 @@ -# -# Drill EcoEnchant -# - -name: "Drill" -description: Mines blocks behind other blocks. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - - axe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - lumberjack - - blast_mining - - vein - maximum-level: 5 - -config: - chance-per-level: 100 # Not chance-based by default - blocks-per-level: 1 - disable-on-sneak: true - hardness-check: true # Only break blocks with hardness less than or equal to first block - blacklisted-blocks: - - bedrock - - end_portal_frame - - end_portal - - end_gateway \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dullness.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dullness.yml deleted file mode 100644 index 511bfd8d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dullness.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Dullness EcoEnchant -# - -name: "Dullness" -description: '&a%value%%&r chance of giving your opponent weakness.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false #require sword attack to be at full charge - chance-per-level: 2 - duration-per-level: 10 # 20 ticks is one second \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/dweller.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/dweller.yml deleted file mode 100644 index 3bcbae67..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/dweller.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Dweller EcoEnchant -# - -name: "Dweller" -description: Increases damage against illagers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.2 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/economical.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/economical.yml deleted file mode 100644 index 5cf7b878..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/economical.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Economical EcoEnchant -# - -name: "Economical" -description: '&a%value%%&r chance to not consume fireworks while boosting.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 20 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/electroshock.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/electroshock.yml deleted file mode 100644 index cf437949..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/electroshock.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Electroshock EcoEnchant -# - -name: "Electroshock" -description: '&a%value%%&r chance to strike lightning on your attacker.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - - conflicts: [ ] - maximum-level: 3 - -config: - local-lightning-sound: false # Should be lightning sound played locally - chance-per-level: 5 - damage: 4 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/enderism.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/enderism.yml deleted file mode 100644 index 25604d5a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/enderism.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Enderism EcoEnchant -# - -name: "Enderism" -description: Increases damage dealt in the end. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - netheric - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/enderslayer.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/enderslayer.yml deleted file mode 100644 index 43f1633b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/enderslayer.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Ender Slayer EcoEnchant -# - -name: "Ender Slayer" -description: Increases damage against end mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - defusion - - razor - - butchering - - introversion - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to creepers = base damage + (level * bonus), eg Defusion 5 will do 12.5 more damage to creepers \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/endinfusion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/endinfusion.yml deleted file mode 100644 index d022abc6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/endinfusion.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# End Infusion EcoEnchant -# - -name: "End Infusion" -description: Increases damage dealt in the end. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - nether_infusion - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/evasion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/evasion.yml deleted file mode 100644 index 6736b106..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/evasion.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Evasion EcoEnchant -# - -name: "Evasion" -description: '&a%value%%&r chance to ignore incoming damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - # Each level of evasion on each piece of armor counts as a point, so if a player is wearing 4 pieces of armor all with Evasion 3, then that would be 12 points - chance-per-level: 0.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/extinguishing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/extinguishing.yml deleted file mode 100644 index 948f07f7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/extinguishing.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Extinguishing EcoEnchant -# - -name: "Extinguishing" -description: '&a%value%%&r chance to remove fire when taking fire damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 4 #Chance of being extinguished = Total points (12 points * 4 chance = 48% chance) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/extract.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/extract.yml deleted file mode 100644 index 4299be59..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/extract.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Extract EcoEnchant -# - -name: "Extract" -description: Heals a portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/famine.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/famine.yml deleted file mode 100644 index bbca822d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/famine.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Famine EcoEnchant -# - -name: "Famine" -description: '&a%value%%&r chance of giving your opponent hunger.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - allow-not-fully-charged: false - chance-per-level: 1.5 - ticks-per-level: 40 - amplifier-per-level: 1 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/farmhand.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/farmhand.yml deleted file mode 100644 index ffd6dcfd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/farmhand.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Farmhand EcoEnchant -# - -name: "Farmhand" -description: Till blocks around initial block. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - initial-radius: 1 - per-level-radius: 1 - use-cube: true #If set to false, then it will use a square, and so will not go up/down edges - per-block-damage: true #If set to false, then it will only take 1 durability \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/fetching.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/fetching.yml deleted file mode 100644 index 60c0a6b2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/fetching.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Fetching EcoEnchant -# - -name: "Fetching" -description: Drops and xp from wolf kills go directly into your inventory. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - not-on-players: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/finality.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/finality.yml deleted file mode 100644 index fe1e5449..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/finality.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Finality EcoEnchant -# - -name: "Finality" -description: '&a%value%%&r chance to instantly kill entities on low health.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finality 5 kills any mobs below 2.5 hearts - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/finishing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/finishing.yml deleted file mode 100644 index f1ee9968..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/finishing.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Finishing EcoEnchant -# - -name: "Finishing" -description: '&a%value%%&r chance to instantly kill entities on low health.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finishing 5 kills any mobs below 2.5 hearts - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/fireaffinity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/fireaffinity.yml deleted file mode 100644 index 555abb8c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/fireaffinity.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Fire Affinity EcoEnchant -# - -name: "Fire Affinity" -description: Increases damage dealt when on fire. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - water_affinity - maximum-level: 7 - -config: - multiplier: 0.05 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/firststrike.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/firststrike.yml deleted file mode 100644 index 2e9d05ea..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/firststrike.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# First Strike EcoEnchant -# - -name: "First Strike" -description: Increases damage dealt when entity is on max health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.15 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/flinch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/flinch.yml deleted file mode 100644 index f495e864..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/flinch.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Flinch EcoEnchant -# - -name: "Flinch" -description: '&a%value%%&r chance to blind your attacker.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 2.5 - ticks-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/forcefield.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/forcefield.yml deleted file mode 100644 index 9e165b7d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/forcefield.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Forcefield EcoEnchant -# - -name: "Forcefield" -description: Damages all nearby monsters. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - initial-distance: 1.5 # Initial range - bonus-per-level: 0.3 # Bonus range per level (Level 1 also includes bonus) - damage-per-level: 0.5 - repeat-ticks: 20 # Damage nearby mobs every few ticks. Lower values lead to more damage and may cause lag - damage-chance: 0.2 # The chance for armor to be damaged every damage tick \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/freerunner.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/freerunner.yml deleted file mode 100644 index 9cee7ea1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/freerunner.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Freerunner EcoEnchant -# - -name: "Freerunner" -description: '&a%value%%&r chance to ignore fall damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/frozen.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/frozen.yml deleted file mode 100644 index d849f79b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/frozen.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Frozen EcoEnchant -# - -name: "Frozen" -description: '&a%value%%&r chance to give your attacker slowness.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 0.6 - points-per-level: 6 # Points of frozen required to increment slowness level by 1 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/fury.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/fury.yml deleted file mode 100644 index 121a5002..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/fury.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Fury EcoEnchant -# - -name: "Fury" -description: '&a%value%%&r chance of angering nearby monsters towards your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - allow-not-fully-charged: false #require sword attack to be at full charge - chance-per-level: 2 - distance-per-level: 3 # Distance for mobs to check \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/goliath.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/goliath.yml deleted file mode 100644 index e6e5ba15..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/goliath.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Goliath EcoEnchant -# - -name: "Goliath" -description: Increases damage against entities with more health than you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.01 # If enemy has 200 health, and you have 20 w/ goliath 8 then your damage is multiplied by: ((200/10)*8*0.01) + 1 = 2.6 - multiplier-cap: 2.5 # Never deal more than x times more damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/graceful.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/graceful.yml deleted file mode 100644 index 0da2472c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/graceful.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Graceful EcoEnchant -# - -name: "Graceful" -description: '&a%value%%&r chance of getting slow falling just above hitting the ground.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 4 #chance of slow falling per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/grapple.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/grapple.yml deleted file mode 100644 index ca91f7e8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/grapple.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Grapple EcoEnchant -# - -name: "Grapple" -description: Pulls entities towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - knockback - - tornado - - annihilate - maximum-level: 2 - -config: - velocity-multiplier: 0.75 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/greenthumb.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/greenthumb.yml deleted file mode 100644 index cc5908ed..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/greenthumb.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Green Thumb EcoEnchant -# - -name: "Green Thumb" -description: Left clicking dirt turns it to grass. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - damage: true # Damage hoe on use \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/grit.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/grit.yml deleted file mode 100644 index 8ee563c6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/grit.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Grit EcoEnchant -# - -name: "Grit" -description: Damages your opponents weapon. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - damage-per-level: 0.3 # Damage * points (0.3 * 12 points = 3.6) Rounded up. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/hellish.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/hellish.yml deleted file mode 100644 index c49c3893..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/hellish.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Hellish EcoEnchant -# - -name: "Hellish" -description: Increases damage dealt in the nether. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - void_affinity - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/hook.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/hook.yml deleted file mode 100644 index 0f27976b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/hook.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Hook EcoEnchant -# - -name: "Hook" -description: Pulls entities towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - punch - maximum-level: 2 - -config: - velocity-multiplier: 0.75 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/horde.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/horde.yml deleted file mode 100644 index 09ec5432..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/horde.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Horde EcoEnchant -# - -name: "Horde" -description: Increases damage dealt the more mobs are nearby. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - multiplier-per-level: 0.005 # Multiplier per mob per level (ie 10 mobs at level 4 will be 1.2x more powerful) - distance-per-level: 2.5 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/iceshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/iceshot.yml deleted file mode 100644 index 6447e2d1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/iceshot.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Ice Shot EcoEnchant -# - -name: "Ice Shot" -description: '&a%value%%&r chance of freezing your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 3 #chance of slowness per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/identify.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/identify.yml deleted file mode 100644 index ece888f9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/identify.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Identify EcoEnchant -# - -name: "Identify" -description: '&a%value%%&r chance to give your attacker glowing.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 10 - ticks-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/ignite.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/ignite.yml deleted file mode 100644 index 1c94e924..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/ignite.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Ignite EcoEnchant -# - -name: "Ignite" -description: '&a%value%%&r chance to light hit block on fire.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - dousing - maximum-level: 8 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/illusionaspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/illusionaspect.yml deleted file mode 100644 index 20b3910b..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/illusionaspect.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Illusion Aspect EcoEnchant -# - -name: "Illusion Aspect" -description: '&a%value%%&r chance to blind and nauseate opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of illusioning opponent per level - allow-not-fully-charged: false #dont require sword attack to be at full charge \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/impact.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/impact.yml deleted file mode 100644 index b4018082..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/impact.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Impact EcoEnchant -# - -name: "Impact" -description: '&a%value%%&r chance to deal extreme damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - damage-multiplier: 3 - chance-per-level: 0.5 # Chance to deal more (as percentage) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/incandescence.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/incandescence.yml deleted file mode 100644 index 11620be5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/incandescence.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Incandescence EcoEnchant -# - -name: "Incandescence" -description: Light your attacker on fire. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - initial-ticks: 20 - ticks-per-point: 2 # Ticks victim will be alight for multiplied by each enchantment point, eg: All armor with incandescence 3 = 4*3 = 12 points. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/infernaltouch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/infernaltouch.yml deleted file mode 100644 index 065754d7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/infernaltouch.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Infernal Touch EcoEnchant -# - -name: "Infernal Touch" -description: Automatically smelt mined blocks. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - silk_touch - - stone_switcher - -config: - drop-xp: true # If experience should be given \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/inferno.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/inferno.yml deleted file mode 100644 index 536d8d0d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/inferno.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Infernal EcoEnchant -# - -name: "Inferno" -description: Flaming tridents. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: -# No config available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/infuriate.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/infuriate.yml deleted file mode 100644 index 5eee45ae..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/infuriate.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Infuriate EcoEnchant -# - -name: "Infuriate" -description: '&a%value%%&r chance to cause nearby mobs to attack your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 2 - distance-per-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/insecticide.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/insecticide.yml deleted file mode 100644 index 99fc9c1c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/insecticide.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Insecticide EcoEnchant -# - -name: "Insecticide" -description: Increases damage against spiders. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - power - - force - - revenant - - slaughter - - settle - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/instantaneous.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/instantaneous.yml deleted file mode 100644 index 77fb03e4..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/instantaneous.yml +++ /dev/null @@ -1,37 +0,0 @@ -# -# Instantaneous EcoEnchant -# - -name: "Instantaneous" -description: '&a%value%%&r chance to instantly break blocks.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - pickaxe - - axe - - shovel - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 3 - blacklisted-blocks: - - BEDROCK - - OBSIDIAN - - END_PORTAL - - END_PORTAL_GATE - - NETHER_PORTAL \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/introversion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/introversion.yml deleted file mode 100644 index 1229a811..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/introversion.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Introversion EcoEnchant -# - -name: "Introversion" -description: Increases damage against players. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sharpness - - bane_of_arthropods - - smite - - defusion - - razor - - ender_slayer - - butchering - maximum-level: 5 - -config: - bonus-per-level: 2.5 # Damage to players = base damage + (level * bonus), eg Introversion 5 will do 12.5 more damage to players \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/invigoration.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/invigoration.yml deleted file mode 100644 index 8a9ad02c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/invigoration.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Invigoration EcoEnchant -# - -name: "Invigoration" -description: Increases outgoing damage and reduces incoming damage when low on health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - # Each level of invigoration on each piece of armor counts as a point, so if a player is wearing 4 pieces of armor all with Invigoration 3, then that would be 12 points - reduction-multiplier: 5 # In percent, so default is take 5% less damage per point - damage-multiplier: 2.5 # In percent, so default is deal 2.5% more damage per point - below-health: 5 # Activates below specified health diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/kinetic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/kinetic.yml deleted file mode 100644 index 3421fd6f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/kinetic.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Kinetic EcoEnchant -# - -name: "Kinetic" -description: Reduces damage taken when flying into a wall. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - reduction-per-level: 15 #Percent less damage taken per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/launch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/launch.yml deleted file mode 100644 index 6667bc31..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/launch.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Launch EcoEnchant -# - -name: "Launch" -description: Fireworks give a short burst of extreme speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - multiplier: 0.3 # Velocity multiplier per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/leeching.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/leeching.yml deleted file mode 100644 index aef18e5d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/leeching.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Leeching EcoEnchant -# - -name: "Leeching" -description: Heals a portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - life_steal - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal - allow-not-fully-charged: false diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/lesion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/lesion.yml deleted file mode 100644 index d748ee7f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/lesion.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Lesion EcoEnchant -# - -name: "Lesion" -description: '&a%value%%&r chance to your opponent to bleed, damaging them repeatedly.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 3 #chance of bleeding per level - bleed-damage: 1 - amount-per-level: 1 # Bleed number per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/levitate.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/levitate.yml deleted file mode 100644 index f9829236..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/levitate.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Levitate EcoEnchant -# - -name: "Levitate" -description: '&a%value%%&r chance of applying levitation to your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of levitation per level - duration-per-level: 30 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/liquidshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/liquidshot.yml deleted file mode 100644 index fc6a9e0e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/liquidshot.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Liquid Shot EcoEnchant -# - -name: "Liquid Shot" -description: Increases damage against fiery mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.05 # Damage = level * multiplier + 1. Damage on blaze/magma cube with Liquid Shot 5 = 5 * 0.05 + 1 = 1.25x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/luckycatch.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/luckycatch.yml deleted file mode 100644 index 2136b8a9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/luckycatch.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Lucky Catch EcoEnchant -# - -name: "Lucky Catch" -description: '&a%value%%&r chance to double fishing drops.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 15 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/lumberjack.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/lumberjack.yml deleted file mode 100644 index fdbd2cea..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/lumberjack.yml +++ /dev/null @@ -1,45 +0,0 @@ -# -# Lumberjack EcoEnchant -# - -name: "Lumberjack" -description: Instantly cut down entire trees. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - maximum-level: 6 - conflicts: - - drill - -config: - disable-on-sneak: true - blocks-per-level: 32 - whitelisted-blocks: - - oak_wood - - dark_oak_wood - - acacia_wood - - jungle_wood - - birch_wood - - crimson_stem - - spruce_wood - - warped_stem - - oak_log - - dark_oak_log - - acacia_log - - jungle_log - - birch_log - - spruce_log \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/magnetic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/magnetic.yml deleted file mode 100644 index a98dcc00..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/magnetic.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Magnetic EcoEnchant -# - -name: "Magnetic" -description: Items and XP go towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - initial-distance: 2.5 # Initial item pickup range - bonus-per-level: 0.6 # Bonus range per level (Level 1 also includes bonus) - repeat-ticks: 3 # Check magnetic every few ticks. Lower values give smoother animations and feels better to the end user, however may cause lag on lower-end hardware. - disable-while-sneaking: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/marking.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/marking.yml deleted file mode 100644 index 79f1d39e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/marking.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Marking EcoEnchant -# - -name: "Marking" -description: Increases subsequent damage dealt to opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - ticks-per-level: 15 # Ticks to weaken player for per level - multiplier-while-weak: 1.25 # Times more damage to deal while weakened diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/marksman.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/marksman.yml deleted file mode 100644 index 6659d8fe..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/marksman.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Marksman EcoEnchant -# - -name: "Marksman" -description: Removes arrow drop. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - remove-arrow-after-ticks: 120 #to prevent server lag, as arrows shot into the sky will not land. there are 20 ticks in a second. diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/necrotic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/necrotic.yml deleted file mode 100644 index 2e783c23..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/necrotic.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Necrotic EcoEnchant -# - -name: "Necrotic" -description: Wither skeletons have a &a%value%%&r higher chance to drop skulls. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - looting - maximum-level: 4 - -config: - chance-per-level: 5 #Chance of dropping a wither skull per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/netheric.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/netheric.yml deleted file mode 100644 index 53562426..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/netheric.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Netheric EcoEnchant -# - -name: "Netheric" -description: Increases damage dealt in the nether. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - enderism - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/netherinfusion.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/netherinfusion.yml deleted file mode 100644 index 3ba42604..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/netherinfusion.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Nether Infusion EcoEnchant -# - -name: "Nether Infusion" -description: Increases damage dealt in the nether. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - end_infusion - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/nocturnal.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/nocturnal.yml deleted file mode 100644 index 1e0edb5c..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/nocturnal.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Nocturnal EcoEnchant -# - -name: "Nocturnal" -description: Increases damage dealt at night. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - diurnal - maximum-level: 6 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/optics.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/optics.yml deleted file mode 100644 index 46b1e7b9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/optics.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Optics EcoEnchant -# - -name: "Optics" -description: Increases damage when further from target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - block-multiplier: 0.001 # Damage multiplier is distance * level * multiplier + 1 eg: 50 blocks with optics 5 and multiplier 0.001 = 50*5*0.001+1 = 1.25x damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/oxygenate.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/oxygenate.yml deleted file mode 100644 index e3bcd511..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/oxygenate.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Oxygenate EcoEnchant -# - -name: "Oxygenate" -description: Gain oxygen when breaking blocks underwater. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - pickaxe - - axe - - shovel - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - oxygen-per-level: 8 # Oxygen ticks to give per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/pacify.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/pacify.yml deleted file mode 100644 index 86afee77..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/pacify.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Pacify EcoEnchant -# - -name: "Pacify" -description: Increases damage against creepers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - serrated - - bladed - - phantasm - - arachnid - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/paladin.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/paladin.yml deleted file mode 100644 index 6bf34616..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/paladin.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Paladin EcoEnchant -# - -name: "Paladin" -description: Increases damage dealt when riding a horse. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - multiplier: 0.2 # 1 + (Level * Multiplier) is multiplied with the damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/paralyze.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/paralyze.yml deleted file mode 100644 index 3399c3df..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/paralyze.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Paralyze EcoEnchant -# - -name: "Paralyze" -description: '&a%value%%&r chance to give your attacker mining fatigue.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1.5 - ticks-per-level: 5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/parasitic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/parasitic.yml deleted file mode 100644 index 43bb377d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/parasitic.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Parasitic EcoEnchant -# - -name: "Parasitic" -description: Heals a portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/parry.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/parry.yml deleted file mode 100644 index fad6a90a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/parry.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Parry EcoEnchant -# - -name: "Parry" -description: Reduces incoming damage when holding item. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.05 # 1 - (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/phantasm.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/phantasm.yml deleted file mode 100644 index bff379d5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/phantasm.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Phantasm EcoEnchant -# - -name: "Phantasm" -description: Increases damage against undead mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - serrated - - bladed - - arachnid - - pacify - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/plasmic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/plasmic.yml deleted file mode 100644 index 7dc006d0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/plasmic.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Plasmic EcoEnchant -# - -name: "Plasmic" -description: Increases damage dealt against opponents with diamond or netherite armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - voltage - maximum-level: 5 - -config: - multiplier: 0.015 # bonus damage multiplier = multiplier * level * pieces diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/protector.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/protector.yml deleted file mode 100644 index a9bd663d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/protector.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Protector EcoEnchant -# - -name: "Protector" -description: Prevents damaging your own pets. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: -# No config available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/proximity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/proximity.yml deleted file mode 100644 index 363a7621..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/proximity.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Proximity EcoEnchant -# - -name: "Proximity" -description: Increases damage when closer to opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - when-closer-than-blocks: 1.5 - multiplier: 0.05 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/puncture.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/puncture.yml deleted file mode 100644 index 41bf163f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/puncture.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Puncture EcoEnchant -# - -name: "Puncture" -description: Trident deals additional damage to shelled mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - multiplier: 0.12 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/quadrilateralism.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/quadrilateralism.yml deleted file mode 100644 index ea3b7d8e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/quadrilateralism.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Quadrilateralism EcoEnchant -# - -name: "Quadrilateralism" -description: Increases damage dealt against slimes and magma cubes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - multiplier: 0.035 # Damage = level * multiplier + 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/radiance.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/radiance.yml deleted file mode 100644 index aa511304..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/radiance.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Radiance EcoEnchant -# - -name: "Radiance" -description: Causes entities to glow near where arrow lands. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - radius-multiplier: 3 # Radius Multiplier * level = Radius of which to damage entities - duration-per-level: 10 # Duration (in ticks) to make entity glow for \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rage.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rage.yml deleted file mode 100644 index 50b62447..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rage.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Rage EcoEnchant -# - -name: "Rage" -description: '&a%value%%&r chance of angering nearby monsters towards your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - chance-per-level: 3 - distance-per-level: 4 # Distance for mobs to check \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rapid.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rapid.yml deleted file mode 100644 index d2423df6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rapid.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Rapid EcoEnchant -# - -name: "Rapid" -description: Increases bow pull speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - percent-faster-per-level: 16 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/reaper.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/reaper.yml deleted file mode 100644 index b967d0e3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/reaper.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Reaper EcoEnchant -# - -name: "Reaper" -description: '&a%value%%&r chance to prevent your opponents soulbound from working.' -enabled: true - -obtaining: - table: true - villager: false - loot: false - rarity: legendary - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 2 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rebounding.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rebounding.yml deleted file mode 100644 index 91a0deb5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rebounding.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Rebounding EcoEnchant -# - -name: "Rebounding" -description: Deal knockback to entities that attack you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - velocity-multiplier: 1.07 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/reel.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/reel.yml deleted file mode 100644 index 02aa2d02..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/reel.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Reel EcoEnchant -# - -name: "Reel" -description: Pulls entities towards you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - velocity-multiplier: 0.75 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/reinforcement.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/reinforcement.yml deleted file mode 100644 index 135b5f69..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/reinforcement.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Reinforcement EcoEnchant -# - -name: "Reinforcement" -description: Reduces incoming damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - reduction-per-level: 2 #Percent less damage taken per level (Protection is 4%) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/rejuvenation.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/rejuvenation.yml deleted file mode 100644 index ed2152ab..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/rejuvenation.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Rejuvenation EcoEnchant -# - -name: "Rejuvenation" -description: Increases natural regeneration speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - per-point-multiplier: 0.1 # 8 points * multiplier +1 = 1.8x natural regen \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/replenish.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/replenish.yml deleted file mode 100644 index 9aa585e7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/replenish.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Replenish EcoEnchant -# - -name: "Replenish" -description: Automatically replants crops. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/respirator.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/respirator.yml deleted file mode 100644 index acaf960e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/respirator.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Respirator EcoEnchant -# - -name: "Respirator" -description: Reduces dragon breath damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - percent-less-per-level: 15 # Points * Percent less / 100 * damage = damage taken \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/revenant.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/revenant.yml deleted file mode 100644 index 59e58aee..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/revenant.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Revenant EcoEnchant -# - -name: "Revenant" -description: Increases damage against undead mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - power - - force - - insecticide - - slaughter - - settle - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/sating.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/sating.yml deleted file mode 100644 index 55e06bb5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/sating.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Sating EcoEnchant -# - -name: "Sating" -description: Reduces hunger loss by &a%value%%&r. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 10 # Chance to "ignore" food loss (in percent) every time you lose food \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/serrated.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/serrated.yml deleted file mode 100644 index c284aa06..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/serrated.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Serrated EcoEnchant -# - -name: "Serrated" -description: Trident deals additional damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - bladed - - phantasm - - arachnid - - pacify - - abattoir - - impaling - maximum-level: 5 - -config: - multiplier: 0.4 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/settle.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/settle.yml deleted file mode 100644 index 367c1b15..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/settle.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Settle EcoEnchant -# - -name: "Settle" -description: Increases damage against creepers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - power - - force - - revenant - - slaughter - - insecticide - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/shockwave.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/shockwave.yml deleted file mode 100644 index bef3f3fd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/shockwave.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Shockwave EcoEnchant -# - -name: "Shockwave" -description: Damages entities that arrows fly near. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - damage-per-level: 1 diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/shotassist.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/shotassist.yml deleted file mode 100644 index 568adcd9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/shotassist.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Shot Assist EcoEnchant -# - -name: "Shot Assist" -description: Deal more damage with arrows while wearing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - multiplier: 0.015 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/sickening.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/sickening.yml deleted file mode 100644 index 41397dc1..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/sickening.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Sickening EcoEnchant -# - -name: "Sickening" -description: '&a%value%%&r chance of nauseating your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #as percentage - duration-per-level: 30 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/slaughter.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/slaughter.yml deleted file mode 100644 index 46935b26..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/slaughter.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Slaughter EcoEnchant -# - -name: "Slaughter" -description: Increases damage against passive mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - power - - force - - revenant - - insecticide - - settle - maximum-level: 5 - -config: - multiplier: 0.4 # Formula is (multiplier * (level + 1) + 1)*damage | Power is 0.25 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/slicing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/slicing.yml deleted file mode 100644 index 714fea9f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/slicing.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Slicing EcoEnchant -# - -name: "Slicing" -description: Damages entities when flown through. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - elytra - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - damage-per-level: 0.7 #Damage given to opponent per level - cooldown: 20 #Cooldown in ticks until player can attack another entity with slicing - damage-elytra: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/spearfishing.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/spearfishing.yml deleted file mode 100644 index 1fa255c5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/spearfishing.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Spearfishing EcoEnchant -# - -name: "Spearfishing" -description: '&a%value%%&r chance of dropping fish when tridenting water.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 4 - drops: - - cod - - salmon - - pufferfish - - tropical_fish \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/spiked.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/spiked.yml deleted file mode 100644 index 1b41fae0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/spiked.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Spiked EcoEnchant -# - -name: "Spiked" -description: Hooking onto an entity will damage it. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: common - -general-config: - flags: [] - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - harpoon - maximum-level: 3 - -config: - damage-per-level: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/splash.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/splash.yml deleted file mode 100644 index 119a4fc3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/splash.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Splash EcoEnchant -# - -name: "Splash" -description: Damages entities near where trident lands but does not drop experience. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - wisdom - maximum-level: 4 - -config: - radius-multiplier: 2 # Radius Multiplier * level = Radius of which to damage entities - damage-per-level: 1 # Damage to give to nearby entities \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stab.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stab.yml deleted file mode 100644 index 5065f3f9..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stab.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Stab EcoEnchant -# - -name: "Stab" -description: Increases melee trident damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - damage-base: 0.5 # More damage to do as base - damage-per-level: 0.5 # More damage to do per level - # Default values are taken from sharpness diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stalwart.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stalwart.yml deleted file mode 100644 index a189cb27..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stalwart.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Stalwart EcoEnchant -# - -name: "Stalwart" -description: '&a%value%%&r chance to get resistance for a short time when taking damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - chance-per-level: 2 - duration-per-level: 5 # Ticks to get resistance for \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stamina.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stamina.yml deleted file mode 100644 index 16f3ae97..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stamina.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Stamina EcoEnchant -# - -name: "Stamina" -description: Decreases hunger loss by &a%value%%&r while sprinting. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 10 # Chance to "ignore" food loss (in percent) every time you lose food while sprinting \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/stoneswitcher.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/stoneswitcher.yml deleted file mode 100644 index a73c474d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/stoneswitcher.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Stone Switcher EcoEnchant -# - -name: "Stone Switcher" -description: '&a%value%%&r for stone to drop as variants.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - transfuse - - silk_touch - maximum-level: 6 - -config: - blocks: - - andesite - - granite - - diorite - chance-per-level: 10 # Chance for drop to be switched diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/strayaspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/strayaspect.yml deleted file mode 100644 index e9d8b198..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/strayaspect.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Stray Aspect EcoEnchant -# - -name: "Stray Aspect" -description: '&a%value%%&r chance of slowing your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - allow-not-fully-charged: false - chance-per-level: 1 #chance of slowness per level - ticks-per-level: 10 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/succession.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/succession.yml deleted file mode 100644 index 0f6269c6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/succession.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Succession EcoEnchant -# - -name: "Succession" -description: Shoots multiple arrows in a burst. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [ ] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [ ] - not-met-lore: [ ] - conflicts: - - tripleshot - - pentashot - - buckshot - maximum-level: 4 - -config: - extra-arrows-per-level: 1 - per-arrow-damage: true # If set to false, then it will only take 1 durability - delay-between-arrows: 4 # Tick delay between each subsequent arrow \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/supercritical.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/supercritical.yml deleted file mode 100644 index eb9e11c0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/supercritical.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Supercritical EcoEnchant -# - -name: "Supercritical" -description: '&a%value%%&r chance to deal extreme damage.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - damage-multiplier: 3 - allow-not-fully-charged: false - chance-per-level: 0.5 # Chance to deal supercrit per hit \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/sycophant.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/sycophant.yml deleted file mode 100644 index fd922938..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/sycophant.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Sycophant EcoEnchant -# - -name: "Sycophant" -description: Heals a portion of damage blocked. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - shield - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - health-per-level: 1 # Level * Health = Amount of health to heal diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tectonic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tectonic.yml deleted file mode 100644 index 79a154ef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tectonic.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Tectonic EcoEnchant -# - -name: "Tectonic" -description: Damages nearby entities when taking fall damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - feather_falling - maximum-level: 2 - -config: - initial-radius: 3 - per-level-radius: 2 - initial-damage: 1 - per-level-damage: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/telekinesis.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/telekinesis.yml deleted file mode 100644 index 7fe295fc..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/telekinesis.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Telekinesis EcoEnchant -# - -name: "Telekinesis" -description: Drops and xp go directly into your inventory. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - pickaxe - - axe - - shovel - - hoe - - sword - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - use-orb: true # Use experience orb above player to give xp. Use if you need mending interaction. - not-on-players: false # Disallow getting drops from players \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/thor.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/thor.yml deleted file mode 100644 index e759a0b0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/thor.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Thor EcoEnchant -# - -name: "Thor" -description: '&a%value%%&r chance of striking lightning on your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - local-lightning-sound: false # Should be lightning sound played locally - chance-per-level: 2 - allow-not-fully-charged: false # dont require sword attack to be at full charge - lightning-damage: 2.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/thrive.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/thrive.yml deleted file mode 100644 index d00372ec..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/thrive.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Thrive EcoEnchant -# - -name: "Thrive" -description: Increases maximum health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - prosperity - maximum-level: 2 - -config: - health-per-point: 1 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml deleted file mode 100644 index d6383875..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tornado.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Tornado EcoEnchant -# - -name: "Tornado" -description: Knocks your opponent into the air. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - knockback - - grapple - - annihilate - maximum-level: 2 - -config: - velocity-per-level: 0.25 - time-to-exempt: 60 #In ticks. Time to exempt hit player from being detected by your Anti-Cheat for flying (The higher max velocity is - the higher should be this value) \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/toxic.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/toxic.yml deleted file mode 100644 index 42a8b1d5..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/toxic.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Toxic EcoEnchant -# - -name: "Toxic" -description: '&a%value%%&r chance to apply poison to your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of poisoning opponent per level - allow-not-fully-charged: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/transfuse.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/transfuse.yml deleted file mode 100644 index f67c5857..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/transfuse.yml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Transfuse EcoEnchant -# - -name: "Transfuse" -description: '&a%value%%&r chance for stone to drop as random ore.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - stone_switcher - - silk_touch - maximum-level: 7 - -config: - blocks: - - diamond_ore - - gold_ore - - lapis_ore - - redstone_ore - - iron_ore - - copper_ore - chance-per-level: 0.03 # Chance for drop to be switched - works-on: - - stone diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/tripleshot.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/tripleshot.yml deleted file mode 100644 index 5378f731..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/tripleshot.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Tripleshot EcoEnchant -# - -name: "Tripleshot" -description: Shoots 3 arrows. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - succession - - pentashot - - buckshot - maximum-level: 1 - -config: - chance-per-level: 100 # Not chance-based by default - angle: 11 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/vampireaspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/vampireaspect.yml deleted file mode 100644 index 3d7e9a70..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/vampireaspect.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Vampire Aspect EcoEnchant -# - -name: "Vampire Aspect" -description: '&a%value%%&r chance to apply wither to your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - chance-per-level: 3 #chance of withering opponent per level - allow-not-fully-charged: false #dont require sword attack to be at full charge \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/vein.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/vein.yml deleted file mode 100644 index e6d20b52..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/vein.yml +++ /dev/null @@ -1,51 +0,0 @@ -# -# Vein EcoEnchant -# - -name: "Vein" -description: Mine blocks in a vein. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - maximum-level: 5 - conflicts: - - drill - - blast_mining - -config: - disable-on-sneak: true - blocks-per-level: 8 - whitelisted-blocks: - - coal_ore - - iron_ore - - copper_ore - - gold_ore - - ancient_debris - - lapis_ore - - diamond_ore - - redstone_ore - - nether_quartz_ore - - gilded_blackstone - - nether_gold_ore - - glowstone - - deepslate_coal_ore - - deepslate_iron_ore - - deepslate_copper_ore - - deepslate_gold_ore - - deepslate_lapis_ore - - deepslate_diamond_ore - - deepslate_redstone_ore \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/venom.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/venom.yml deleted file mode 100644 index d9ef7168..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/venom.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Venom EcoEnchant -# - -name: "Venom" -description: '&a%value%%&r Chance of withering your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 1 #chance of wither per level \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/voidaffinity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/voidaffinity.yml deleted file mode 100644 index 4d6d4741..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/voidaffinity.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Void Affinity EcoEnchant -# - -name: "Void Affinity" -description: Increases damage dealt in the end. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - netheric - maximum-level: 5 - -config: - multiplier: 0.02 # Multiplier per level for damage. Calculated as damage * (1 + level * multiplier) diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/voltage.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/voltage.yml deleted file mode 100644 index 1f1276ef..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/voltage.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Voltage EcoEnchant -# - -name: "Voltage" -description: Increases damage dealt against opponents with iron, gold, or chain armor. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - plasmic - maximum-level: 5 - -config: - multiplier: 0.015 # bonus damage multiplier = multiplier * level * pieces diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraffinity.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wateraffinity.yml deleted file mode 100644 index eb586098..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraffinity.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Water Affinity EcoEnchant -# - -name: "Water Affinity" -description: Increases damage dealt when in water. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - fire_affinity - maximum-level: 7 - -config: - multiplier: 0.02 # 1 + (Level * Multiplier) is multiplied with the damage diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraspect.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wateraspect.yml deleted file mode 100644 index e3a95580..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wateraspect.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Water Aspect EcoEnchant -# - -name: "Water Aspect" -description: Increases damage dealt against fiery mobs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - fire_aspect - maximum-level: 2 - -config: - multiplier: 0.2 # Damage = level * multiplier + 1. Damage on blaze/magma cube with Water Aspect 2 = 2 * 0.2 + 1 = 1.4x damage \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/weakening.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/weakening.yml deleted file mode 100644 index 2970ebd6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/weakening.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Weakening EcoEnchant -# - -name: "Weakening" -description: Increases subsequent damage dealt to opponent. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - ticks-per-level: 1.5 # Ticks to weaken player for per level - multiplier-while-weak: 1.25 # Times more damage to deal while weakened diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wisdom.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wisdom.yml deleted file mode 100644 index 0dbc3fa6..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wisdom.yml +++ /dev/null @@ -1,37 +0,0 @@ -# -# Wisdom EcoEnchant -# - -name: "Wisdom" -description: Increases dropped experience. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - sword - - axe - - pickaxe - - shovel - - hoe - - bow - - crossbow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - splash - - intellect - maximum-level: 3 - -config: - bonus-per-point: 0.2 #Increase per level relative to base \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/woodswitcher.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/woodswitcher.yml deleted file mode 100644 index 61897c9e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/woodswitcher.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Wood Switcher EcoEnchant -# - -name: "Wood Switcher" -description: Breaking logs have a &a%value%%&r chance to drop as other logs. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - silk_touch - maximum-level: 6 - -config: - blocks: - - oak_log - - birch_log - - spruce_log - - jungle_log - - acacia_log - - dark_oak_log - chance-per-level: 10 # Chance for drop to be switched diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/wound.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/wound.yml deleted file mode 100644 index 73111041..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/wound.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Wound EcoEnchant -# - -name: "Wound" -description: '&a%value%%&r chance to cause your opponent to bleed, damaging them repeatedly.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 7 - -config: - chance-per-level: 3 #chance of bleeding per level - bleed-damage: 1 - amount-per-level: 1 # Bleed number per level diff --git a/eco-core/core-plugin/src/main/resources/enchants/normal/zeus.yml b/eco-core/core-plugin/src/main/resources/enchants/normal/zeus.yml deleted file mode 100644 index de93ee2d..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/normal/zeus.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Zeus EcoEnchant -# - -name: "Zeus" -description: '&a%value%%&r chance to strike lightning on your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - local-lightning-sound: false # Should be lightning sound played locally - chance-per-level: 1 - lightning-damage: 2.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/aiming.yml b/eco-core/core-plugin/src/main/resources/enchants/special/aiming.yml deleted file mode 100644 index fc053c45..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/aiming.yml +++ /dev/null @@ -1,49 +0,0 @@ -# -# Aiming EcoEnchant -# - -name: "Aiming" -description: Arrows hone in on your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - distance-per-level: 4 # Distance to scan per aiming level - scale-on-force: true # Scale distance based on bow pull - require-full-force: true # Require full bow pull (works with rapid) If true, then scale-on-force is irrelevant. - check-ticks: 10 # Ticks between rotations - checks-per-level: 2 # Amount of times to rotate arrow per level (prevents "floating") - targets: # List of entity lookups (https://plugins.auxilor.io/all-plugins/the-entity-lookup-system) - - "zombie" - - "creeper" - - "player" - - "skeleton" - - "spider" - - "wither" - - "ender_dragon" - - "wither_skeleton" - - "husk" - - "piglin" - - "hoglin" - - "pig" - - "chicken" - - "cow" - - "cave_spider" - - "horse" diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/annihilate.yml b/eco-core/core-plugin/src/main/resources/enchants/special/annihilate.yml deleted file mode 100644 index 4b2fa968..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/annihilate.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Annihilate EcoEnchant -# - -name: "Annihilate" -description: Extreme Knockback. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - knockback - - tornado - - grapple - maximum-level: 2 - -config: - velocity-multiplier: 2.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml b/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml deleted file mode 100644 index a657fac4..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/bladed.yml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Bladed EcoEnchant -# - -name: "Bladed" -description: Trident deals extreme additional damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - impaling - - serrated - - phantasm - - arachnid - - pacify - - abattoir - maximum-level: 5 - -config: - disable-on-players: false # Should this enchantment only boost damage on mobs - base-multiplier: 1.5 # Percent more damage to do as base - multiplier: 0.5 # 1 + (Level * Multiplier) is multiplied with the damage - # To explain, Bladed V would be 4x more damage: 1.5 + (5*0.5) - # By default, Bladed I acts like Serrated VI diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/bolt.yml b/eco-core/core-plugin/src/main/resources/enchants/special/bolt.yml deleted file mode 100644 index 11facbad..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/bolt.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Bolt EcoEnchant -# - -name: "Bolt" -description: '&a%value%%&r chance of striking powerful lightning on your opponent.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - local-lightning-sound: false # Should be lightning sound played locally - chance-per-level: 5 - allow-not-fully-charged: false # dont require sword attack to be at full charge - lightning-damage: 8 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/carve.yml b/eco-core/core-plugin/src/main/resources/enchants/special/carve.yml deleted file mode 100644 index 10c3bb24..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/carve.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Carve EcoEnchant -# - -name: "Carve" -description: Heavily damage all entities around attacked entity. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - cleave - maximum-level: 8 - -config: - damage-percentage-per-level: 10 - radius-per-level: 0.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/confusion.yml b/eco-core/core-plugin/src/main/resources/enchants/special/confusion.yml deleted file mode 100644 index 80f872ca..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/confusion.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Confusion EcoEnchant -# - -name: "Confusion" -description: '&a%value%%&r chance to shuffle your opponents hotbar.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 4 - -config: - chance-per-level: 2 #chance of shuffling opponents hotbar per level - allow-not-fully-charged: false #dont require sword attack to be at full charge \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/energizing.yml b/eco-core/core-plugin/src/main/resources/enchants/special/energizing.yml deleted file mode 100644 index f464d264..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/energizing.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Energizing EcoEnchant -# - -name: "Energizing" -description: Receive a short burst of haste after breaking a block. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - pickaxe - - axe - - shovel - - hoe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - ticks-per-level: 8 - initial-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/force.yml b/eco-core/core-plugin/src/main/resources/enchants/special/force.yml deleted file mode 100644 index 66d1a345..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/force.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Force EcoEnchant -# - -name: "Force" -description: Massively increases arrow damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - power - - revenant - - insecticide - - slaughter - - settle - maximum-level: 4 - -config: - disable-on-players: false # Should this enchantment only boost damage on mobs - multiplier: 0.25 # Formula is (multiplier * (level + 6) + 1)*damage | Default functions as power 5 + level, eg force 2 = power 7 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/frenzy.yml b/eco-core/core-plugin/src/main/resources/enchants/special/frenzy.yml deleted file mode 100644 index cd8270f2..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/frenzy.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Frenzy EcoEnchant -# - -name: "Frenzy" -description: Gives strength after killing an entity. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - seconds-per-level: 1.5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/harpoon.yml b/eco-core/core-plugin/src/main/resources/enchants/special/harpoon.yml deleted file mode 100644 index 401b18b3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/harpoon.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Harpoon EcoEnchant -# - -name: "Harpoon" -description: Hooking onto an entity will heavily damage it. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - rod - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - spiked - maximum-level: 3 - -config: - damage-per-level: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/indestructibility.yml b/eco-core/core-plugin/src/main/resources/enchants/special/indestructibility.yml deleted file mode 100644 index ecb12dcd..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/indestructibility.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Indestructibility EcoEnchant -# - -name: "Indestructibility" -description: Massively increases item durability. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - unbreaking - maximum-level: 3 - -config: - level-bonus: 4 # Indestructiblity 1 is the same as unbreaking +level, ie: indestructibility 3 with bonus 4 is the same as unbreaking 7 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/instability.yml b/eco-core/core-plugin/src/main/resources/enchants/special/instability.yml deleted file mode 100644 index cdd7fb5a..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/instability.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Instability EcoEnchant -# - -name: "Instability" -description: Explosive arrows. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - fire: false - break-blocks: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/intellect.yml b/eco-core/core-plugin/src/main/resources/enchants/special/intellect.yml deleted file mode 100644 index f6daf96f..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/intellect.yml +++ /dev/null @@ -1,37 +0,0 @@ -# -# Intellect EcoEnchant -# - -name: "Intellect" -description: Massively increases dropped experience. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - bow - - crossbow - - trident - - pickaxe - - axe - - shovel - - hoe - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - splash - - wisdom - maximum-level: 3 - -config: - bonus-per-point: 1.2 #Increase per level relative to base \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/lifesteal.yml b/eco-core/core-plugin/src/main/resources/enchants/special/lifesteal.yml deleted file mode 100644 index ca215434..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/lifesteal.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Life Steal EcoEnchant -# - -name: "Life Steal" -description: Heals a large portion of damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - leeching - maximum-level: 3 - -config: - health-per-level: 2 # Level * Health = Amount of health to heal - allow-not-fully-charged: false diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/pentashot.yml b/eco-core/core-plugin/src/main/resources/enchants/special/pentashot.yml deleted file mode 100644 index b8de2575..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/pentashot.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Pentashot EcoEnchant -# - -name: "Pentashot" -description: Shoots 5 arrows. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - bow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - succession - - tripleshot - - buckshot - maximum-level: 1 - -config: - chance-per-level: 100 # Not chance-based by default - side-arrows-per-level: 2 # If you want to have more levels - angle: 11 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/preservation.yml b/eco-core/core-plugin/src/main/resources/enchants/special/preservation.yml deleted file mode 100644 index 42a6a297..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/preservation.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Preservation EcoEnchant -# - -name: "Preservation" -description: Massively reduces incoming damage. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - protection - - fire_protection - - projectile_protection - - blast_protection - maximum-level: 4 - -config: - percent-less-per-level: 5 # Points * Percent less / 100 * damage = damage taken \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/prosperity.yml b/eco-core/core-plugin/src/main/resources/enchants/special/prosperity.yml deleted file mode 100644 index 14cf7631..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/prosperity.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Prosperity EcoEnchant -# - -name: "Prosperity" -description: Massively increases maximum health. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - thrive - maximum-level: 3 - -config: - health-per-point: 2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml b/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml deleted file mode 100644 index b5b716d3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/razor.yml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Razor EcoEnchant -# - -name: "Razor" -description: Massively increases damage dealt. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sharpness - - smite - - bane_of_arthropods - - defusion - - butchering - - ender_slayer - - introversion - maximum-level: 6 - -config: - disable-on-players: false # Should this enchantment only boost damage on mobs - multiplier: 0.2 # Vanilla sharpness is 0.5*level + 0.5 extra damage. Razor formula is multiplier*level + base extra damage. - base-damage: 7.5 # Vanilla Smite 5/BOA 5 extra damage is 12.5 - decrease-if-cooldown: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/repairing.yml b/eco-core/core-plugin/src/main/resources/enchants/special/repairing.yml deleted file mode 100644 index 8d55f74e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/repairing.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Repairing EcoEnchant -# - -name: "Repairing" -description: Automatically repairs items when not held. -enabled: true - -obtaining: - table: false - villager: true - loot: true - rarity: veryspecial - -general-config: - flags: [] - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - mending - - decay_curse - maximum-level: 3 - -config: - repeat-ticks: 100 # How often (in ticks) to repair items - multiplier: 1 # Amount to repair = multiplier * level. Does not accept decimals \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/soulbound.yml b/eco-core/core-plugin/src/main/resources/enchants/special/soulbound.yml deleted file mode 100644 index 4fcb49f8..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/soulbound.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Soulbound EcoEnchant -# - -name: "Soulbound" -description: Keep this item on death. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - all - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - -config: - remove-after: false # If soulbound should be 1-time use - on-books: true # If soulbound should work on books \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/spring.yml b/eco-core/core-plugin/src/main/resources/enchants/special/spring.yml deleted file mode 100644 index 4d1a0a3e..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/spring.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Spring EcoEnchant -# - -name: "Spring" -description: Increases jump height and distance. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - disable-on-sneak: false -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/streamlining.yml b/eco-core/core-plugin/src/main/resources/enchants/special/streamlining.yml deleted file mode 100644 index 9e5bbcd7..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/streamlining.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Streamlining EcoEnchant -# - -name: "Streamlining" -description: Increases movement speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 8 - -config: - speed-per-level: 0.02 # Base is 0.2 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/special/volatile.yml b/eco-core/core-plugin/src/main/resources/enchants/special/volatile.yml deleted file mode 100644 index cc7e5df3..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/special/volatile.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Volatile EcoEnchant -# - -name: "Volatile" -description: '&a%value%%&r chance to have explosive sword attacks.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - fire: false - break-blocks: false - allow-not-fully-charged: false - chance-per-level: 5 \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml deleted file mode 100644 index 738f7a86..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/ascend.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Ascend EcoEnchant -# - -name: "Ascend" -description: Levitates you into the air -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - activation-sound: ENTITY_FIREWORK_ROCKET_LARGE_BLAST - cooldown: 90 # In seconds - power: 25 # Level of levitation to give - ticks-per-level: 6 - not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml deleted file mode 100644 index 2650d1cf..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/charge.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Charge EcoEnchant -# - -name: "Charge" -description: Launches you in the direction you're looking. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - activation-sound: ENTITY_FIREWORK_ROCKET_LAUNCH - cooldown: 40 # In seconds - velocity-per-level: 1.5 - not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml deleted file mode 100644 index 98530f20..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/dynamite.yml +++ /dev/null @@ -1,37 +0,0 @@ -# -# Dynamite EcoEnchant -# - -name: "Dynamite" -description: Mines blocks in a large area. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: - activation-sound: ENTITY_DRAGON_FIREBALL_EXPLODE - cooldown: 60 # In seconds - hardness-check: true # Only break blocks with hardness less than or equal to first block - blacklisted-blocks: - - bedrock - - end_portal_frame - - end_portal - base-bonus: 2 # Base extra blocks on all sides to break (1 = 3x3x3, 2 = 5x5x5, 3 = 7x7x7) - per-level-bonus: 1 # Extra blocks on all sides per level - not-while-sneaking: true diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml deleted file mode 100644 index cddebdb0..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/missile.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Missile EcoEnchant -# - -name: "Missile" -description: Shoots a wither skull -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_WITHER_SHOOT - cooldown: 40 # In seconds - velocity: 3 - damage-per-level: 8 - not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml deleted file mode 100644 index 414be683..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/quake.yml +++ /dev/null @@ -1,32 +0,0 @@ -# -# Quake EcoEnchant -# - -name: "Quake" -description: Damages all nearby entities -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_ENDER_DRAGON_GROWL - cooldown: 40 # In seconds - damage-per-level: 3 - radius-per-level: 2 - not-while-sneaking: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml b/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml deleted file mode 100644 index 5c2ebc71..00000000 --- a/eco-core/core-plugin/src/main/resources/enchants/spell/vitalize.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Vitalize EcoEnchant -# - -name: "Vitalize" -description: Puts you back on max health -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - sword - - axe - - pickaxe - - shovel - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 1 - -config: - activation-sound: ENTITY_PLAYER_LEVELUP - cooldown: 450 # In seconds - not-while-sneaking: false - spawn-heart-particles: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/enchants/telekinesis.yml b/eco-core/core-plugin/src/main/resources/enchants/telekinesis.yml new file mode 100644 index 00000000..0b87772a --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/enchants/telekinesis.yml @@ -0,0 +1,18 @@ +display-name: "Telekinesis" +description: "among us" +type: normal + +targets: + - pickaxe + - sword + - axe +conflicts: [] +rarity: common +max-level: 1 + +tradeable: true +discoverable: true +enchantable: true + +conditions: [ ] +not-on-players: true diff --git a/eco-core/core-plugin/src/main/resources/enchants/test.yml b/eco-core/core-plugin/src/main/resources/enchants/test.yml new file mode 100644 index 00000000..8eb5f522 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/enchants/test.yml @@ -0,0 +1,24 @@ +display-name: "Test" +description: "Gives a &a%placeholder%%&8 bonus to damage" +placeholder: "%level% * 20" +type: normal + +targets: + - sword +conflicts: + - sharpness +rarity: common +max-level: 4 + +tradeable: true +discoverable: true +enchantable: true + +effects: + - id: damage_multiplier + args: + multiplier: 1 + 0.2 * %level% + triggers: + - melee_attack + +conditions: [ ] diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml index 13bf1492..67468a29 100644 --- a/eco-core/core-plugin/src/main/resources/lang.yml +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -1,213 +1,19 @@ -# INFO: Use the key name of enchantments if you want to add them to this file - messages: prefix: "&a&lEcoEnchants &r&8» &r" no-permission: "&cYou don't have permission to do this!" not-player: "&cThis command must be run by a player" invalid-command: "&cUnknown subcommand!" reloaded: "Reloaded! Took %time%ms" - got-special: "You got a &dSpecial &fenchantment!" - skip-added: "&aAdded &flore skip to item!" - skip-removed: "&cRemoved &flore skip from item!" - missing-enchant: "&cYou must specify an enchantment!" - not-found: "&cCannot find an enchantment matching name: &f%name%." - enchantinfo: | - %name%: &r%description% - &9Rarity: &r%rarity% - &9Max Level: &r%maxlevel% - &9Can be applied to: &r%target% - &9Conflicts with: &r%conflicts% on-cooldown: "&fThis spell is on cooldown! Wait &a%seconds% Seconds&f to use &a%name%&f again." - used-spell: "&fUsed &a%name%&f spell!" - must-hold-item: "&cYou must be holding an enchantable item!" - no-enchants-available: "&fNo available enchantments found for this item!" - applied-random-enchant: "&fAdded %enchantment% to your item!" - gave-random-book: "&fGave %enchantment% book!" - received-random-book: "&fYou have received a %enchantment% book!" invalid-player: "&cInvalid Player!" requires-player: "&cRequires a Player!" - must-hold-item-other: "&cPlayer is not holding an enchantable item!" - link-to-locale: "The locale has been successfully exported! Your token is: %token%" - downloaded-locale: "Locale downloaded! Reload config to enact changes." - invalid-locale: "&cYou must supply a valid locale! Check the wiki for more information." - specify-locale-subcommand: "&cYou must specify whether to export or download a locale!" + cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%" + cannot-transmit: "&cYou can't transmit here!" enabled-descriptions: "&fYou have successfully &aenabled &fenchantment descriptions!" disabled-descriptions: "&fYou have successfully &cdisabled &fenchantment descriptions!" descriptions-disabled: "&cEnchantment descriptions are disabled on this server." - export-failed: "&cExporting the locale failed. Try again later!" - cannot-afford-type: "&cYou can't afford to do this! &fCost: &a%cost% %type%" - cannot-transmit: "&cYou can't transmit here!" + not-found: "&cCannot find an enchantment matching name: &f%name%." + missing-enchant: "&cYou must specify an enchantment!" -no-targets: "&cCannot be applied" -no-conflicts: "&cNo conflicts" - -missing-requirements-format: "" - -curse-color: "&c" -normal-color: "&7" -special-color: "" -artifact-color: "" -spell-color: "" - -above-max-level-color: "" - -description-color: "&8" - -special-particle-color: "#FF69B4" - -enchantments: - protection: - name: "Protection" - description: Reduces most types of damage. - - fire_protection: - name: "Fire Protection" - description: Reduces fire damage and burn time. - - feather_falling: - name: "Feather Falling" - description: Reduces fall damage. - - blast_protection: - name: "Blast Protection" - description: Reduces explosion damage and knockback. - - projectile_protection: - name: "Projectile Protection" - description: Reduces projectile damage. - - respiration: - name: "Respiration" - description: Extends underwater breathing time. - - aqua_affinity: - name: "Aqua Affinity" - description: Increases underwater mining speed. - - thorns: - name: "Thorns" - description: Reflects some of the damage taken when hit. - - depth_strider: - name: "Depth Strider" - description: Increases underwater movement speed. - - frost_walker: - name: "Frost Walker" - description: Turns water beneath the player into ice. - - binding_curse: - name: "Curse of Binding" - description: Items cannot be removed from armor slots. - - sharpness: - name: "Sharpness" - description: Increases damage. - - smite: - name: "Smite" - description: Increases damage against undead mobs. - - bane_of_arthropods: - name: "Bane of Arthropods" - description: Increases damage and slows arthropod mobs. - - knockback: - name: "Knockback" - description: Increases knockback. - - fire_aspect: - name: "Fire Aspect" - description: Sets target on fire. - - looting: - name: "Looting" - description: Increases mob loot. - - sweeping: - name: "Sweeping Edge" - description: Increases sweeping attack damage. - - efficiency: - name: "Efficiency" - description: Increases mining speed. - - silk_touch: - name: "Silk Touch" - description: Mined blocks drop themselves exactly. - - unbreaking: - name: "Unbreaking" - description: Increases item durability. - - fortune: - name: "Fortune" - description: Increases certain block drops. - - power: - name: "Power" - description: Increases arrow damage. - - punch: - name: "Punch" - description: Increases arrow knockback. - - flame: - name: "Flame" - description: Arrows set target on fire. - - infinity: - name: "Infinity" - description: Shooting consumes no regular arrows. - - luck_of_the_sea: - name: "Luck of the Sea" - description: Increases rate of good loot. - - lure: - name: "Lure" - description: Decreases fishing wait time. - - loyalty: - name: "Loyalty" - description: Trident returns after being thrown. - - impaling: - name: "Impaling" - description: Trident deals additional damage to ocean mobs. - - riptide: - name: "Riptide" - description: Trident launches player when thrown in water or while raining. - - channeling: - name: "Channeling" - description: Strikes lightning where trident lands during thunderstorms. - - multishot: - name: "Multishot" - description: Shoots 3 arrows. - - quick_charge: - name: "Quick Charge" - description: Decreases crossbow charging time. - - piercing: - name: "Piercing" - description: Arrows pass through multiple entities. - - mending: - name: "Mending" - description: Repair the item while gaining XP orbs. - - vanishing_curse: - name: "Curse of Vanishing" - description: Item destroyed on death. - - soul_speed: - name: "Soul Speed" - description: Increases walking speed on soul sand and soul soil. - - swift_sneak: - name: "Swift Sneak" - description: Increases speed while sneaking. +all: "All" +no-conflicts: "No Conflicts" \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml index 345e588a..1bb3d245 100644 --- a/eco-core/core-plugin/src/main/resources/plugin.yml +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -9,15 +9,12 @@ depend: - eco - ProtocolLib softdepend: - - Essentials - - MythicMobs - - AureliumSkills - - mcMMO - - Jobs - Vault - - CMI - - CMILib + - AureliumSkills + - PlayerPoints + - Jobs - TMMobcoins + - Reforges - EcoBosses - Talismans - EcoArmor @@ -26,112 +23,50 @@ softdepend: - Boosters commands: - enchantinfo: - description: Show information about an enchantment - permission: ecoenchants.command.enchantinfo ecoenchants: - description: Master command for other subcommands. + description: Base Command permission: ecoenchants.command.ecoenchants + enchantinfo: + description: Show info about an enchant + permission: ecoenchants.command.enchantinfo permissions: ecoenchants.*: description: All ecoenchants permissions default: op children: - ecoenchants.fromtable.*: true - ecoenchants.bypasslevelclamp: true - ecoenchants.anvil.*: true ecoenchants.command.*: true - ecoenchants.allowillegal: true - ecoenchants.anvil.*: - description: Allows all anvil permissions - default: op - children: - ecoenchants.anvil.bypasshardcap: true - ecoenchants.anvil.color: true + ecoenchants.anvil.*: true + ecoenchants.fromtable.*: true ecoenchants.command.*: - description: Allows all commands + description: All commands default: op children: ecoenchants.command.reload: true - ecoenchants.command.debug: true - ecoenchants.command.enchantinfo: true - ecoenchants.command.randomenchant: true - ecoenchants.command.randomenchant.bypasshardcap: true - ecoenchants.command.giverandombook: true - ecoenchants.command.locale.*: true ecoenchants.command.ecoenchants: true ecoenchants.command.toggledescriptions: true - ecoenchants.command.locale.*: - description: Allows managing locale features + ecoenchants.command.enchantinfo: true + ecoenchants.anvil.*: + description: All anvil perks default: op children: - ecoenchants.command.locale.download: true - ecoenchants.command.locale.export: true - ecoenchants.command.locale: true + ecoenchants.anvil.color: true ecoenchants.fromtable.*: description: Allows getting all enchantments from an enchanting table default: true + ecoenchants.anvil.color: + description: Allows using color codes in anvils + default: op ecoenchants.command.reload: description: Allows reloading the config default: op - ecoenchants.command.debug: - description: Allows the use of /ecoenchants debug to print verbose debug information to console - default: op - ecoenchants.command.enchantinfo: - description: Allows the use of /enchantinfo to show enchant info - default: true - ecoenchants.command.giverandombook: - description: Allows the use of /ecoenchants giverandombook to give a book with a random enchantment - default: op - ecoenchants.command.randomenchant: - description: Allows the use of /ecoenchants randomenchant to apply a random enchantment to an item - default: op - ecoenchants.command.randomenchant.others: - description: Allows the use of /ecoenchants randomenchant to apply a random enchantment to an item for another player - default: op - ecoenchants.command.randomenchant.bypasshardcap: - description: Allows /ecoenchants randomenchant bypassing the anvil hard cap - default: op - ecoenchants.command.locale: - description: Allows the use of /ecoenchants locale to manage locale i18n - default: op - ecoenchants.command.locale.download: - description: Allows the use of /ecoenchants locale download to download locales - default: op - ecoenchants.command.locale.export: - description: Allows the use of /ecoenchants locale export to export locales - default: op - ecoenchants.command.toggledescriptions: - description: Allows the use of /ecoenchants toggledescriptions - default: true ecoenchants.command.ecoenchants: - description: Allows the use of /ecoenchants + description: Allows the use of /ecoenchants. default: true - ecoenchants.anvil.bypasshardcap: - description: Allows bypassing the anvil hard cap - default: op - ecoenchants.anvil.color: - description: Allows color from anvil renames - default: op - ecoenchants.bypasslevelclamp: - description: Allows bypassing the advanced level clamp option - default: op - ecoenchants.allowillegal: - description: Don't remove illegal items when remove-illegal is enabled. - default: op - - # Perks - ecoenchants.cooldowntime.half: - description: Halves the cooldown time on spells - default: false - ecoenchants.cooldowntime.third: - description: Thirds the cooldown time on spells - default: false - ecoenchants.cooldowntime.quarter: - description: Quarters the cooldown time on spells - default: false - ecoenchants.cooldowntime.75: - description: Reduces the cooldown time on spells by 25% - default: false \ No newline at end of file + ecoenchants.command.toggledescriptions: + description: Allows the use of /ecoenchants toggledescriptions. + default: true + ecoenchants.command.enchantinfo: + description: Allows the use of /enchantinfo. + default: true \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/rarity.yml b/eco-core/core-plugin/src/main/resources/rarity.yml index 54ce2f56..a264fd61 100644 --- a/eco-core/core-plugin/src/main/resources/rarity.yml +++ b/eco-core/core-plugin/src/main/resources/rarity.yml @@ -1,76 +1,63 @@ +# Table chance is the chance of getting enchantment as a percentage from an enchanting table +# Minimum Level is the minimum xp level you have to be to get the enchantment +# You can add more rarities by following the pattern. +# Remember, enchantments are more likely to be high-level the closer they are to maximum-obtainable-level +# Villager chance is the chance of a villager having this trade as a percentage. Vanilla default for all enchantments is 2.7%, however you can choose this per-rarity. +# Loot chance is the chance of an item in a loot chest having this enchantment as a percentage + rarities: - # Table Probability is the chance of getting enchantment as a percentage from an enchanting table - # Minimum Level is the minimum xp level you have to be to get the enchantment - # You can add more rarities by following the pattern. - # Remember, enchantments are more likely to be high-level the closer they are to maximum-obtainable-level - # Villager probability is the chance of a villager having this trade as a percentage. Vanilla default for all enchantments is 2.7%, however you can choose this per-rarity. - # Loot probability is the chance of an item in a loot chest having this enchantment as a percentage - - # Custom Color is a custom name color for all enchantments of rarity to have - # This is disabled by default. - # Curses override this, and always display in their specified color. - - common: - table-probability: 30 + - id: common + display-name: "Common" + table-chance: 30 minimum-level: 1 - villager-probability: 10.5 - loot-probability: 12 - custom-color: - enabled: false - color: "&7" - uncommon: - table-probability: 20 + villager-chance: 10.5 + loot-chance: 12 + + - id: uncommon + display-name: "Uncommon" + table-chance: 20 minimum-level: 5 - villager-probability: 9 - loot-probability: 16 - custom-color: - enabled: false - color: "&a" - rare: - table-probability: 20 + villager-chance: 9 + loot-chance: 16 + + - id: rare + display-name: "Rare" + table-chance: 20 minimum-level: 15 - villager-probability: 7.5 - loot-probability: 18 - custom-color: - enabled: false - color: "&9" - epic: - table-probability: 10 + villager-chance: 7.5 + loot-chance: 18 + + - id: epic + display-name: "Epic" + table-chance: 10 minimum-level: 16 - villager-probability: 6 - loot-probability: 20 - custom-color: - enabled: false - color: "&5" - legendary: - table-probability: 8 + villager-chance: 6 + loot-chance: 20 + + - id: legendary + display-name: "Legendary" + table-chance: 8 minimum-level: 20 - villager-probability: 4.5 - loot-probability: 15 - custom-color: - enabled: false - color: "&6" - special: - table-probability: 2 + villager-chance: 4.5 + loot-chance: 15 + + - id: special + display-name: "Special" + table-chance: 2 minimum-level: 30 - villager-probability: 3 - loot-probability: 5 - custom-color: - enabled: false - color: "&d" - veryspecial: - table-probability: 1 + villager-chance: 3 + loot-chance: 5 + + - id: veryspecial + display-name: "Very Special" + table-chance: 1 minimum-level: 30 - villager-probability: 1.5 - loot-probability: 2 - custom-color: - enabled: false - color: "&4" - artifact: - table-probability: 5 + villager-chance: 1.5 + loot-chance: 2 + + - id: artifact + display-name: "Artifact" + table-chance: 5 minimum-level: 1 - villager-probability: 9 - loot-probability: 5 - custom-color: - enabled: false - color: "&8" + villager-chance: 9 + loot-chance: 5 diff --git a/eco-core/core-plugin/src/main/resources/target.yml b/eco-core/core-plugin/src/main/resources/target.yml deleted file mode 100644 index a2eaf35e..00000000 --- a/eco-core/core-plugin/src/main/resources/target.yml +++ /dev/null @@ -1,130 +0,0 @@ -extra-enchantable-items: - - elytra - - shield - - flint_and_steel - - shears - - carrot_on_a_stick - - player_head - -targets: - axe: - - slot:hands - - wooden_axe - - stone_axe - - iron_axe - - golden_axe - - diamond_axe - - netherite_axe - - book: - - book - - enchanted_book - - pickaxe: - - slot:hands - - wooden_pickaxe - - stone_pickaxe - - iron_pickaxe - - golden_pickaxe - - diamond_pickaxe - - netherite_pickaxe - - hoe: - - slot:hands - - wooden_hoe - - stone_hoe - - iron_hoe - - golden_hoe - - diamond_hoe - - netherite_hoe - - shovel: - - slot:hands - - wooden_shovel - - stone_shovel - - iron_shovel - - golden_shovel - - diamond_shovel - - netherite_shovel - - sword: - - slot:hands - - wooden_sword - - stone_sword - - iron_sword - - golden_sword - - diamond_sword - - netherite_sword - - helmet: - - slot:armor - - turtle_helmet - - leather_helmet - - chainmail_helmet - - iron_helmet - - golden_helmet - - diamond_helmet - - netherite_helmet - - chestplate: - - slot:armor - - leather_chestplate - - chainmail_chestplate - - iron_chestplate - - golden_chestplate - - diamond_chestplate - - netherite_chestplate - - leggings: - - slot:armor - - leather_leggings - - chainmail_leggings - - iron_leggings - - golden_leggings - - diamond_leggings - - netherite_leggings - - boots: - - slot:armor - - leather_boots - - chainmail_boots - - iron_boots - - golden_boots - - diamond_boots - - netherite_boots - - elytra: - - slot:armor - - elytra - - bow: - - slot:hands - - bow - - crossbow: - - slot:hands - - crossbow - - shears: - - slot:hands - - shears - - trident: - - slot:hands - - trident - - shield: - - slot:hands - - shield - - rod: - - slot:hands - - fishing_rod - - flintandsteel: - - slot:hands - - flint_and_steel - - carrot_stick: - - slot:hands - - carrot_on_a_stick diff --git a/eco-core/core-plugin/src/main/resources/targets.yml b/eco-core/core-plugin/src/main/resources/targets.yml new file mode 100644 index 00000000..3e5bf4bf --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/targets.yml @@ -0,0 +1,171 @@ +# These are extra items that cannot normally be enchanted in an enchanting table, +# add items to this list to be able to enchant them. + +extra-enchantable-items: + - "*elytra" + - "*shield" + - "*flint_and_steel" + - "*shears" + - "*carrot_on_a_stick" + - "*player_head" + +# A target consists of items and a slot. +# The slot is either hands, armor, or any. +# Hands means the enchant will activate on hands, armor +# means it will only work on armor, and any +# means it will activate whenever its on the player. + +targets: + - id: pickaxe + display-name: "Pickaxes" + slot: hands + items: + - "*wooden_pickaxe" + - "*stone_pickaxe" + - "*iron_pickaxe" + - "*golden_pickaxe" + - "*diamond_pickaxe" + - "*netherite_pickaxe" + + - id: axe + display-name: "Axes" + slot: hands + items: + - "*wooden_axe" + - "*stone_axe" + - "*iron_axe" + - "*golden_axe" + - "*diamond_axe" + - "*netherite_axe" + + - id: hoe + display-name: "Hoes" + slot: hands + items: + - "*wooden_hoe" + - "*stone_hoe" + - "*iron_hoe" + - "*golden_hoe" + - "*diamond_hoe" + - "*netherite_hoe" + + - id: shovel + display-name: "Shovels" + slot: hands + items: + - "*wooden_shovel" + - "*stone_shovel" + - "*iron_shovel" + - "*golden_shovel" + - "*diamond_shovel" + - "*netherite_shovel" + + - id: sword + display-name: "Swords" + slot: hands + items: + - "*wooden_sword" + - "*stone_sword" + - "*iron_sword" + - "*golden_sword" + - "*diamond_sword" + - "*netherite_sword" + + - id: helmet + display-name: "Helmets" + slot: armor + items: + - "*turtle_helmet" + - "*leather_helmet" + - "*chainmail_helmet" + - "*iron_helmet" + - "*golden_helmet" + - "*diamond_helmet" + - "*netherite_helmet" + + - id: chestplate + display-name: "Chestplates" + slot: armor + items: + - "*leather_chestplate" + - "*chainmail_chestplate" + - "*iron_chestplate" + - "*golden_chestplate" + - "*diamond_chestplate" + - "*netherite_chestplate" + + - id: leggings + display-name: "Leggings" + slot: armor + items: + - "*leather_leggings" + - "*chainmail_leggings" + - "*iron_leggings" + - "*golden_leggings" + - "*diamond_leggings" + - "*netherite_leggings" + + - id: boots + display-name: "Boots" + slot: armor + items: + - "*leather_boots" + - "*chainmail_boots" + - "*iron_boots" + - "*golden_boots" + - "*diamond_boots" + - "*netherite_boots" + + - id: trident + display-name: "Tridents" + slot: hands + items: + - "*trident" + + - id: bow + display-name: "Bows" + slot: hands + items: + - "*bow" + + - id: crossbow + display-name: "Crossbows" + slot: hands + items: + - "*crossbow" + + - id: shears + display-name: "Shears" + slot: hands + items: + - "*shears" + + - id: shield + display-name: "Shields" + slot: hands + items: + - "*shield" + + - id: fishing_rod + display-name: "Fishing Rods" + slot: hands + items: + - "*fishing_rod" + + - id: flint_and_steel + display-name: "Flint and Steels" + slot: hands + items: + - "*flint_and_steel" + + - id: carrot_on_a_stick + display-name: "Carrots on Sticks" + slot: hands + items: + - "*carrot_on_a_stick" + + - id: elytra + display-name: "Elytra" + slot: armor + items: + - "*elytra" diff --git a/eco-core/core-plugin/src/main/resources/types.yml b/eco-core/core-plugin/src/main/resources/types.yml new file mode 100644 index 00000000..0a292067 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/types.yml @@ -0,0 +1,19 @@ +# Enchantment types are like categories. +# They have a color that shows in lore, they have an optional limit +# as to how many of a certain type can be on any item, et cetera. + +types: + - id: normal # The ID of the type + format: "&7" # The format of enchantments of this type in display + limit: -1 # The maximum amount of enchants of this type on an item (-1 to disable) + high-level-bias: 0 # The bias against getting high levels of enchants with this type. Between 0-1, 0 is no bias, 1 is only level 1. + + - id: curse + format: "&c" + limit: -1 + high-level-bias: 0 + + - id: special + format: "" + limit: 1 + high-level-bias: 0.7 diff --git a/eco-core/core-plugin/src/main/resources/vanillaenchants.yml b/eco-core/core-plugin/src/main/resources/vanillaenchants.yml index 731dfa3c..49c5aa16 100644 --- a/eco-core/core-plugin/src/main/resources/vanillaenchants.yml +++ b/eco-core/core-plugin/src/main/resources/vanillaenchants.yml @@ -1,31 +1,236 @@ -# -# Allows for modifying certain aspects of vanilla enchantments -# -enabled: false # There may be potential conflicts if modifying vanilla enchantments. +# Rarity option does not affect vanilla enchantments. +# The option is there for the display option to sort by rarity. -# Set custom max levels for vanilla enchantments. -# To do this, add each enchantment like this: -# - ":4" -# For example, to allow efficiency 6 and protection 5, you would do this: -# max-levels: -# - "efficiency:6" -# - "protection:5" -# -# Currently, it is *not* possible to modify the enchantment levels from enchanting tables. -# It will work with anvils however, but since it is still possible to get enchantments at their vanilla -# max levels, then it isn't recommended to lower the max level of a vanilla enchantment, only to raise it. -max-levels: [] +protection: + name: "Protection" + description: Reduces most types of damage. + type: normal + rarity: common -# Set custom conflicts for vanilla enchantments. -# To do this, add each enchantment like this: -# - ":::..... etc" -# For example, to make mending conflict with efficiency and sharpness, you would do this: -# conflicts: -# - "mending:efficiency:sharpness" -# -# If you want to remove all conflicts, set the list to 'none': -# conflicts: -# - "mending:none" -# -# Beware that this will *override* conflicts, not add to them. -conflicts: [] \ No newline at end of file +fire_protection: + name: "Fire Protection" + description: Reduces fire damage and burn time. + type: normal + rarity: common + +feather_falling: + name: "Feather Falling" + description: Reduces fall damage. + type: normal + rarity: common + +blast_protection: + name: "Blast Protection" + type: normal + description: Reduces explosion damage and knockback. + rarity: common + +projectile_protection: + name: "Projectile Protection" + description: Reduces projectile damage. + type: normal + rarity: common + +respiration: + name: "Respiration" + description: Extends underwater breathing time. + type: normal + rarity: common + +aqua_affinity: + name: "Aqua Affinity" + description: Increases underwater mining speed. + type: normal + rarity: common + +thorns: + name: "Thorns" + description: Reflects some of the damage taken when hit. + type: normal + rarity: common + +depth_strider: + name: "Depth Strider" + description: Increases underwater movement speed. + type: normal + rarity: common + +frost_walker: + name: "Frost Walker" + description: Turns water beneath the player into ice. + type: normal + rarity: common + +binding_curse: + name: "Curse of Binding" + description: Items cannot be removed from armor slots. + type: curse + rarity: common + +sharpness: + name: "Sharpness" + description: Increases damage. + type: normal + rarity: common + +smite: + name: "Smite" + description: Increases damage against undead mobs. + type: normal + rarity: common + +bane_of_arthropods: + name: "Bane of Arthropods" + description: Increases damage and slows arthropod mobs. + type: normal + rarity: common + +knockback: + name: "Knockback" + description: Increases knockback. + type: normal + rarity: common + +fire_aspect: + name: "Fire Aspect" + description: Sets target on fire. + type: normal + rarity: common + +looting: + name: "Looting" + description: Increases mob loot. + type: normal + rarity: common + +sweeping: + name: "Sweeping Edge" + description: Increases sweeping attack damage. + type: normal + rarity: common + +efficiency: + name: "Efficiency" + description: Increases mining speed. + type: normal + rarity: common + +silk_touch: + name: "Silk Touch" + description: Mined blocks drop themselves exactly. + type: normal + rarity: common + +unbreaking: + name: "Unbreaking" + description: Increases item durability. + type: normal + rarity: common + +fortune: + name: "Fortune" + description: Increases certain block drops. + type: normal + rarity: common + +power: + name: "Power" + description: Increases arrow damage. + type: normal + rarity: common + +punch: + name: "Punch" + description: Increases arrow knockback. + type: normal + rarity: common + +flame: + name: "Flame" + description: Arrows set target on fire. + type: normal + rarity: common + +infinity: + name: "Infinity" + description: Shooting consumes no regular arrows. + type: normal + rarity: common + +luck_of_the_sea: + name: "Luck of the Sea" + description: Increases rate of good loot. + type: normal + rarity: common + +lure: + name: "Lure" + description: Decreases fishing wait time. + type: normal + rarity: common + +loyalty: + name: "Loyalty" + description: Trident returns after being thrown. + type: normal + rarity: common + +impaling: + name: "Impaling" + description: Trident deals additional damage to ocean mobs. + type: normal + rarity: common + +riptide: + name: "Riptide" + description: Trident launches player when thrown in water or while raining. + type: normal + rarity: common + +channeling: + name: "Channeling" + description: Strikes lightning where trident lands during thunderstorms. + type: normal + rarity: common + +multishot: + name: "Multishot" + description: Shoots 3 arrows. + type: normal + rarity: common + +quick_charge: + name: "Quick Charge" + description: Decreases crossbow charging time. + type: normal + rarity: common + +piercing: + name: "Piercing" + description: Arrows pass through multiple entities. + type: normal + rarity: common + +mending: + name: "Mending" + description: Repair the item while gaining XP orbs. + type: normal + rarity: common + +vanishing_curse: + name: "Curse of Vanishing" + description: Item destroyed on death. + type: curse + rarity: common + +soul_speed: + name: "Soul Speed" + description: Increases walking speed on soul sand and soul soil. + type: normal + rarity: common + +swift_sneak: + name: "Swift Sneak" + description: Increases speed while sneaking. + type: normal + rarity: common diff --git a/eco-core/core-proxy/build.gradle b/eco-core/core-proxy/build.gradle deleted file mode 100644 index 5795f8bc..00000000 --- a/eco-core/core-proxy/build.gradle +++ /dev/null @@ -1,6 +0,0 @@ -group 'com.willfp' -version rootProject.version - -dependencies { - compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' -} \ No newline at end of file diff --git a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/EcoCraftEnchantmentManagerProxy.java b/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/EcoCraftEnchantmentManagerProxy.java deleted file mode 100644 index 5c8c1458..00000000 --- a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/EcoCraftEnchantmentManagerProxy.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.willfp.ecoenchants.proxy.proxies; - -public interface EcoCraftEnchantmentManagerProxy { - /** - * Re-Register new CraftEnchantments for all vanilla enchantments in order to modify their max level. - */ - void registerNewCraftEnchantments(); -} diff --git a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.java b/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.java deleted file mode 100644 index 0264cab8..00000000 --- a/eco-core/core-proxy/src/main/java/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.ecoenchants.proxy.proxies; - -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public interface OpenInventoryProxy { - /** - * Get the NMS inventory container for a player's inventory view. - * - * @param player The player to query. - * @return The NMS inventory container. - */ - Object getOpenInventory(@NotNull Player player); -} diff --git a/eco-core/core-stub/build.gradle b/eco-core/core-stub/build.gradle deleted file mode 100644 index 2f7415f3..00000000 --- a/eco-core/core-stub/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -group 'com.willfp' -version rootProject.version diff --git a/eco-core/core-stub/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java b/eco-core/core-stub/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java deleted file mode 100644 index 6ea30dd8..00000000 --- a/eco-core/core-stub/src/main/java/io/papermc/paper/enchantments/EnchantmentRarity.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.papermc.paper.enchantments; - -/** - * This right here is the worst workaround I have ever seen in my entire life. - *

- * I hate the fact that I've done it, I hate everything that made me have to - * do this, and I hate the fact that there's an issue here in the first place. - *

- * Spigot rules prevent you from having a hard dependency on papermc. Already, - * that's extremely infuriating, but it is what it is, I guess. - *

- * However, I want to use the paper API if paper is installed, and also provide - * paper API support for anyone who uses it. - *

- * Unfortunately, because EcoEnchant is both an Enchantment and a listener, - * spigot can't register the listener because it throws a ClassDefNotFound error - * when getting the methods - the solution to this for me is to load a stub class - * that exists, the actual method signature shouldn't be any different and I don't - * depend on this module in core-plugin, so I won't have any bugs on my end. - *

- * I really hope this solution works because if it doesn't then I have a lot of - * work to do. A potential (and janky) workaround would be to load asm and then - * remove this class from existence if the server is running paper. - *

- * This class here will be loaded after paper so it shouldn't cause any - * issues there, and the class will always then be present on the classpath. - *

- * I will write this once and then never look at it again. - */ -public enum EnchantmentRarity { - -} diff --git a/eco-extensions/alchemy/build.gradle b/eco-extensions/alchemy/build.gradle deleted file mode 100644 index c8367a56..00000000 --- a/eco-extensions/alchemy/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.1' -description = 'Alchemy Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java deleted file mode 100644 index 29784deb..00000000 --- a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/Alchemy.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.willfp.ecoenchants.alchemy; - - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityPotionEffectEvent; -import org.bukkit.event.entity.EntityPotionEffectEvent.Cause; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.potion.PotionEffect; -import org.jetbrains.annotations.NotNull; - -public class Alchemy extends EcoEnchant { - /** - * true Metadata key. - */ - private final FixedMetadataValue metaKeyTrue = this.getPlugin().getMetadataValueFactory().create(true); - - /** - * Instantiate Alchemy Enchantment. - */ - public Alchemy() { - super("alchemy", EnchantmentType.NORMAL); - } - - /** - * Enchantment functionality. - * - * @param event The event to listen for. - */ - @EventHandler - public void onPotionEffect(@NotNull final EntityPotionEffectEvent event) { - if (event.getNewEffect() == null) { - return; - } - if (!(event.getEntity() instanceof LivingEntity entity)) { - return; - } - if (!(event.getCause() == Cause.POTION_DRINK) && !(event.getCause() == Cause.POTION_SPLASH) ) { - return; - } - - if (entity.hasMetadata(event.getNewEffect().toString())) { - return; - } - - int level = EnchantChecks.getArmorPoints(entity, this); - if (level == 0) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - if (this.getDisabledWorlds().contains(entity.getWorld())) { - return; - } - - PotionEffect effect = event.getNewEffect(); - - PotionEffect newEffect = new PotionEffect( - effect.getType(), - effect.getDuration(), - ((effect.getAmplifier() + 1) * 2) - 1, - effect.isAmbient(), - effect.hasParticles(), - effect.hasIcon() - ); - - entity.setMetadata(newEffect.toString(), metaKeyTrue); - - entity.removePotionEffect(effect.getType()); - - this.getPlugin().getScheduler().run(() -> newEffect.apply(entity)); - - this.getPlugin().getScheduler().runLater(() -> entity.removeMetadata(newEffect.toString(), this.getPlugin()), 1); - } -} diff --git a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java b/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java deleted file mode 100644 index 618131d1..00000000 --- a/eco-extensions/alchemy/src/main/java/com/willfp/ecoenchants/alchemy/AlchemyMain.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.willfp.ecoenchants.alchemy; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class AlchemyMain extends Extension { - /** - * Alchemy enchantment. - */ - public static final EcoEnchant ALCHEMY = new Alchemy(); - - public AlchemyMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/alchemy/src/main/resources/enchants/normal/alchemy.yml b/eco-extensions/alchemy/src/main/resources/enchants/normal/alchemy.yml deleted file mode 100644 index b980d62a..00000000 --- a/eco-extensions/alchemy/src/main/resources/enchants/normal/alchemy.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Alchemy EcoEnchant -# - -name: "Alchemy" -description: Chance to double the strength of potions -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 6 - -config: - chance-per-level: 4 \ No newline at end of file diff --git a/eco-extensions/alchemy/src/main/resources/extension.yml b/eco-extensions/alchemy/src/main/resources/extension.yml deleted file mode 100644 index fde7329a..00000000 --- a/eco-extensions/alchemy/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Alchemy -main: com.willfp.ecoenchants.alchemy.AlchemyMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/autosell/build.gradle b/eco-extensions/autosell/build.gradle deleted file mode 100644 index bb6c3cd7..00000000 --- a/eco-extensions/autosell/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -group 'com.willfp' -version '1.0.1' -description = 'Autosell Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} - -dependencies { - compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0' - compileOnly 'com.github.MilkBowl:VaultAPI:1.7' -} \ No newline at end of file diff --git a/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/Autosell.java b/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/Autosell.java deleted file mode 100644 index 708122d8..00000000 --- a/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/Autosell.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.willfp.ecoenchants.autosell; - - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.eco.core.integrations.antigrief.AntigriefManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import net.brcdev.shopgui.ShopGuiPlusApi; -import org.bukkit.GameMode; -import org.bukkit.block.Block; -import org.bukkit.block.Container; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockDropItemEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -public class Autosell extends EcoEnchant { - private final Set noRepeat = new HashSet<>(); - - public Autosell() { - super( - "autosell", EnchantmentType.NORMAL - ); - } - - @EventHandler(priority = EventPriority.LOW) - public void autosellHandler(@NotNull final BlockDropItemEvent event) { - if (noRepeat.contains(event)) { - return; - } - - Player player = event.getPlayer(); - Block block = event.getBlock(); - - if (!this.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (event.getBlockState() instanceof Container) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (!AntigriefManager.canBreakBlock(player, block)) { - return; - } - - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - Collection drops = new ArrayList<>(); - - for (Item item : event.getItems()) { - drops.add(item.getItemStack()); - } - - for (ItemStack itemStack : new ArrayList<>(drops)) { - double price = ShopGuiPlusApi.getItemStackPriceSell(player, itemStack); - if (price <= 0) { - continue; - } - - EconomyHandler.getInstance().depositPlayer(player, price); - - drops.remove(itemStack); - } - - event.getItems().clear(); - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItems(drops) - .push(); - } -} diff --git a/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/AutosellMain.java b/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/AutosellMain.java deleted file mode 100644 index 67e16881..00000000 --- a/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/AutosellMain.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.willfp.ecoenchants.autosell; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class AutosellMain extends Extension { - /** - * Autosell enchantment. - */ - public static final EcoEnchant AUTOSELL = new Autosell(); - - public AutosellMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - EconomyHandler.setEnabled(EconomyHandler.init()); - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/EconomyHandler.java b/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/EconomyHandler.java deleted file mode 100644 index c3c09a13..00000000 --- a/eco-extensions/autosell/src/main/java/com/willfp/ecoenchants/autosell/EconomyHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.autosell; - -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.UtilityClass; -import net.milkbowl.vault.economy.Economy; -import org.bukkit.Bukkit; -import org.bukkit.plugin.RegisteredServiceProvider; - -@UtilityClass -public class EconomyHandler { - /** - * The instance. - */ - @Getter - private static Economy instance = null; - - @Getter - @Setter - private static boolean enabled = false; - - /** - * Initialize the economy manager. - * - * @return If was successful. - */ - public boolean init() { - RegisteredServiceProvider rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class); - if (rsp == null) { - return false; - } - instance = rsp.getProvider(); - return true; - } -} diff --git a/eco-extensions/autosell/src/main/resources/enchants/normal/autosell.yml b/eco-extensions/autosell/src/main/resources/enchants/normal/autosell.yml deleted file mode 100644 index c9fb89b2..00000000 --- a/eco-extensions/autosell/src/main/resources/enchants/normal/autosell.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Autosell EcoEnchant -# - -name: "Autosell" -description: Drops are instantly sold to the shop -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [ ] - targets: - - pickaxe - - axe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [ ] - not-met-lore: [ ] - conflicts: - - silk_touch - -config: - # No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/autosell/src/main/resources/extension.yml b/eco-extensions/autosell/src/main/resources/extension.yml deleted file mode 100644 index 8cd01083..00000000 --- a/eco-extensions/autosell/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Autosell -main: com.willfp.ecoenchants.autosell.AutosellMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/biomes/build.gradle b/eco-extensions/biomes/build.gradle deleted file mode 100644 index aefdf025..00000000 --- a/eco-extensions/biomes/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.0' -description = 'Biomes Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesEnchantment.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesEnchantment.java deleted file mode 100644 index 66b239ee..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesEnchantment.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.willfp.ecoenchants.biomes; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.jetbrains.annotations.NotNull; - -public abstract class BiomesEnchantment extends EcoEnchant { - private static final String MULTIPLIER_KEY = "multiplier"; - - protected BiomesEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - } - - public abstract boolean isValid(@NotNull Biome biome); - - private boolean isInBiome(@NotNull final LivingEntity entity) { - Biome entityBiome = entity.getLocation().getBlock().getBiome(); - return isValid(entityBiome); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!isInBiome(attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + MULTIPLIER_KEY); - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } - - @Override - public void onDamageWearingArmor(@NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageEvent event) { - if (!isInBiome(victim)) { - return; - } - - double reduction = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "reduction-per-level"); - double multiplier = 1 - ((reduction / 100) * level); - event.setDamage(event.getDamage() * multiplier); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!isInBiome(attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + MULTIPLIER_KEY); - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!isInBiome(attacker)) { - return; - } - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + MULTIPLIER_KEY); - event.setDamage(event.getDamage() * (1 + (level * multiplier))); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesMain.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesMain.java deleted file mode 100644 index 2449800d..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/BiomesMain.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.willfp.ecoenchants.biomes; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.biomes.enchants.defensive.Elevation; -import com.willfp.ecoenchants.biomes.enchants.defensive.Glacial; -import com.willfp.ecoenchants.biomes.enchants.defensive.HeatTreated; -import com.willfp.ecoenchants.biomes.enchants.defensive.Oceanic; -import com.willfp.ecoenchants.biomes.enchants.defensive.Tropical; -import com.willfp.ecoenchants.biomes.enchants.offensive.Altitude; -import com.willfp.ecoenchants.biomes.enchants.offensive.Aquamarine; -import com.willfp.ecoenchants.biomes.enchants.offensive.Dehydration; -import com.willfp.ecoenchants.biomes.enchants.offensive.Icelord; -import com.willfp.ecoenchants.biomes.enchants.offensive.Rainforest; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class BiomesMain extends Extension { - public static final EcoEnchant ELEVATION = new Elevation(); - public static final EcoEnchant GLACIAL = new Glacial(); - public static final EcoEnchant HEAT_TREATED = new HeatTreated(); - public static final EcoEnchant OCEANIC = new Oceanic(); - public static final EcoEnchant TROPICAL = new Tropical(); - public static final EcoEnchant ALTITUDE = new Altitude(); - public static final EcoEnchant AQUAMARINE = new Aquamarine(); - public static final EcoEnchant DEHYDRATION = new Dehydration(); - public static final EcoEnchant ICELORD = new Icelord(); - public static final EcoEnchant RAINFOREST = new Rainforest(); - - public BiomesMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Elevation.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Elevation.java deleted file mode 100644 index 93a19546..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Elevation.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Elevation extends BiomesEnchantment { - public Elevation() { - super("elevation", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"mountain", "hill"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Glacial.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Glacial.java deleted file mode 100644 index e098c54a..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Glacial.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Glacial extends BiomesEnchantment { - public Glacial() { - super("glacial", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"snowy", "ice", "frozen"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/HeatTreated.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/HeatTreated.java deleted file mode 100644 index d5124e9b..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/HeatTreated.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class HeatTreated extends BiomesEnchantment { - public HeatTreated() { - super("heat_treated", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"desert", "badlands", "savanna"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Oceanic.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Oceanic.java deleted file mode 100644 index 5e7dd109..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Oceanic.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Oceanic extends BiomesEnchantment { - public Oceanic() { - super("oceanic", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"ocean"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Tropical.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Tropical.java deleted file mode 100644 index 09772f6c..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/defensive/Tropical.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.defensive; - - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Tropical extends BiomesEnchantment { - public Tropical() { - super("tropical", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"jungle"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java deleted file mode 100644 index 6f7e5de1..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Altitude.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Altitude extends BiomesEnchantment { - /** - * Instantiate enchantment. - */ - public Altitude() { - super("altitude", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"mountain", "hill"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java deleted file mode 100644 index c70ac50f..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Aquamarine.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Aquamarine extends BiomesEnchantment { - /** - * Instantiate enchantment. - */ - public Aquamarine() { - super("aquamarine", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"ocean"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Dehydration.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Dehydration.java deleted file mode 100644 index 3a788e38..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Dehydration.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Dehydration extends BiomesEnchantment { - public Dehydration() { - super("dehydration", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"desert", "badlands", "savanna"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Icelord.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Icelord.java deleted file mode 100644 index ae29de91..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Icelord.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Icelord extends BiomesEnchantment { - public Icelord() { - super("icelord", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"snowy", "ice", "frozen"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Rainforest.java b/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Rainforest.java deleted file mode 100644 index 12439d1c..00000000 --- a/eco-extensions/biomes/src/main/java/com/willfp/ecoenchants/biomes/enchants/offensive/Rainforest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.biomes.enchants.offensive; - -import com.willfp.ecoenchants.biomes.BiomesEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.block.Biome; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public class Rainforest extends BiomesEnchantment { - public Rainforest() { - super("rainforest", EnchantmentType.NORMAL); - } - - @Override - public boolean isValid(@NotNull final Biome biome) { - return Arrays.stream(new String[]{"jungle"}).anyMatch(biome.name().toLowerCase()::contains); - } -} diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/altitude.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/altitude.yml deleted file mode 100644 index edb0a9c7..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/altitude.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Altitude EcoEnchant -# - -name: "Altitude" -description: Deal more damage in hilly biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - aquamarine - - dehydration - - icelord - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/aquamarine.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/aquamarine.yml deleted file mode 100644 index 4e6a4692..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/aquamarine.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Aquamarine EcoEnchant -# - -name: "Aquamarine" -description: Deal more damage in oceans. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - altitude - - dehydration - - icelord - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/dehydration.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/dehydration.yml deleted file mode 100644 index 5870636f..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/dehydration.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Dehydration EcoEnchant -# - -name: "Dehydration" -description: Deal more damage in hot biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - altitude - - aquamarine - - icelord - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/elevation.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/elevation.yml deleted file mode 100644 index 8366acdf..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/elevation.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Elevation EcoEnchant -# - -name: "Elevation" -description: Take less damage in hilly biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - glacial - - heat_treated - - oceanic - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/glacial.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/glacial.yml deleted file mode 100644 index 7b1e1b06..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/glacial.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Glacial EcoEnchant -# - -name: "Glacial" -description: Take less damage in cold biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - elevation - - heat_treated - - oceanic - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/heattreated.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/heattreated.yml deleted file mode 100644 index 03e1fee0..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/heattreated.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Heat Treated EcoEnchant -# - -name: "Heat Treated" -description: Take less damage in hot biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - elevation - - glacial - - oceanic - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml deleted file mode 100644 index 4064b4a5..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/icelord.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Icelord EcoEnchant -# - -name: "Icelord" -description: Deal more damage in cold biomes. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - altitude - - aquamarine - - dehydration - - rainforest - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/oceanic.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/oceanic.yml deleted file mode 100644 index 80d8d8fd..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/oceanic.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Oceanic EcoEnchant -# - -name: "Oceanic" -description: Take less damage in oceans. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - elevation - - glacial - - heat_treated - - tropical - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/rainforest.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/rainforest.yml deleted file mode 100644 index 61b651a2..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/rainforest.yml +++ /dev/null @@ -1,36 +0,0 @@ -# -# Rainforest EcoEnchant -# - -name: "Rainforest" -description: Deal more damage in jungles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - bow - - crossbow - - sword - - axe - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - altitude - - aquamarine - - dehydration - - icelord - maximum-level: 6 - -config: - multiplier: 0.03 \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/enchants/normal/tropical.yml b/eco-extensions/biomes/src/main/resources/enchants/normal/tropical.yml deleted file mode 100644 index fffe05d4..00000000 --- a/eco-extensions/biomes/src/main/resources/enchants/normal/tropical.yml +++ /dev/null @@ -1,35 +0,0 @@ -# -# Tropical EcoEnchant -# - -name: "Tropical" -description: Take less damage in jungles. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - elevation - - glacial - - heat_treated - - oceanic - maximum-level: 3 - -config: - reduction-per-level: 2 # As percentage \ No newline at end of file diff --git a/eco-extensions/biomes/src/main/resources/extension.yml b/eco-extensions/biomes/src/main/resources/extension.yml deleted file mode 100644 index 0b4d5449..00000000 --- a/eco-extensions/biomes/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Biomes -main: com.willfp.ecoenchants.biomes.BiomesMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/build.gradle b/eco-extensions/build.gradle deleted file mode 100644 index fac46e61..00000000 --- a/eco-extensions/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -group 'com.willfp' -description = 'Extension Parent' - -subprojects { - dependencies { - compileOnly project(":eco-core:core-plugin") - compileOnly project(":eco-core:core-proxy") - compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' - compileOnly 'com.willfp:libreforge:3.3.0' - } - - tasks.withType(Jar) { - destinationDirectory = file("$rootDir/bin/") - } - - tasks.jar.enabled = false -} \ No newline at end of file diff --git a/eco-extensions/citizen/build.gradle b/eco-extensions/citizen/build.gradle deleted file mode 100644 index 869ce1ef..00000000 --- a/eco-extensions/citizen/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '1.1.0' -description = 'Citizen Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/citizen/src/main/java/com/willfp/ecoenchants/citizen/Citizen.java b/eco-extensions/citizen/src/main/java/com/willfp/ecoenchants/citizen/Citizen.java deleted file mode 100644 index da53f017..00000000 --- a/eco-extensions/citizen/src/main/java/com/willfp/ecoenchants/citizen/Citizen.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.willfp.ecoenchants.citizen; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Trident; -import org.bukkit.entity.Villager; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Citizen extends EcoEnchant { - public Citizen() { - super( - "citizen", EnchantmentType.NORMAL - ); - } - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity uncastVictim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(uncastVictim instanceof Villager)) { - return; - } - - event.setCancelled(true); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Villager)) { - return; - } - - event.setCancelled(true); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!(victim instanceof Villager)) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-extensions/citizen/src/main/java/com/willfp/ecoenchants/citizen/CitizenMain.java b/eco-extensions/citizen/src/main/java/com/willfp/ecoenchants/citizen/CitizenMain.java deleted file mode 100644 index adb508ef..00000000 --- a/eco-extensions/citizen/src/main/java/com/willfp/ecoenchants/citizen/CitizenMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.citizen; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class CitizenMain extends Extension { - public static final EcoEnchant CITIZEN = new Citizen(); - - public CitizenMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/citizen/src/main/resources/enchants/normal/citizen.yml b/eco-extensions/citizen/src/main/resources/enchants/normal/citizen.yml deleted file mode 100644 index 0a5b02b5..00000000 --- a/eco-extensions/citizen/src/main/resources/enchants/normal/citizen.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Citizen EcoEnchant -# - -name: "Citizen" -description: Prevent you from injuring villagers. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: uncommon - -general-config: - flags: [] - targets: - - sword - - axe - - bow - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 1 - -config: - # No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/citizen/src/main/resources/extension.yml b/eco-extensions/citizen/src/main/resources/extension.yml deleted file mode 100644 index f5002d5f..00000000 --- a/eco-extensions/citizen/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Citizen -main: com.willfp.ecoenchants.citizen.CitizenMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/countereffects/build.gradle b/eco-extensions/countereffects/build.gradle deleted file mode 100644 index 2ba936f6..00000000 --- a/eco-extensions/countereffects/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '1.1.0' -description = 'CounterEffects Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/CounterEffectsEnchantment.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/CounterEffectsEnchantment.java deleted file mode 100644 index f1d5d9d5..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/CounterEffectsEnchantment.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.willfp.ecoenchants.countereffects; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityPotionEffectEvent; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; - -public abstract class CounterEffectsEnchantment extends EcoEnchant { - protected CounterEffectsEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - } - - public abstract PotionEffectType[] getPotionEffects(); - - @EventHandler - public void onEffect(@NotNull final EntityPotionEffectEvent event) { - if (event.isCancelled()) { - return; - } - - if (!(event.getEntity() instanceof LivingEntity livingEntity)) { - return; - } - - if (event.getNewEffect() == null) { - return; - } - - int level = EnchantChecks.getArmorPoints(livingEntity, this); - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (Arrays.asList(this.getPotionEffects()).contains(event.getNewEffect().getType())) { - event.setCancelled(true); - } - } -} diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/CounterEffectsMain.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/CounterEffectsMain.java deleted file mode 100644 index f8f268a5..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/CounterEffectsMain.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.countereffects; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.countereffects.enchants.Abundance; -import com.willfp.ecoenchants.countereffects.enchants.Apothecary; -import com.willfp.ecoenchants.countereffects.enchants.Resolve; -import com.willfp.ecoenchants.countereffects.enchants.Vigor; -import com.willfp.ecoenchants.countereffects.enchants.Vivacity; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class CounterEffectsMain extends Extension { - public static final EcoEnchant APOTHECARY = new Apothecary(); - public static final EcoEnchant ABUNDANCE = new Abundance(); - public static final EcoEnchant VIGOR = new Vigor(); - public static final EcoEnchant VIVACITY = new Vivacity(); - public static final EcoEnchant RESOLVE = new Resolve(); - - public CounterEffectsMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Abundance.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Abundance.java deleted file mode 100644 index a4f361c2..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Abundance.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.countereffects.enchants; - -import com.willfp.ecoenchants.countereffects.CounterEffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Abundance extends CounterEffectsEnchantment { - public Abundance() { - super("abundance", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType[] getPotionEffects() { - return new PotionEffectType[]{ - PotionEffectType.HUNGER - }; - } -} diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Apothecary.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Apothecary.java deleted file mode 100644 index dfb7332b..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Apothecary.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.willfp.ecoenchants.countereffects.enchants; - -import com.willfp.ecoenchants.countereffects.CounterEffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Apothecary extends CounterEffectsEnchantment { - public Apothecary() { - super("apothecary", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType[] getPotionEffects() { - return new PotionEffectType[]{ - PotionEffectType.WITHER, - PotionEffectType.POISON - }; - } -} diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Resolve.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Resolve.java deleted file mode 100644 index 0599d468..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Resolve.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.countereffects.enchants; - -import com.willfp.ecoenchants.countereffects.CounterEffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Resolve extends CounterEffectsEnchantment { - public Resolve() { - super("resolve", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType[] getPotionEffects() { - return new PotionEffectType[]{ - PotionEffectType.WEAKNESS - }; - } -} diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Vigor.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Vigor.java deleted file mode 100644 index 8544bc4a..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Vigor.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.countereffects.enchants; - -import com.willfp.ecoenchants.countereffects.CounterEffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Vigor extends CounterEffectsEnchantment { - public Vigor() { - super("vigor", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType[] getPotionEffects() { - return new PotionEffectType[]{ - PotionEffectType.CONFUSION - }; - } -} diff --git a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Vivacity.java b/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Vivacity.java deleted file mode 100644 index f9d42a26..00000000 --- a/eco-extensions/countereffects/src/main/java/com/willfp/ecoenchants/countereffects/enchants/Vivacity.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.willfp.ecoenchants.countereffects.enchants; - -import com.willfp.ecoenchants.countereffects.CounterEffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Vivacity extends CounterEffectsEnchantment { - public Vivacity() { - super("vivacity", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType[] getPotionEffects() { - return new PotionEffectType[]{ - PotionEffectType.SLOW_DIGGING - }; - } -} diff --git a/eco-extensions/countereffects/src/main/resources/enchants/normal/abundance.yml b/eco-extensions/countereffects/src/main/resources/enchants/normal/abundance.yml deleted file mode 100644 index 2f1e130b..00000000 --- a/eco-extensions/countereffects/src/main/resources/enchants/normal/abundance.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Abundance EcoEnchant -# - -name: "Abundance" -description: Chance to not get affected by hunger. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 2 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-extensions/countereffects/src/main/resources/enchants/normal/apothecary.yml b/eco-extensions/countereffects/src/main/resources/enchants/normal/apothecary.yml deleted file mode 100644 index 5de75235..00000000 --- a/eco-extensions/countereffects/src/main/resources/enchants/normal/apothecary.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Apothecary EcoEnchant -# - -name: "Apothecary" -description: Chance to not get affected by posion or wither. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 2 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-extensions/countereffects/src/main/resources/enchants/normal/resolve.yml b/eco-extensions/countereffects/src/main/resources/enchants/normal/resolve.yml deleted file mode 100644 index 61016d23..00000000 --- a/eco-extensions/countereffects/src/main/resources/enchants/normal/resolve.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Resolve EcoEnchant -# - -name: "Resolve" -description: Chance to not get affected by weakness. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 2 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-extensions/countereffects/src/main/resources/enchants/normal/vigor.yml b/eco-extensions/countereffects/src/main/resources/enchants/normal/vigor.yml deleted file mode 100644 index 1e649191..00000000 --- a/eco-extensions/countereffects/src/main/resources/enchants/normal/vigor.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Vigor EcoEnchant -# - -name: "Vigor" -description: Chance to not get affected by nausea. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 2 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-extensions/countereffects/src/main/resources/enchants/normal/vivacity.yml b/eco-extensions/countereffects/src/main/resources/enchants/normal/vivacity.yml deleted file mode 100644 index e4f0cf6a..00000000 --- a/eco-extensions/countereffects/src/main/resources/enchants/normal/vivacity.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Vivacity EcoEnchant -# - -name: "Vivacity" -description: Chance to not get affected by mining fatigue. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 2 - -config: - chance-per-level: 12.5 \ No newline at end of file diff --git a/eco-extensions/countereffects/src/main/resources/extension.yml b/eco-extensions/countereffects/src/main/resources/extension.yml deleted file mode 100644 index 42727258..00000000 --- a/eco-extensions/countereffects/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: CounterEffects -main: com.willfp.ecoenchants.countereffects.CounterEffectsMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/effects/build.gradle b/eco-extensions/effects/build.gradle deleted file mode 100644 index c4a7c862..00000000 --- a/eco-extensions/effects/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.0' -description = 'Effects Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsEnchantment.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsEnchantment.java deleted file mode 100644 index c91b2fe1..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsEnchantment.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.willfp.ecoenchants.effects; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.core.events.ArmorChangeEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.jetbrains.annotations.NotNull; - -public abstract class EffectsEnchantment extends EcoEnchant { - protected EffectsEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - } - - public abstract PotionEffectType getPotionEffect(); - - @EventHandler - public void onEquip(@NotNull final ArmorChangeEvent event) { - final Player player = event.getPlayer(); - - if (player.hasPotionEffect(this.getPotionEffect()) && player.getPotionEffect(this.getPotionEffect()).getDuration() >= 1639) { - player.removePotionEffect(this.getPotionEffect()); - } - - int level = EnchantChecks.getArmorPoints(player, this); - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - if (level > 0) { - player.addPotionEffect(new PotionEffect(this.getPotionEffect(), 0x6fffffff, level - 1, false, false, true)); - } - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsMain.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsMain.java deleted file mode 100644 index 9c8a5a52..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/EffectsMain.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.effects; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.effects.enchants.JumpBoost; -import com.willfp.ecoenchants.effects.enchants.NightVision; -import com.willfp.ecoenchants.effects.enchants.Regeneration; -import com.willfp.ecoenchants.effects.enchants.Speed; -import com.willfp.ecoenchants.effects.enchants.WaterBreathing; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class EffectsMain extends Extension { - public static final EcoEnchant JUMP_BOOST = new JumpBoost(); - public static final EcoEnchant NIGHT_VISION = new NightVision(); - public static final EcoEnchant REGENERATION = new Regeneration(); - public static final EcoEnchant SPEED = new Speed(); - public static final EcoEnchant WATER_BREATHING = new WaterBreathing(); - - public EffectsMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/JumpBoost.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/JumpBoost.java deleted file mode 100644 index 03091f03..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/JumpBoost.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class JumpBoost extends EffectsEnchantment { - public JumpBoost() { - super("jump_boost", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.JUMP; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/NightVision.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/NightVision.java deleted file mode 100644 index 5a554089..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/NightVision.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class NightVision extends EffectsEnchantment { - public NightVision() { - super("night_vision", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.NIGHT_VISION; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Regeneration.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Regeneration.java deleted file mode 100644 index f3e218e0..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Regeneration.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Regeneration extends EffectsEnchantment { - public Regeneration() { - super("regeneration", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.REGENERATION; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Speed.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Speed.java deleted file mode 100644 index 53e2a3ea..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/Speed.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class Speed extends EffectsEnchantment { - public Speed() { - super("speed", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.SPEED; - } -} diff --git a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/WaterBreathing.java b/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/WaterBreathing.java deleted file mode 100644 index 02637995..00000000 --- a/eco-extensions/effects/src/main/java/com/willfp/ecoenchants/effects/enchants/WaterBreathing.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.willfp.ecoenchants.effects.enchants; - -import com.willfp.ecoenchants.effects.EffectsEnchantment; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import org.bukkit.potion.PotionEffectType; - -public class WaterBreathing extends EffectsEnchantment { - public WaterBreathing() { - super("water_breathing", EnchantmentType.NORMAL); - } - - @Override - public PotionEffectType getPotionEffect() { - return PotionEffectType.WATER_BREATHING; - } -} diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/jumpboost.yml b/eco-extensions/effects/src/main/resources/enchants/normal/jumpboost.yml deleted file mode 100644 index 799d8f74..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/jumpboost.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Jump Boost EcoEnchant -# - -name: "Jump Boost" -description: Gives you permanent jump boost. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - spring - maximum-level: 3 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/nightvision.yml b/eco-extensions/effects/src/main/resources/enchants/normal/nightvision.yml deleted file mode 100644 index 57918f59..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/nightvision.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Night Vision EcoEnchant -# - -name: "Night Vision" -description: Gives you permanent night vision. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 1 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/regeneration.yml b/eco-extensions/effects/src/main/resources/enchants/normal/regeneration.yml deleted file mode 100644 index 0bff0618..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/regeneration.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Regeneration EcoEnchant -# - -name: "Regeneration" -description: Gives you permanent regeneration. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 2 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/speed.yml b/eco-extensions/effects/src/main/resources/enchants/normal/speed.yml deleted file mode 100644 index 73ab1f73..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/speed.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Speed EcoEnchant -# - -name: "Speed" -description: Gives you permanent speed. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - boots - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - streamlining - maximum-level: 3 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/enchants/normal/waterbreathing.yml b/eco-extensions/effects/src/main/resources/enchants/normal/waterbreathing.yml deleted file mode 100644 index 184e4cad..00000000 --- a/eco-extensions/effects/src/main/resources/enchants/normal/waterbreathing.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Water Breathing EcoEnchant -# - -name: "Water Breathing" -description: Gives you permanent water breathing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 1 - -config: -# No config is available for this enchantment \ No newline at end of file diff --git a/eco-extensions/effects/src/main/resources/extension.yml b/eco-extensions/effects/src/main/resources/extension.yml deleted file mode 100644 index 46b3d530..00000000 --- a/eco-extensions/effects/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Effects -main: com.willfp.ecoenchants.effects.EffectsMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/endershot/build.gradle b/eco-extensions/endershot/build.gradle deleted file mode 100644 index 438bfd9e..00000000 --- a/eco-extensions/endershot/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.0' -description = 'Endershot Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/Endershot.java b/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/Endershot.java deleted file mode 100644 index 6f0ce715..00000000 --- a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/Endershot.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.willfp.ecoenchants.endershot; - -import com.willfp.eco.core.integrations.mcmmo.McmmoManager; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.SoundCategory; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class Endershot extends EcoEnchant { - public Endershot() { - super("endershot", EnchantmentType.NORMAL); - } - - @EventHandler(priority = EventPriority.LOW) - public void onBowShoot(@NotNull final EntityShootBowEvent event) { - if (McmmoManager.isFake(event)) { - return; - } - if (event.getProjectile().getType() != EntityType.ARROW) { - return; - } - if (!(event.getEntity() instanceof Player player)) { - return; - } - - if (!player.isSneaking()) { - return; - } - - event.setCancelled(true); - - if (!EnchantChecks.mainhand(player, this)) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - if (!player.getInventory().contains(Material.ENDER_PEARL, 1) && !player.getGameMode().equals(GameMode.CREATIVE)) { - return; - } - - boolean hasInfinity = EnchantChecks.mainhand(player, ARROW_INFINITE) && this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "work-with-infinity"); - if (!hasInfinity) { - ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1); - player.getInventory().remove(pearl); - } - - EnderPearl pearl = player.launchProjectile(EnderPearl.class); - pearl.setShooter(player); - pearl.setVelocity(event.getProjectile().getVelocity()); - player.playSound(player.getLocation(), Sound.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1f, 1f); - } -} diff --git a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/EndershotMain.java b/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/EndershotMain.java deleted file mode 100644 index 94e578a8..00000000 --- a/eco-extensions/endershot/src/main/java/com/willfp/ecoenchants/endershot/EndershotMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.endershot; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class EndershotMain extends Extension { - public static final EcoEnchant ENDERSHOT = new Endershot(); - - public EndershotMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/endershot/src/main/resources/enchants/normal/endershot.yml b/eco-extensions/endershot/src/main/resources/enchants/normal/endershot.yml deleted file mode 100644 index 56d777c3..00000000 --- a/eco-extensions/endershot/src/main/resources/enchants/normal/endershot.yml +++ /dev/null @@ -1,29 +0,0 @@ -# -# Endershot EcoEnchant -# - -name: "Endershot" -description: Shoot ender pearls out of your bow while crouching -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 1 - -config: - work-with-infinity: true # Don't consume ender pearls when enchanted with infinity \ No newline at end of file diff --git a/eco-extensions/endershot/src/main/resources/extension.yml b/eco-extensions/endershot/src/main/resources/extension.yml deleted file mode 100644 index dc8a1c7f..00000000 --- a/eco-extensions/endershot/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Endershot -main: com.willfp.ecoenchants.endershot.EndershotMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/firewand/build.gradle b/eco-extensions/firewand/build.gradle deleted file mode 100644 index f5ddd6f4..00000000 --- a/eco-extensions/firewand/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.0' -description = 'Firewand Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/Firewand.java b/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/Firewand.java deleted file mode 100644 index 3243550a..00000000 --- a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/Firewand.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.willfp.ecoenchants.firewand; - - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.entity.Player; -import org.bukkit.entity.SmallFireball; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.jetbrains.annotations.NotNull; - -public class Firewand extends Spell { - public Firewand() { - super("firewand"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - SmallFireball fireball = player.launchProjectile(SmallFireball.class, player.getEyeLocation().getDirection().multiply(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "velocity"))); - fireball.setIsIncendiary(this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "fire")); - fireball.setMetadata("eco-damage", this.getPlugin().getMetadataValueFactory().create(this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "damage-per-level") * level)); - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "no-explode")) { - fireball.setMetadata("nobreak", this.getPlugin().getMetadataValueFactory().create(true)); - } - fireball.setShooter(player); - - return true; - } - - @EventHandler(priority = EventPriority.LOW) - public void onFireballDamage(@NotNull final EntityDamageByEntityEvent event) { - if (!(event.getDamager() instanceof SmallFireball)) { - return; - } - if (event.getDamager().getMetadata("eco-damage").isEmpty()) { - return; - } - - double multiplier = event.getDamager().getMetadata("eco-damage").get(0).asDouble(); - - event.setDamage(multiplier); - } - - @EventHandler - public void onFireballExplode(@NotNull final EntityExplodeEvent event) { - if (!(event.getEntity() instanceof SmallFireball)) { - return; - } - if (event.getEntity().getMetadata("nobreak").isEmpty()) { - return; - } - - event.setCancelled(true); - } -} diff --git a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/FirewandMain.java b/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/FirewandMain.java deleted file mode 100644 index 25792316..00000000 --- a/eco-extensions/firewand/src/main/java/com/willfp/ecoenchants/firewand/FirewandMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.firewand; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class FirewandMain extends Extension { - public static final EcoEnchant FIREWAND = new Firewand(); - - public FirewandMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/firewand/src/main/resources/enchants/spell/firewand.yml b/eco-extensions/firewand/src/main/resources/enchants/spell/firewand.yml deleted file mode 100644 index 6c8197aa..00000000 --- a/eco-extensions/firewand/src/main/resources/enchants/spell/firewand.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Firewand EcoEnchant -# - -name: "Firewand" -description: Shoots a fireball -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - rod - - carrot_stick - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_GHAST_SHOOT - cooldown: 60 # In seconds - velocity: 3 - fire: true - damage-per-level: 8 - no-explode: false # Don't explode \ No newline at end of file diff --git a/eco-extensions/firewand/src/main/resources/extension.yml b/eco-extensions/firewand/src/main/resources/extension.yml deleted file mode 100644 index 09fe60d6..00000000 --- a/eco-extensions/firewand/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Firewand -main: com.willfp.ecoenchants.firewand.FirewandMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/intimidation/build.gradle b/eco-extensions/intimidation/build.gradle deleted file mode 100644 index 0bcfd973..00000000 --- a/eco-extensions/intimidation/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '1.1.0' -description = 'Intimidation Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/intimidation/src/main/java/com/willfp/ecoenchants/intimidation/Intimidation.java b/eco-extensions/intimidation/src/main/java/com/willfp/ecoenchants/intimidation/Intimidation.java deleted file mode 100644 index fdd1357d..00000000 --- a/eco-extensions/intimidation/src/main/java/com/willfp/ecoenchants/intimidation/Intimidation.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.willfp.ecoenchants.intimidation; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.entity.Monster; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityTargetLivingEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Intimidation extends EcoEnchant { - public Intimidation() { - super( - "intimidation", EnchantmentType.NORMAL - ); - } - - @EventHandler - public void onSwitchTarget(@NotNull final EntityTargetLivingEntityEvent event) { - if (!(event.getEntity() instanceof Monster attacker)) { - return; - } - - if (event.getTarget() == null) { - return; - } - - if (!EnchantChecks.mainhand(event.getTarget(), this)) { - return; - } - - if (event.isCancelled()) { - return; - } - - if (this.getDisabledWorlds().contains(event.getTarget().getWorld())) { - return; - } - - int level = EnchantChecks.getArmorPoints(event.getTarget(), this); - - if (EnchantmentUtils.passedChance(this, level)) { - event.setCancelled(true); - } - } -} diff --git a/eco-extensions/intimidation/src/main/java/com/willfp/ecoenchants/intimidation/IntimidationMain.java b/eco-extensions/intimidation/src/main/java/com/willfp/ecoenchants/intimidation/IntimidationMain.java deleted file mode 100644 index 55cb8e59..00000000 --- a/eco-extensions/intimidation/src/main/java/com/willfp/ecoenchants/intimidation/IntimidationMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.intimidation; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class IntimidationMain extends Extension { - public static final EcoEnchant INTIMIDATION = new Intimidation(); - - public IntimidationMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/intimidation/src/main/resources/enchants/normal/intimidation.yml b/eco-extensions/intimidation/src/main/resources/enchants/normal/intimidation.yml deleted file mode 100644 index a213c4fb..00000000 --- a/eco-extensions/intimidation/src/main/resources/enchants/normal/intimidation.yml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Intimidation EcoEnchant -# - -name: "Intimidation" -description: Decrease the chance of hostile mobs being aggravated at you. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - helmet - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [] - maximum-level: 4 - -config: - chance-per-level: 20 \ No newline at end of file diff --git a/eco-extensions/intimidation/src/main/resources/extension.yml b/eco-extensions/intimidation/src/main/resources/extension.yml deleted file mode 100644 index 9e7e3674..00000000 --- a/eco-extensions/intimidation/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Intimidation -main: com.willfp.ecoenchants.intimidation.IntimidationMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/mmo/build.gradle b/eco-extensions/mmo/build.gradle deleted file mode 100644 index a09a8ddd..00000000 --- a/eco-extensions/mmo/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -group 'com.willfp' -version '5.0.0' -description = 'MMO Extension' - -repositories { - maven { - url 'https://mvn.lumine.io/repository/maven-public/' - } -} - -dependencies { - compileOnly 'net.Indyuce:MMOCore:1.7.0' - compileOnly 'net.Indyuce:MMOItems:6.5.4' - compileOnly 'net.Indyuce:MMOLib:1.7.3' -} - -configurations.all { - exclude group: 'com.mojang', module: 'authlib' - exclude group: 'org.kitteh.pastegg' -} - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOMain.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOMain.java deleted file mode 100644 index f8720be1..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOMain.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.willfp.ecoenchants.mmo; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.mmo.enchants.abilities.Discounted; -import com.willfp.ecoenchants.mmo.enchants.abilities.Recover; -import com.willfp.ecoenchants.mmo.enchants.mana.Augment; -import com.willfp.ecoenchants.mmo.enchants.mana.Drain; -import com.willfp.ecoenchants.mmo.enchants.mana.Elixir; -import com.willfp.ecoenchants.mmo.enchants.mana.Siphon; -import com.willfp.ecoenchants.mmo.enchants.mana.Spirituality; -import com.willfp.ecoenchants.mmo.enchants.misc.Strengthening; -import com.willfp.ecoenchants.mmo.enchants.stamina.Athletic; -import com.willfp.ecoenchants.mmo.enchants.stamina.Endurance; -import com.willfp.ecoenchants.mmo.enchants.stamina.Fortitude; -import com.willfp.ecoenchants.mmo.enchants.stamina.Motivate; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -public class MMOMain extends Extension { - public static final EcoEnchant ELIXIR = new Elixir(); - public static final EcoEnchant SIPHON = new Siphon(); - public static final EcoEnchant DRAIN = new Drain(); - public static final EcoEnchant SPIRITUALITY = new Spirituality(); - public static final EcoEnchant AUGMENT = new Augment(); - public static final EcoEnchant DISCOUNTED = new Discounted(); - public static final EcoEnchant RECOVER = new Recover(); - public static final EcoEnchant ENDURANCE = new Endurance(); - public static final EcoEnchant FORTITUDE = new Fortitude(); - public static final EcoEnchant MOTIVATE = new Motivate(); - public static final EcoEnchant ATHLETIC = new Athletic(); - public static final EcoEnchant STRENGTHENING = new Strengthening(); - - public MMOMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - protected void onEnable() { - if (!MMOPrerequisites.HAS_MMOCORE.isMet()) { - Bukkit.getLogger().severe("MMO Extension requires MMOCore to be installed!"); - Bukkit.getLogger().severe("Disabling..."); - this.disable(); - } - } - - @Override - protected void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOPrerequisites.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOPrerequisites.java deleted file mode 100644 index 934a88c8..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/MMOPrerequisites.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.mmo; - -import com.willfp.eco.core.Prerequisite; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; - -import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; - -public class MMOPrerequisites { - private static final Set enabledPlugins = Arrays.stream(Bukkit.getPluginManager().getPlugins()).map(Plugin::getName).collect(Collectors.toSet()); - - public static final Prerequisite HAS_MMOCORE = new Prerequisite( - () -> enabledPlugins.contains("MMOCore"), - "Has mmocore installed" - ); - public static final Prerequisite HAS_MMOITEMS = new Prerequisite( - () -> enabledPlugins.contains("MMOItems"), - "Has mmoitems installed" - ); - - public static Prerequisite[] append(Prerequisite[] array, Prerequisite newElement) { - Prerequisite[] copy = new Prerequisite[array.length + 1]; - System.arraycopy(array, 0, copy, 0, array.length); - copy[array.length] = newElement; - return copy; - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Discounted.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Discounted.java deleted file mode 100644 index adeedab3..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Discounted.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.abilities; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmoitems.api.event.AbilityUseEvent; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Discounted extends MMOEnchantment { - public Discounted() { - super("discounted", EnchantmentType.NORMAL, MMOPrerequisites.HAS_MMOITEMS); - } - - @EventHandler - public void onAbility(AbilityUseEvent event) { - Player player = event.getPlayer(); - - if (!EnchantChecks.mainhand(player, this)) - return; - - int level = EnchantChecks.getMainhandLevel(player, this); - - double cost = event.getAbility().getModifier("mana"); - if (cost == 0.0D) return; - - double multiplier = 1 - (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level); - cost *= multiplier; - - event.getAbility().setModifier("mana", cost); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Recover.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Recover.java deleted file mode 100644 index 40488adf..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/abilities/Recover.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.abilities; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmoitems.api.event.AbilityUseEvent; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Recover extends MMOEnchantment { - public Recover() { - super("recover", EnchantmentType.NORMAL, MMOPrerequisites.HAS_MMOITEMS); - } - - @EventHandler - public void onAbility(AbilityUseEvent event) { - Player player = event.getPlayer(); - - if (!EnchantChecks.mainhand(player, this)) - return; - - int level = EnchantChecks.getMainhandLevel(player, this); - - double cooldown = event.getAbility().getModifier("cooldown"); - - if (cooldown == 0.0D) return; - - double multiplier = 1 - (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * level); - cooldown *= multiplier; - - event.getAbility().setModifier("cooldown", cooldown); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Augment.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Augment.java deleted file mode 100644 index 58b45105..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Augment.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.mmogroup.mmolib.MMOLib; -import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.api.stat.SharedStat; -import net.mmogroup.mmolib.api.stat.modifier.StatModifier; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Augment extends MMOEnchantment { - private static final String KEY = "ecoenchants_bonus_mana"; - - public Augment() { - super("augment", EnchantmentType.NORMAL); - } - - @Override - public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) { - MMOPlayerData data = MMOPlayerData.get(player); - - data.getStatMap().getInstance(SharedStat.MAX_MANA).remove(KEY); - - if (level == 0) { - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - return; - } - - int mana = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "mana-per-level") * level; - - data.getStatMap().getInstance(SharedStat.MAX_MANA).addModifier(KEY, new StatModifier(mana)); - - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Drain.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Drain.java deleted file mode 100644 index 8a1405ea..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Drain.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOSpell; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; - -public class Drain extends MMOSpell { - public Drain() { - super("drain"); - } - - @Override - public boolean onUse(Player player, int level, PlayerInteractEvent event) { - double radius = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "radius-per-level") * level; - double amount = 1 - ((this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level); - - player.getNearbyEntities(radius, radius, radius).forEach(entity -> { - if (!(entity instanceof Player)) - return; - - Player victim = (Player) entity; - MMOManager.setMana(victim, MMOManager.getMana(player) * amount); - }); - - return true; - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Elixir.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Elixir.java deleted file mode 100644 index ff2a1c15..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Elixir.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Elixir extends MMOEnchantment { - public Elixir() { - super("elixir", EnchantmentType.NORMAL); - } - - @Override - public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double victimMana = MMOManager.getMana(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimMana * quantity; - - MMOManager.setMana(pVictim, victimMana - toSteal); - MMOManager.giveMana(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Siphon.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Siphon.java deleted file mode 100644 index 2805ebfd..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Siphon.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Siphon extends MMOEnchantment { - public Siphon() { - super("siphon", EnchantmentType.NORMAL); - } - - @Override - public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - double victimMana = MMOManager.getMana(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimMana * quantity; - - MMOManager.setMana(pVictim, victimMana - toSteal); - MMOManager.giveMana(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Spirituality.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Spirituality.java deleted file mode 100644 index 34a99cec..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/mana/Spirituality.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.mana; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmocore.api.event.PlayerRegenResourceEvent; -import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Spirituality extends MMOEnchantment { - public Spirituality() { - super("spirituality", EnchantmentType.NORMAL); - } - - @EventHandler - public void onRegainMana(PlayerRegenResourceEvent event) { - if (!event.getResource().equals(PlayerResource.MANA)) - return; - - Player player = event.getPlayer(); - - int levels = EnchantChecks.getArmorPoints(player, this); - if (levels == 0) return; - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * levels; - event.setAmount(event.getAmount() * (multiplier + 1)); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/misc/Strengthening.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/misc/Strengthening.java deleted file mode 100644 index 0e46365e..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/misc/Strengthening.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.misc; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.mmogroup.mmolib.MMOLib; -import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.api.stat.SharedStat; -import net.mmogroup.mmolib.api.stat.modifier.StatModifier; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Strengthening extends MMOEnchantment { - private static final String KEY = "ecoenchants_bonus_strength"; - - public Strengthening() { - super("strengthening", EnchantmentType.NORMAL); - } - - @Override - public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) { - MMOPlayerData data = MMOPlayerData.get(player); - - data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).remove(KEY); - - if (level == 0) { - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - return; - } - - double multiplier = (this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "multiplier") * level) * data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).getBase(); - - data.getStatMap().getInstance(SharedStat.ATTACK_DAMAGE).addModifier(KEY, new StatModifier(multiplier)); - - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Athletic.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Athletic.java deleted file mode 100644 index e45e1279..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Athletic.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.eco.core.events.ArmorEquipEvent; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.mmogroup.mmolib.MMOLib; -import net.mmogroup.mmolib.api.player.MMOPlayerData; -import net.mmogroup.mmolib.api.stat.SharedStat; -import net.mmogroup.mmolib.api.stat.modifier.StatModifier; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -public class Athletic extends MMOEnchantment { - private static final String KEY = "ecoenchants_bonus_stamina"; - - public Athletic() { - super("athletic", EnchantmentType.NORMAL); - } - - @Override - public void onArmorEquip(@NotNull Player player, int level, @NotNull ArmorEquipEvent event) { - MMOPlayerData data = MMOPlayerData.get(player); - - data.getStatMap().getInstance(SharedStat.MAX_STAMINA).remove(KEY); - - if (level == 0) { - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - return; - } - - int stamina = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "stamina-per-level") * level; - - data.getStatMap().getInstance(SharedStat.MAX_STAMINA).addModifier(KEY, new StatModifier(stamina)); - - MMOLib.plugin.getStats().runUpdates(data.getStatMap()); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Endurance.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Endurance.java deleted file mode 100644 index bb2dfd06..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Endurance.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import net.Indyuce.mmocore.api.event.PlayerRegenResourceEvent; -import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; - -public class Endurance extends MMOEnchantment { - public Endurance() { - super("endurance", EnchantmentType.NORMAL); - } - - @EventHandler - public void onRegainMana(PlayerRegenResourceEvent event) { - if (!event.getResource().equals(PlayerResource.STAMINA)) - return; - - Player player = event.getPlayer(); - - int levels = EnchantChecks.getArmorPoints(player, this); - if (levels == 0) return; - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier") * levels; - event.setAmount(event.getAmount() * (multiplier + 1)); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Fortitude.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Fortitude.java deleted file mode 100644 index bee3bab9..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Fortitude.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Fortitude extends MMOEnchantment { - public Fortitude() { - super("fortitude", EnchantmentType.NORMAL); - } - - @Override - public void onArrowDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, @NotNull Arrow arrow, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - double victimStamina = MMOManager.getStamina(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimStamina * quantity; - - MMOManager.setStamina(pVictim, victimStamina - toSteal); - MMOManager.giveStamina(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Motivate.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Motivate.java deleted file mode 100644 index 5cad4241..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/enchants/stamina/Motivate.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.mmo.enchants.stamina; - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOManager; -import com.willfp.ecoenchants.mmo.structure.MMOEnchantment; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.jetbrains.annotations.NotNull; - -public class Motivate extends MMOEnchantment { - public Motivate() { - super("motivate", EnchantmentType.NORMAL); - } - - @Override - public void onMeleeAttack(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, @NotNull EntityDamageByEntityEvent event) { - if (!(attacker instanceof Player && victim instanceof Player)) - return; - Player pAttacker = (Player) attacker; - Player pVictim = (Player) victim; - - if (!EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - - double victimStamina = MMOManager.getStamina(pVictim); - - double quantity = (this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percentage-per-level") / 100) * level; - - double toSteal = victimStamina * quantity; - - MMOManager.setStamina(pVictim, victimStamina - toSteal); - MMOManager.giveStamina(pAttacker, toSteal); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOIntegration.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOIntegration.java deleted file mode 100644 index 16d3cdd0..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOIntegration.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.willfp.ecoenchants.mmo.integrations.mmo; - - -import com.willfp.eco.core.integrations.Integration; -import org.bukkit.entity.Player; - -public interface MMOIntegration extends Integration { - double getMana(Player player); - - void setMana(Player player, double amount); - - double getMaxMana(Player player); - - void giveMana(Player player, double amount); - - double getStamina(Player player); - - void setStamina(Player player, double amount); - - double getMaxStamina(Player player); - - void giveStamina(Player player, double amount); -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOManager.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOManager.java deleted file mode 100644 index ea778cb6..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/MMOManager.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.willfp.ecoenchants.mmo.integrations.mmo; - -import org.bukkit.entity.Player; - -import java.util.HashSet; -import java.util.Set; - -public class MMOManager { - private static final Set integrations = new HashSet<>(); - - public static void register(MMOIntegration integration) { - integrations.add(integration); - } - - private static MMOIntegration getIntegration() { - return integrations.stream().findFirst().get(); - } - - public static double getMana(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getMana(player); - } - - public static double getMaxMana(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getMaxMana(player); - } - - public static void setMana(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.setMana(player, amount); - } - - public static void giveMana(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.giveMana(player, amount); - } - - public static double getStamina(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getStamina(player); - } - - public static double getMaxStamina(Player player) { - MMOIntegration integration = getIntegration(); - return integration.getMaxStamina(player); - } - - public static void setStamina(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.setStamina(player, amount); - } - - public static void giveStamina(Player player, double amount) { - MMOIntegration integration = getIntegration(); - integration.giveStamina(player, amount); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/plugins/MMOCore.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/plugins/MMOCore.java deleted file mode 100644 index a8222e3f..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/integrations/mmo/plugins/MMOCore.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.willfp.ecoenchants.mmo.integrations.mmo.plugins; - -import com.willfp.ecoenchants.mmo.integrations.mmo.MMOIntegration; -import net.Indyuce.mmocore.api.player.PlayerData; -import net.Indyuce.mmocore.api.player.stats.StatType; -import org.bukkit.entity.Player; - -public class MMOCore implements MMOIntegration { - @Override - public double getMana(Player player) { - return PlayerData.get(player).getMana(); - } - - @Override - public void setMana(Player player, double amount) { - PlayerData.get(player).setMana(amount); - } - - @Override - public void giveMana(Player player, double amount) { - PlayerData.get(player).giveMana(amount); - } - - @Override - public double getMaxMana(Player player) { - return PlayerData.get(player).getStats().getStat(StatType.MAX_MANA); - } - - @Override - public double getStamina(Player player) { - return PlayerData.get(player).getStamina(); - } - - @Override - public void setStamina(Player player, double amount) { - PlayerData.get(player).setStamina(amount); - } - - @Override - public void giveStamina(Player player, double amount) { - PlayerData.get(player).giveStamina(amount); - } - - @Override - public double getMaxStamina(Player player) { - return PlayerData.get(player).getStats().getStat(StatType.MAX_STAMINA); - } - - @Override - public String getPluginName() { - return "MMOCore"; - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchant.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchant.java deleted file mode 100644 index a84195f6..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchant.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.willfp.ecoenchants.mmo.structure; - -import java.util.HashSet; -import java.util.Set; - -public interface MMOEnchant { - Set REGISTRY = new HashSet<>(); -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchantment.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchantment.java deleted file mode 100644 index c4540d98..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOEnchantment.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.ecoenchants.mmo.structure; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; - -public abstract class MMOEnchantment extends EcoEnchant implements MMOEnchant { - protected MMOEnchantment(String key, EnchantmentType type, Prerequisite... prerequisites) { - super(key, type, MMOPrerequisites.append(prerequisites, MMOPrerequisites.HAS_MMOCORE)); - - MMOEnchant.REGISTRY.add(this); - } -} diff --git a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOSpell.java b/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOSpell.java deleted file mode 100644 index d1323d4a..00000000 --- a/eco-extensions/mmo/src/main/java/com/willfp/ecoenchants/mmo/structure/MMOSpell.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.willfp.ecoenchants.mmo.structure; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import com.willfp.ecoenchants.mmo.MMOPrerequisites; - -public abstract class MMOSpell extends Spell implements MMOEnchant { - protected MMOSpell(String key, Prerequisite... prerequisites) { - super(key, MMOPrerequisites.append(prerequisites, MMOPrerequisites.HAS_MMOCORE)); - - MMOEnchant.REGISTRY.add(this); - } -} diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/athletic.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/athletic.yml deleted file mode 100644 index 5fa32a65..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/athletic.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Athletic EcoEnchant -# - -name: "Athletic" -description: Increases your max stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - stamina-per-level: 10 # Bonus max stamina to give per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/augment.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/augment.yml deleted file mode 100644 index b8bce8cc..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/augment.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Augment EcoEnchant -# - -name: "Augment" -description: Increases your max mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - mana-per-level: 10 # Bonus max mana to give per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/discounted.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/discounted.yml deleted file mode 100644 index 82df1df3..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/discounted.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Discounted EcoEnchant -# - -name: "Discounted" -description: Reduces mana cost for abilities. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.1 # Mana cost = initial cost * (1 - multiplier * level), thus 10 cost with discounted 5 means final cost is 5 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/elixir.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/elixir.yml deleted file mode 100644 index 5219ab9b..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/elixir.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Elixir EcoEnchant -# - -name: "Elixir" -description: Steals a portion of your victim's mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false - percentage-per-level: 5 # Percentage of your opponents mana to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/endurance.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/endurance.yml deleted file mode 100644 index be314031..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/endurance.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Endurance EcoEnchant -# - -name: "Endurance" -description: Increases the rate that you regain stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.1 # How many times faster to regain per level - # The formula is default amount * (1 + (multiplier * level)) - # ie, If you were going to regen 10 stamina with a multiplier of 0.1 and 8 levels, then you would regenerate: - # 10 * (1 + (0.1 * 8)) = 10 * 1.8 = 18 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/fortitude.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/fortitude.yml deleted file mode 100644 index 58a4775a..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/fortitude.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Fortitude EcoEnchant -# - -name: "Fortitude" -description: Steals a portion of your victim's stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - percentage-per-level: 5 # Percentage of your opponents stamina to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/motivate.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/motivate.yml deleted file mode 100644 index 2785d5b8..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/motivate.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Motivate EcoEnchant -# - -name: "Motivate" -description: Steals a portion of your victim's stamina. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - allow-not-fully-charged: false - percentage-per-level: 5 # Percentage of your opponents stamina to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/recover.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/recover.yml deleted file mode 100644 index 9be0739b..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/recover.yml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Recover EcoEnchant -# - -name: "Recover" -description: Reduces cooldown for abilities. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - sword - - axe - grindstoneable: true - conflicts: [ ] - maximum-level: 5 - -config: - multiplier: 0.1 # Cooldown = initial cooldown * (1 - multiplier * level), thus 8 cooldown with recover 5 means final cooldown is 4 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/siphon.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/siphon.yml deleted file mode 100644 index a3c08306..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/siphon.yml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Siphon EcoEnchant -# - -name: "Siphon" -description: Steals a portion of your victim's mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - percentage-per-level: 5 # Percentage of your opponents mana to steal per level \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/spirituality.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/spirituality.yml deleted file mode 100644 index 30614072..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/spirituality.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Spirituality EcoEnchant -# - -name: "Spirituality" -description: Increases the rate that you regain mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.1 # How many times faster to regain per level - # The formula is default amount * (1 + (multiplier * level)) - # ie, If you were going to regen 10 mana with a multiplier of 0.1 and 8 levels, then you would regenerate: - # 10 * (1 + (0.1 * 8)) = 10 * 1.8 = 18 \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/normal/strengthening.yml b/eco-extensions/mmo/src/main/resources/enchants/normal/strengthening.yml deleted file mode 100644 index 5990e06a..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/normal/strengthening.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Strengthening EcoEnchant -# - -name: "Strengthening" -description: Increases your attack damage while wearing. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: epic - -general-config: - flags: [] - targets: - - helmet - - chestplate - - leggings - - boots - grindstoneable: true - conflicts: [ ] - maximum-level: 4 - -config: - multiplier: 0.02 # Multiplier * Levels * Base Attack Damage is added to your total attack damage while wearing \ No newline at end of file diff --git a/eco-extensions/mmo/src/main/resources/enchants/spell/drain.yml b/eco-extensions/mmo/src/main/resources/enchants/spell/drain.yml deleted file mode 100644 index 1d002ccb..00000000 --- a/eco-extensions/mmo/src/main/resources/enchants/spell/drain.yml +++ /dev/null @@ -1,27 +0,0 @@ -# -# Drain EcoEnchant -# - -name: "Drain" -description: Reduces all nearby players' mana. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_ENDERMAN_TELEPORT - cooldown: 240 # In seconds - radius-per-level: 10 # Radius to check nearby players' mana - percentage-per-level: 10 # Percentage of nearby players' mana to reduce diff --git a/eco-extensions/mmo/src/main/resources/extension.yml b/eco-extensions/mmo/src/main/resources/extension.yml deleted file mode 100644 index 758320be..00000000 --- a/eco-extensions/mmo/src/main/resources/extension.yml +++ /dev/null @@ -1,3 +0,0 @@ -name: MMO -main: com.willfp.ecoenchants.mmo.MMOMain -version: ${projectVersion} \ No newline at end of file diff --git a/eco-extensions/precision/build.gradle b/eco-extensions/precision/build.gradle deleted file mode 100644 index 7611bbd4..00000000 --- a/eco-extensions/precision/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.0' -description = 'Precision Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/Precision.java b/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/Precision.java deleted file mode 100644 index fd99fbce..00000000 --- a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/Precision.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.willfp.ecoenchants.precision; - -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.GameMode; -import org.bukkit.entity.Enderman; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Trident; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -@SuppressWarnings("unchecked") -public class Precision extends EcoEnchant { - public Precision() { - super( - "precision", EnchantmentType.SPECIAL - ); - } - - @EventHandler - public void aimingLaunch(@NotNull final ProjectileLaunchEvent event) { - if (!(event.getEntity().getShooter() instanceof Player player)) { - return; - } - - if (!(event.getEntity() instanceof Trident trident)) { - return; - } - - if (event.isCancelled()) { - return; - } - - ItemStack itemStack = trident.getItem(); - if (!EnchantChecks.item(itemStack, this)) { - return; - } - if (this.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - int level = EnchantChecks.getMainhandLevel(player, this); - - double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance-per-level"); - - final double finalDistance = level * multiplier; - Runnable runnable = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - List nearbyEntities = (List) (List) Arrays.asList(trident.getNearbyEntities(finalDistance, finalDistance, finalDistance).stream() - .filter(entity -> entity instanceof LivingEntity) - .filter(entity -> !entity.equals(player)) - .filter(entity -> !(entity instanceof Enderman)) - .filter(entity -> { - if (entity instanceof Player) { - return ((Player) entity).getGameMode().equals(GameMode.SURVIVAL) || ((Player) entity).getGameMode().equals(GameMode.ADVENTURE); - } - return true; - }).toArray()); - if (nearbyEntities.isEmpty()) { - return; - } - LivingEntity entity = nearbyEntities.get(0); - double dist = Double.MAX_VALUE; - for (LivingEntity livingEntity : nearbyEntities) { - double currentDistance = livingEntity.getLocation().distance(trident.getLocation()); - if (currentDistance >= dist) { - continue; - } - - dist = currentDistance; - entity = livingEntity; - } - if (entity != null) { - Vector vector = entity.getEyeLocation().toVector().clone().subtract(trident.getLocation().toVector()).normalize(); - trident.setVelocity(vector); - } - }); - - final int period = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "check-ticks"); - final int checks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "checks-per-level") * level; - AtomicInteger checksPerformed = new AtomicInteger(0); - - this.getPlugin().getRunnableFactory().create(bukkitRunnable -> { - checksPerformed.addAndGet(1); - if (checksPerformed.get() > checks) { - bukkitRunnable.cancel(); - } - if (trident.isDead() || trident.isInBlock() || trident.isOnGround()) { - bukkitRunnable.cancel(); - } - this.getPlugin().getScheduler().run(runnable); - }).runTaskTimer(3, period); - } -} diff --git a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/PrecisionMain.java b/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/PrecisionMain.java deleted file mode 100644 index 3b5f59c6..00000000 --- a/eco-extensions/precision/src/main/java/com/willfp/ecoenchants/precision/PrecisionMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.precision; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class PrecisionMain extends Extension { - public static final EcoEnchant PRECISION = new Precision(); - - public PrecisionMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/precision/src/main/resources/enchants/special/precision.yml b/eco-extensions/precision/src/main/resources/enchants/special/precision.yml deleted file mode 100644 index 46c65ed2..00000000 --- a/eco-extensions/precision/src/main/resources/enchants/special/precision.yml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Precision EcoEnchant -# - -name: "Precision" -description: Tridents hone in on your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: special - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 5 - -config: - distance-per-level: 4 # Distance to scan per level - check-ticks: 10 # Ticks between rotations - checks-per-level: 2 # Amount of times to rotate arrow per level (prevents "floating") \ No newline at end of file diff --git a/eco-extensions/precision/src/main/resources/extension.yml b/eco-extensions/precision/src/main/resources/extension.yml deleted file mode 100644 index 8f4f864d..00000000 --- a/eco-extensions/precision/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Precision -main: com.willfp.ecoenchants.precision.PrecisionMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/rainbow/build.gradle b/eco-extensions/rainbow/build.gradle deleted file mode 100644 index 6ff5398d..00000000 --- a/eco-extensions/rainbow/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '2.1.0' -description = 'Rainbow Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java b/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java deleted file mode 100644 index 3ca79c63..00000000 --- a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/Rainbow.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.willfp.ecoenchants.rainbow; - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Tag; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.inventory.ItemStack; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class Rainbow extends EcoEnchant { - public Rainbow() { - super( - "rainbow", EnchantmentType.NORMAL - ); - } - - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) { - return; - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (!Tag.LEAVES.isTagged(block.getType())) { - return; - } - - event.setDropItems(false); - - Material toDrop; - - List materials = new ArrayList<>(); - - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "items")) { - Material material = Material.getMaterial(materialName.toUpperCase()); - if (material != null) { - materials.add(material); - } - } - - toDrop = materials.get(new Random().nextInt(materials.size())); - - if (toDrop == null) { - toDrop = block.getType(); - } - - ItemStack item = new ItemStack(toDrop, 1); - - new DropQueue(player) - .setLocation(block.getLocation()) - .addItem(item) - .push(); - } -} diff --git a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/RainbowMain.java b/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/RainbowMain.java deleted file mode 100644 index 6694f4a8..00000000 --- a/eco-extensions/rainbow/src/main/java/com/willfp/ecoenchants/rainbow/RainbowMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.rainbow; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class RainbowMain extends Extension { - public static final EcoEnchant RAINBOW = new Rainbow(); - - public RainbowMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/rainbow/src/main/resources/enchants/normal/rainbow.yml b/eco-extensions/rainbow/src/main/resources/enchants/normal/rainbow.yml deleted file mode 100644 index adc5509a..00000000 --- a/eco-extensions/rainbow/src/main/resources/enchants/normal/rainbow.yml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Rainbow EcoEnchant -# - -name: "Rainbow" -description: Chance to drop flowers and dyes from leaves. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: rare - -general-config: - flags: [] - targets: - - axe - - shears - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - silk_touch - maximum-level: 4 - -config: - items: - - white_dye - - orange_dye - - magenta_dye - - light_blue_dye - - yellow_dye - - lime_dye - - pink_dye - - gray_dye - - light_gray_dye - - cyan_dye - - purple_dye - - blue_dye - - brown_dye - - green_dye - - red_dye - - black_dye - - dandelion - - poppy - - blue_orchid - - allium - - azure_bluet - - red_tulip - - orange_tulip - - white_tulip - - pink_tulip - - oxeye_daisy - - cornflower - - lily_of_the_valley - - wither_rose - chance-per-level: 3 # Chance to drop item. \ No newline at end of file diff --git a/eco-extensions/rainbow/src/main/resources/extension.yml b/eco-extensions/rainbow/src/main/resources/extension.yml deleted file mode 100644 index 6a1ce31c..00000000 --- a/eco-extensions/rainbow/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Rainbow -main: com.willfp.ecoenchants.rainbow.RainbowMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/softtouch/build.gradle b/eco-extensions/softtouch/build.gradle deleted file mode 100644 index 5e44bc3f..00000000 --- a/eco-extensions/softtouch/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '1.1.0' -description = 'Soft Touch Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java b/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java deleted file mode 100644 index dce76411..00000000 --- a/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouch.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.willfp.ecoenchants.softtouch; - - -import com.willfp.eco.core.drops.DropQueue; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import org.apache.commons.lang.StringUtils; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.CreatureSpawner; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BlockStateMeta; -import org.bukkit.persistence.PersistentDataType; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -public class SoftTouch extends EcoEnchant { - public SoftTouch() { - super("soft_touch", EnchantmentType.NORMAL); - } - - @Override - public String getPlaceholder(final int level) { - return EnchantmentUtils.chancePlaceholder(this, level); - } - - @SuppressWarnings("checkstyle:OperatorWrap") - @Override - public void onBlockBreak(@NotNull final Player player, - @NotNull final Block block, - final int level, - @NotNull final BlockBreakEvent event) { - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (!(block.getState() instanceof CreatureSpawner spawner)) { - return; - } - - EntityType type = spawner.getSpawnedType(); - - event.setDropItems(false); - event.setExpToDrop(0); - - ItemStack itemStack = new ItemStack(Material.SPAWNER); - BlockStateMeta meta = (BlockStateMeta) itemStack.getItemMeta(); - assert meta != null; - spawner.setSpawnedType(type); - meta.setBlockState(spawner); - meta.getPersistentDataContainer().set(this.getPlugin().getNamespacedKeyFactory().create("softtouch"), PersistentDataType.STRING, type.name()); - - String entityName = displayNicely(type); - - String name = this.getConfig().getFormattedString(EcoEnchants.CONFIG_LOCATION + "name"); - name = name.replace("%type%", entityName); - name = name.replace("[", "").replace("]", ""); - meta.setDisplayName(name); - - List lore = this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "lore"); - lore.replaceAll(s -> s.replace("%type%", entityName)); - meta.setLore(lore); - - itemStack.setItemMeta(meta); - - new DropQueue(player) - .addItem(itemStack) - .push(); - } - - - @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) - public void onSpawnerPlace(@NotNull final BlockPlaceEvent event) { - Block block = event.getBlock(); - Material material = block.getType(); - - if (material != Material.SPAWNER) { - return; - } - - ItemStack itemStack = event.getItemInHand(); - if (!(itemStack.getItemMeta() instanceof BlockStateMeta blockStateMeta)) { - return; - } - - if (!blockStateMeta.getPersistentDataContainer().has(this.getPlugin().getNamespacedKeyFactory().create("softtouch"), PersistentDataType.STRING)) { - return; - } - - EntityType type = EntityType.valueOf(blockStateMeta.getPersistentDataContainer().get(this.getPlugin().getNamespacedKeyFactory().create("softtouch"), PersistentDataType.STRING)); - - CreatureSpawner spawner = (CreatureSpawner) blockStateMeta.getBlockState(); - spawner.setSpawnedType(type); - - Player player = event.getPlayer(); - if (player.getGameMode() == GameMode.CREATIVE) { - return; - } - - CreatureSpawner spawnerState = (CreatureSpawner) block.getState(); - spawnerState.setSpawnedType(type); - spawnerState.update(); - } - - private String displayNicely(@NotNull final EntityType type) { - String name = type.name().toLowerCase(); - name = name.replace("_", ""); - name = StringUtils.capitalize(name); - return name; - } -} diff --git a/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouchMain.java b/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouchMain.java deleted file mode 100644 index 78ad3475..00000000 --- a/eco-extensions/softtouch/src/main/java/com/willfp/ecoenchants/softtouch/SoftTouchMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.softtouch; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class SoftTouchMain extends Extension { - public static final EcoEnchant SOFT_TOUCH = new SoftTouch(); - - public SoftTouchMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/softtouch/src/main/resources/enchants/normal/softtouch.yml b/eco-extensions/softtouch/src/main/resources/enchants/normal/softtouch.yml deleted file mode 100644 index 99b28ecc..00000000 --- a/eco-extensions/softtouch/src/main/resources/enchants/normal/softtouch.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Soft Touch EcoEnchant -# - -name: "Soft Touch" -description: '&a%value%%&r chance to drop a spawner when you mine it.' -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - silk_touch - maximum-level: 5 - -config: - chance-per-level: 10 - name: - - "&a%type%&f Spawner" - lore: - - "&a%type%&f Spawner" - - "&fCan be placed anywhere in the world" \ No newline at end of file diff --git a/eco-extensions/softtouch/src/main/resources/extension.yml b/eco-extensions/softtouch/src/main/resources/extension.yml deleted file mode 100644 index 12b6bec7..00000000 --- a/eco-extensions/softtouch/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Soft Touch -main: com.willfp.ecoenchants.softtouch.SoftTouchMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/sprint-artifacts/build.gradle b/eco-extensions/sprint-artifacts/build.gradle deleted file mode 100644 index 9e96bd59..00000000 --- a/eco-extensions/sprint-artifacts/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.2.4' -description = 'Sprint Artifacts Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsListener.java b/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsListener.java deleted file mode 100644 index 13e9275d..00000000 --- a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsListener.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.willfp.ecoenchants.sprintartifacts; - -import com.willfp.ecoenchants.enchantments.itemtypes.Artifact; -import com.willfp.ecoenchants.enchantments.util.EnchantChecks; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.jetbrains.annotations.NotNull; - -import java.util.Optional; - -@SuppressWarnings("deprecation") -public class SprintArtifactsListener implements Listener { - @EventHandler - public void onPlayerMove(@NotNull final PlayerMoveEvent event) { - Player player = event.getPlayer(); - - if (!player.isSprinting()) { - return; - } - - if (!player.isOnGround()) { - return; - } - - ItemStack boots = player.getInventory().getBoots(); - if (boots == null) { - return; - } - ItemMeta bootsMeta = boots.getItemMeta(); - if (bootsMeta == null) { - return; - } - - Optional matching = bootsMeta.getEnchants().keySet().stream() - .filter(enchantment -> enchantment instanceof Artifact) - .map(enchant -> (Artifact) enchant) - .findFirst(); - if (matching.isEmpty()) { - return; - } - Artifact artifact = matching.get(); - - if (!artifact.areRequirementsMet(player)) { - return; - } - - if (!EnchantChecks.boots(player, artifact)) { - return; - } - - if (artifact.getDisabledWorlds().contains(player.getWorld())) { - return; - } - - player.getWorld().spawnParticle(artifact.getParticle(), player.getLocation().add(0, 0.1, 0), 1, 0, 0, 0, 0, artifact.getDustOptions(), true); - } -} diff --git a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsMain.java b/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsMain.java deleted file mode 100644 index 0e55fa46..00000000 --- a/eco-extensions/sprint-artifacts/src/main/java/com/willfp/ecoenchants/sprintartifacts/SprintArtifactsMain.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.willfp.ecoenchants.sprintartifacts; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import org.bukkit.Bukkit; -import org.jetbrains.annotations.NotNull; - -public class SprintArtifactsMain extends Extension { - public SprintArtifactsMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - Bukkit.getPluginManager().registerEvents(new SprintArtifactsListener(), this.getPlugin()); - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/sprint-artifacts/src/main/resources/extension.yml b/eco-extensions/sprint-artifacts/src/main/resources/extension.yml deleted file mode 100644 index 7676cb60..00000000 --- a/eco-extensions/sprint-artifacts/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Sprint Artifacts -main: com.willfp.ecoenchants.sprintartifacts.SprintArtifactsMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/summoning/build.gradle b/eco-extensions/summoning/build.gradle deleted file mode 100644 index fc4ff031..00000000 --- a/eco-extensions/summoning/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '5.1.3' -description = 'Summoning Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningEnchantment.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningEnchantment.java deleted file mode 100644 index ea8814f1..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningEnchantment.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.willfp.ecoenchants.summoning; - -import com.willfp.eco.core.Prerequisite; -import com.willfp.eco.util.NumberUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.enchantments.util.EnchantmentUtils; -import com.willfp.ecoenchants.enchantments.util.WeakMetadata; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.attribute.Attribute; -import org.bukkit.entity.*; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.jetbrains.annotations.NotNull; - -public abstract class SummoningEnchantment extends EcoEnchant { - private final SummoningType summoningType; - - protected SummoningEnchantment(@NotNull final String key, - @NotNull final EnchantmentType type, - @NotNull final SummoningType summoningType, - @NotNull final Prerequisite... prerequisites) { - super(key, type, prerequisites); - - this.summoningType = summoningType; - } - - public abstract EntityType getEntity(); - - @Override - public void onMeleeAttack(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!summoningType.equals(SummoningType.MELEE)) { - return; - } - - if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK - && this.getConfig().getBool("config.ignore-sweep-attacks")) { - return; - } - - doSpawn(attacker, victim, level); - } - - @Override - public void onArrowDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Arrow arrow, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!summoningType.equals(SummoningType.RANGED)) { - return; - } - - doSpawn(attacker, victim, level); - } - - @Override - public void onTridentDamage(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - @NotNull final Trident trident, - final int level, - @NotNull final EntityDamageByEntityEvent event) { - if (!summoningType.equals(SummoningType.TRIDENT)) { - return; - } - - doSpawn(attacker, victim, level); - } - - private void doSpawn(@NotNull final LivingEntity attacker, - @NotNull final LivingEntity victim, - final int level) { - if (summoningType.equals(SummoningType.MELEE)) { - if (EnchantmentUtils.isFullyChargeIfRequired(this, attacker)) { - return; - } - } - - if (!EnchantmentUtils.passedChance(this, level)) { - return; - } - - if (WeakMetadata.SUMMONED_ENTITY_MEMORY.containsKey(victim) || WeakMetadata.SUMMONED_ENTITY_TARGET.containsKey(victim)) { - return; - } - - Location location = victim.getLocation().clone(); - World world = victim.getWorld(); - - int toSpawn = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "mobs-per-level") * level; - int ticksToLive = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks-to-live-per-level") * level; - double health = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "health-per-level") * level; - - for (int i = 0; i < toSpawn; i++) { - Location locToSpawn = location.clone().add(NumberUtils.randFloat(-3, 3), NumberUtils.randFloat(0, 3), NumberUtils.randFloat(-3, 3)); - Mob entity = (Mob) world.spawnEntity(locToSpawn, this.getEntity()); - - entity.setTarget(victim); - if (health > entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()) { - health = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); - } - entity.setHealth(health); - WeakMetadata.SUMMONED_ENTITY_MEMORY.put(entity, victim); - WeakMetadata.SUMMONED_ENTITY_TARGET.put(victim, null); - this.getPlugin().getScheduler().runLater(entity::remove, ticksToLive); - } - } - - @EventHandler - public void onSwitchTarget(@NotNull final EntityTargetEvent event) { - if (!WeakMetadata.SUMMONED_ENTITY_MEMORY.containsKey(event.getEntity())) { - return; - } - - LivingEntity target = (LivingEntity) WeakMetadata.SUMMONED_ENTITY_MEMORY.get(event.getEntity()); - event.setTarget(target); - } - - @EventHandler(priority = EventPriority.LOW) - public void onDropItem(@NotNull final EntityDeathEvent event) { - if (!WeakMetadata.SUMMONED_ENTITY_MEMORY.containsKey(event.getEntity())) { - return; - } - - event.getDrops().clear(); - event.setDroppedExp(0); - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningMain.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningMain.java deleted file mode 100644 index 0c9be4a9..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningMain.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.willfp.ecoenchants.summoning; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.summoning.enchants.Crawler; -import com.willfp.ecoenchants.summoning.enchants.Firestorm; -import com.willfp.ecoenchants.summoning.enchants.Ghoul; -import com.willfp.ecoenchants.summoning.enchants.Metallic; -import com.willfp.ecoenchants.summoning.enchants.Mortality; -import org.jetbrains.annotations.NotNull; - -public class SummoningMain extends Extension { - public static final EcoEnchant METALLIC = new Metallic(); - public static final EcoEnchant FIRESTORM = new Firestorm(); - public static final EcoEnchant MORTALITY = new Mortality(); - public static final EcoEnchant GHOUL = new Ghoul(); - public static final EcoEnchant CRAWLER = new Crawler(); - - public SummoningMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningType.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningType.java deleted file mode 100644 index 20f2ea2d..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/SummoningType.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.willfp.ecoenchants.summoning; - -public enum SummoningType { - MELEE, - RANGED, - TRIDENT -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Crawler.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Crawler.java deleted file mode 100644 index 89999425..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Crawler.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Crawler extends SummoningEnchantment { - public Crawler() { - super("crawler", EnchantmentType.NORMAL, SummoningType.TRIDENT); - } - - @Override - public EntityType getEntity() { - return EntityType.CAVE_SPIDER; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Firestorm.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Firestorm.java deleted file mode 100644 index 3849de91..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Firestorm.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Firestorm extends SummoningEnchantment { - public Firestorm() { - super("firestorm", EnchantmentType.NORMAL, SummoningType.MELEE); - } - - @Override - public EntityType getEntity() { - return EntityType.BLAZE; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Ghoul.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Ghoul.java deleted file mode 100644 index 00c1ce48..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Ghoul.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Ghoul extends SummoningEnchantment { - public Ghoul() { - super("ghoul", EnchantmentType.NORMAL, SummoningType.RANGED); - } - - @Override - public EntityType getEntity() { - return EntityType.ZOMBIE; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Metallic.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Metallic.java deleted file mode 100644 index a1941965..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Metallic.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Metallic extends SummoningEnchantment { - public Metallic() { - super("metallic", EnchantmentType.SPECIAL, SummoningType.MELEE); - } - - @Override - public EntityType getEntity() { - return EntityType.IRON_GOLEM; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Mortality.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Mortality.java deleted file mode 100644 index e366b660..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Mortality.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Mortality extends SummoningEnchantment { - public Mortality() { - super("mortality", EnchantmentType.NORMAL, SummoningType.RANGED); - } - - @Override - public EntityType getEntity() { - return EntityType.WITHER_SKELETON; - } -} diff --git a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Sniper.java b/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Sniper.java deleted file mode 100644 index 0f452cba..00000000 --- a/eco-extensions/summoning/src/main/java/com/willfp/ecoenchants/summoning/enchants/Sniper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.willfp.ecoenchants.summoning.enchants; - -import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; -import com.willfp.ecoenchants.summoning.SummoningEnchantment; -import com.willfp.ecoenchants.summoning.SummoningType; -import org.bukkit.entity.EntityType; - -public class Sniper extends SummoningEnchantment { - public Sniper() { - super("sniper", EnchantmentType.NORMAL, SummoningType.TRIDENT); - } - - @Override - public EntityType getEntity() { - return EntityType.SKELETON; - } -} diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/crawler.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/crawler.yml deleted file mode 100644 index 598cb71c..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/crawler.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Crawler EcoEnchant -# - -name: "Crawler" -description: Spawns cave spiders to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - sniper - maximum-level: 3 - -config: - mobs-per-level: 2 # Amount of mobs to spawn per level - ticks-to-live-per-level: 30 # Ticks for mob to live per level - health-per-level: 6 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - ignore-sweep-attacks: true # Ignore sweep attacks \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/firestorm.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/firestorm.yml deleted file mode 100644 index c5209230..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/firestorm.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Firestorm EcoEnchant -# - -name: "Firestorm" -description: Spawns blazes to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - metallic - maximum-level: 3 - -config: - mobs-per-level: 2 # Amount of mobs to spawn per level - ticks-to-live-per-level: 50 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - allow-not-fully-charged: false # don't require sword attack to be at full charge - ignore-sweep-attacks: true # Ignore sweep attacks \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/ghoul.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/ghoul.yml deleted file mode 100644 index 7b4cd2a7..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/ghoul.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Ghoul EcoEnchant -# - -name: "Ghoul" -description: Spawns zombies to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - mortality - maximum-level: 4 - -config: - mobs-per-level: 1 # Amount of mobs to spawn per level - ticks-to-live-per-level: 30 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - ignore-sweep-attacks: true # Ignore sweep attacks \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/mortality.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/mortality.yml deleted file mode 100644 index 9751387d..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/mortality.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Mortality EcoEnchant -# - -name: "Mortality" -description: Spawns wither skeletons to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - bow - - crossbow - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - ghoul - maximum-level: 4 - -config: - mobs-per-level: 1 # Amount of mobs to spawn per level - ticks-to-live-per-level: 30 # Ticks for mob to live per level - health-per-level: 6 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - ignore-sweep-attacks: true # Ignore sweep attacks \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/normal/sniper.yml b/eco-extensions/summoning/src/main/resources/enchants/normal/sniper.yml deleted file mode 100644 index 691c2f8e..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/normal/sniper.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Sniper EcoEnchant -# - -name: "Sniper" -description: Spawns skeletons to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - trident - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - crawler - maximum-level: 3 - -config: - mobs-per-level: 2 # Amount of mobs to spawn per level - ticks-to-live-per-level: 40 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - ignore-sweep-attacks: true # Ignore sweep attacks \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/enchants/special/metallic.yml b/eco-extensions/summoning/src/main/resources/enchants/special/metallic.yml deleted file mode 100644 index 1e61a176..00000000 --- a/eco-extensions/summoning/src/main/resources/enchants/special/metallic.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Metallic EcoEnchant -# - -name: "Metallic" -description: Spawns iron golems to attack your target. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: veryspecial - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: - - firestorm - maximum-level: 2 - -config: - mobs-per-level: 1 # Amount of mobs to spawn per level - ticks-to-live-per-level: 20 # Ticks for mob to live per level - health-per-level: 4 # Health for mobs to have per level - chance-per-level: 5 # Chance to spawn mobs per level - allow-not-fully-charged: false # don't require sword attack to be at full charge - ignore-sweep-attacks: true # Ignore sweep attacks \ No newline at end of file diff --git a/eco-extensions/summoning/src/main/resources/extension.yml b/eco-extensions/summoning/src/main/resources/extension.yml deleted file mode 100644 index 9c24ccc9..00000000 --- a/eco-extensions/summoning/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Summoning -main: com.willfp.ecoenchants.summoning.SummoningMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/transmission/build.gradle b/eco-extensions/transmission/build.gradle deleted file mode 100644 index d576284e..00000000 --- a/eco-extensions/transmission/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '1.1.0' -description = 'Transmission Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/transmission/src/main/java/com/willfp/ecoenchants/transmission/Transmission.java b/eco-extensions/transmission/src/main/java/com/willfp/ecoenchants/transmission/Transmission.java deleted file mode 100644 index 49285d61..00000000 --- a/eco-extensions/transmission/src/main/java/com/willfp/ecoenchants/transmission/Transmission.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.willfp.ecoenchants.transmission; - - -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; -import org.jetbrains.annotations.NotNull; - -public class Transmission extends Spell { - public Transmission() { - super("transmission"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - double distance = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "distance"); - - Vector vector = player.getEyeLocation().getDirection().clone(); - vector.normalize(); - vector.multiply(distance); - - Location end = player.getEyeLocation().clone().add(vector); - - if (player.rayTraceBlocks(distance) != null) { - player.sendMessage(this.getPlugin().getLangYml().getPrefix() + this.getConfig().getFormattedString(EcoEnchants.CONFIG_LOCATION + "block-in-path")); - return false; - } - - player.teleport(end); - - return true; - } -} diff --git a/eco-extensions/transmission/src/main/java/com/willfp/ecoenchants/transmission/TransmissionMain.java b/eco-extensions/transmission/src/main/java/com/willfp/ecoenchants/transmission/TransmissionMain.java deleted file mode 100644 index bcbaea31..00000000 --- a/eco-extensions/transmission/src/main/java/com/willfp/ecoenchants/transmission/TransmissionMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.transmission; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class TransmissionMain extends Extension { - public static final EcoEnchant TRANSMISSION = new Transmission(); - - public TransmissionMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/transmission/src/main/resources/enchants/spell/transmission.yml b/eco-extensions/transmission/src/main/resources/enchants/spell/transmission.yml deleted file mode 100644 index 60424afe..00000000 --- a/eco-extensions/transmission/src/main/resources/enchants/spell/transmission.yml +++ /dev/null @@ -1,31 +0,0 @@ -# -# Transmission EcoEnchant -# - -name: "Transmission" -description: Teleports you in the direction you are looking -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - sword - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 1 - -config: - activation-sound: ENTITY_ENDERMAN_TELEPORT - cooldown: 15 # In seconds - distance: 8 - block-in-path: "&cThere are blocks in the way!" \ No newline at end of file diff --git a/eco-extensions/transmission/src/main/resources/extension.yml b/eco-extensions/transmission/src/main/resources/extension.yml deleted file mode 100644 index 0f8e906c..00000000 --- a/eco-extensions/transmission/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Transmission -main: com.willfp.ecoenchants.transmission.TransmissionMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/eco-extensions/xray/build.gradle b/eco-extensions/xray/build.gradle deleted file mode 100644 index 4ea0d0eb..00000000 --- a/eco-extensions/xray/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -group 'com.willfp' -version '3.2.0' -description = 'Xray Extension' - -shadowJar { - archiveFileName = project.getDescription() + " v" + project.version + ".jar" -} \ No newline at end of file diff --git a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java b/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java deleted file mode 100644 index 8d264e97..00000000 --- a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/Xray.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.willfp.ecoenchants.xray; - -import com.willfp.eco.util.TeamUtils; -import com.willfp.ecoenchants.enchantments.EcoEnchants; -import com.willfp.ecoenchants.enchantments.itemtypes.Spell; -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.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Shulker; -import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.scoreboard.Team; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -public class Xray extends Spell { - public Xray() { - super("xray"); - } - - @Override - public boolean onUse(@NotNull final Player player, - final int level, - @NotNull final PlayerInteractEvent event) { - Block block = event.getClickedBlock(); - - if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { - return false; - } - - Location location; - - if (block == null) { - location = player.getLocation(); - } else { - location = block.getLocation(); - } - - Set toReveal = new HashSet<>(); - - int size = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "blocks-per-level") * level; - - int ticks = this.getConfig().getInt(EcoEnchants.CONFIG_LOCATION + "ticks"); - - List materials = new ArrayList<>(); - - for (String materialName : this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "blocks")) { - Material material = Material.getMaterial(materialName.toUpperCase()); - if (material != null) { - materials.add(material); - } - } - - for (int x = -size; x <= size; x++) { - for (int y = -size; y <= size; y++) { - for (int z = -size; z <= size; z++) { - Block block1 = location.getWorld().getBlockAt(location.clone().add(x, y, z)); - - if (!materials.contains(block1.getType())) { - continue; - } - - toReveal.add(block1); - } - } - } - - toReveal.forEach(block1 -> { - Shulker shulker = (Shulker) block1.getWorld().spawnEntity(block1.getLocation(), EntityType.SHULKER); - shulker.setInvulnerable(true); - shulker.setSilent(true); - shulker.setAI(false); - shulker.setGravity(false); - shulker.setGlowing(true); - shulker.setInvisible(true); - shulker.setMetadata("xray-shulker", this.getPlugin().getMetadataValueFactory().create(true)); - - block1.setMetadata("xray-uuid", this.getPlugin().getMetadataValueFactory().create(shulker.getUniqueId())); - - if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "color-glow")) { - @SuppressWarnings("deprecation") - Team team = TeamUtils.getMaterialColorTeam(block1.getType()); - team.addEntry(shulker.getUniqueId().toString()); - } - - this.getPlugin().getScheduler().runLater(() -> { - shulker.remove(); - block1.removeMetadata("xray-uuid", this.getPlugin()); - }, ticks); - }); - - return true; - } - - @EventHandler - public void onBlockBreak(@NotNull final BlockBreakEvent event) { - Block block = event.getBlock(); - - if (!block.hasMetadata("xray-uuid")) { - return; - } - - for (MetadataValue meta : block.getMetadata("xray-uuid")) { - if (!(meta.value() instanceof UUID uuid)) { - continue; - } - - assert uuid != null; - - Entity entity = Bukkit.getServer().getEntity(uuid); - - if (entity != null) { - entity.remove(); - } - } - - for (Entity shulkerEntity : block.getLocation().getWorld().getNearbyEntities(block.getLocation(), 2, 2, 2, entity -> entity.hasMetadata("xray-shulker"))) { - shulkerEntity.remove(); - } - } -} diff --git a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/XrayMain.java b/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/XrayMain.java deleted file mode 100644 index 044e3864..00000000 --- a/eco-extensions/xray/src/main/java/com/willfp/ecoenchants/xray/XrayMain.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.willfp.ecoenchants.xray; - -import com.willfp.eco.core.EcoPlugin; -import com.willfp.eco.core.extensions.Extension; -import com.willfp.ecoenchants.enchantments.EcoEnchant; -import org.jetbrains.annotations.NotNull; - -public class XrayMain extends Extension { - public static final EcoEnchant XRAY = new Xray(); - - public XrayMain(@NotNull final EcoPlugin plugin) { - super(plugin); - } - - @Override - public void onEnable() { - // Handled by super - } - - @Override - public void onDisable() { - // Handled by super - } -} diff --git a/eco-extensions/xray/src/main/resources/enchants/spell/xray.yml b/eco-extensions/xray/src/main/resources/enchants/spell/xray.yml deleted file mode 100644 index b8f5a985..00000000 --- a/eco-extensions/xray/src/main/resources/enchants/spell/xray.yml +++ /dev/null @@ -1,51 +0,0 @@ -# -# Xray EcoEnchant -# - -name: "Xray" -description: Glow nearby ores through walls. -enabled: true - -obtaining: - table: true - villager: true - loot: true - rarity: legendary - -general-config: - flags: [] - targets: - - pickaxe - grindstoneable: true - disabled-in-worlds: [ ] - requirements: - list: [] - not-met-lore: [] - conflicts: [ ] - maximum-level: 3 - -config: - activation-sound: ENTITY_ENDERMAN_TELEPORT - cooldown: 40 # In seconds - blocks: - - coal_ore - - iron_ore - - copper_ore - - gold_ore - - redstone_ore - - lapis_ore - - ancient_debris - - diamond_ore - - emerald_ore - - deepslate_emerald_ore - - nether_gold_ore - - deepslate_gold_ore - - deepslate_diamond_ore - - deepslate_redstone_ore - - deepslate_iron_ore - - deepslate_coal_ore - - deepslate_lapis_ore - - deepslate_copper_ore - blocks-per-level: 3 # Blocks on all sides to scan per level - ticks: 60 - color-glow: true # Color ore glow based on ore type. diff --git a/eco-extensions/xray/src/main/resources/extension.yml b/eco-extensions/xray/src/main/resources/extension.yml deleted file mode 100644 index edc3ce04..00000000 --- a/eco-extensions/xray/src/main/resources/extension.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: Xray -main: com.willfp.ecoenchants.xray.XrayMain -version: ${projectVersion} -author: Auxilor \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index d1ee6a5b..11ba395b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ #libreforge-updater -#Mon Aug 29 10:58:45 BST 2022 -version=8.111.0 +#Mon Aug 29 16:15:50 BST 2022 +version=9.0.0 plugin-name=EcoEnchants diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661e..e750102e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/bin/sh +#!/usr/bin/env sh # -# Copyright © 2015-2021 the original authors. +# Copyright 2015 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,101 +17,67 @@ # ############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# +## +## Gradle start up script for UN*X +## ############################################################################## # Attempt to set APP_HOME - # Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} +APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum +MAX_FD="maximum" warn () { echo "$*" -} >&2 +} die () { echo echo "$*" echo exit 1 -} >&2 +} # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -121,9 +87,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java + JAVACMD="$JAVA_HOME/jre/sh/java" else - JAVACMD=$JAVA_HOME/bin/java + JAVACMD="$JAVA_HOME/bin/java" fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -132,7 +98,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD=java + JAVACMD="java" which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -140,95 +106,80 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi fi -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi # For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=$( cygpath --unix "$JAVACMD" ) + JAVACMD=`cygpath --unix "$JAVACMD"` - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" exec "$JAVACMD" "$@" diff --git a/lib/LumineUtils-1.16.1-20201105.000306-31.jar b/lib/LumineUtils-1.16.1-20201105.000306-31.jar deleted file mode 100644 index 5873432a..00000000 Binary files a/lib/LumineUtils-1.16.1-20201105.000306-31.jar and /dev/null differ diff --git a/settings.gradle b/settings.gradle index 23a9dd99..926a4bfb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,31 +2,4 @@ rootProject.name = 'EcoEnchants' // Core include ':eco-core' -include ':eco-core:core-nms' -include ':eco-core:core-nms:v1_17_R1' -include ':eco-core:core-nms:v1_18_R1' -include ':eco-core:core-nms:v1_18_R2' -include ':eco-core:core-nms:v1_19_R1' -include ':eco-core:core-proxy' -include ':eco-core:core-plugin' -include ':eco-core:core-stub' - -// Extensions -include ':eco-extensions' -include ':eco-extensions:alchemy' -include ':eco-extensions:autosell' -include ':eco-extensions:biomes' -include ':eco-extensions:citizen' -include ':eco-extensions:countereffects' -include ':eco-extensions:effects' -include ':eco-extensions:endershot' -include ':eco-extensions:firewand' -include ':eco-extensions:intimidation' -//include ':eco-extensions:mmo' -include ':eco-extensions:precision' -include ':eco-extensions:rainbow' -include ':eco-extensions:sprint-artifacts' -include ':eco-extensions:softtouch' -include ':eco-extensions:summoning' -include ':eco-extensions:transmission' -include ':eco-extensions:xray' \ No newline at end of file +include ':eco-core:core-plugin' \ No newline at end of file