commit 06c9c36610f88d4c7f52098680cfea51aba1867f Author: Auxilor Date: Thu Dec 1 12:38:42 2022 +0000 Initial commit diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ecd49b8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Auxilor Community Discord + url: https://discord.gg/ZcwpSsE/ + about: Join the Auxilor discord to get help from support staff and the general community! + - name: The most common issues people have + url: https://github.com/Auxilor/eco/issues/78 + about: Check the list of known common issues to see if your issue has already been solved diff --git a/.github/ISSUE_TEMPLATE/report-a-bug.md b/.github/ISSUE_TEMPLATE/report-a-bug.md new file mode 100644 index 0000000..cfe0af0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/report-a-bug.md @@ -0,0 +1,31 @@ +--- +name: Report a Bug +about: Report an issue with the plugin +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Server Information (please complete the following information):** +- Version: (output of `/ver` command) +- Version of plugin and eco (`/ver eco`, `/ver `) + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/request-a-feature.md b/.github/ISSUE_TEMPLATE/request-a-feature.md new file mode 100644 index 0000000..c53e2c5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-a-feature.md @@ -0,0 +1,20 @@ +--- +name: Request a Feature +about: Suggest an idea for this plugin +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8eddf6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Java +*.class + +# Eclipse IDE +.settings/ +bin/ +.classpath +.project + +# IntelliJ IDEA +.idea/ +*.iml + +# Gradle +.gradle +**/build/ +!src/**/build/ +.gradletasknamecache +!gradle-wrapper.jar +gradle-app.setting + +# Mac OSX +.DS_Store \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6b111d1 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e27b3d3 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +

+
+ EcoShop logo +
+

+ +

Source code for EcoShop, a premium spigot plugin.

+ +

+ + spigot + + + + + + + + + + +

+ +[![Docs](https://i.imgur.com/rntg2XP.png)](https://plugins.auxilor.io/ecoshop) + +## License +*Click here to read [the entire license](https://github.com/Auxilor/EcoShop/blob/master/LICENSE.md).* + +

+
+ + supps banner + + + dedimc banner + +
+

diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..e1241c6 --- /dev/null +++ b/build.gradle @@ -0,0 +1,108 @@ +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' +} + +dependencies { + implementation project(":eco-core").getSubprojects() +} + +allprojects { + apply plugin: 'kotlin' + apply plugin: 'java' + apply plugin: 'maven-publish' + apply plugin: 'com.github.johnrengelman.shadow' + + repositories { + mavenCentral() + mavenLocal() + maven { url 'https://jitpack.io' } + maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } + } + + jar { + onlyIf { !sourceSets.main.allSource.files.isEmpty() } + } + + shadowJar { + relocate('com.willfp.ecomponent', 'com.willfp.ecoshop.ecomponent') + } + + dependencies { + compileOnly 'com.willfp:eco:6.47.0' + implementation 'com.willfp:ecomponent:1.3.0' + compileOnly 'com.github.ben-manes.caffeine:caffeine:3.0.6' + + compileOnly 'org.jetbrains:annotations:23.0.0' + compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:1.7.10' + } + + tasks.withType(JavaCompile) { + options.deprecation = true + options.encoding = 'UTF-8' + } + + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + jvmTarget = "17" + } + } + + processResources { + filesMatching(["**plugin.yml"]) { + expand projectVersion: project.version + } + } + + compileJava.options.encoding = 'UTF-8' + compileJava.dependsOn clean +} + +tasks.withType(Jar) { + destinationDirectory = file("$rootDir/bin/") +} + +clean.doLast { + file("${rootDir}/bin").deleteDir() +} + +shadowJar { + archiveFileName = findProperty("plugin-name") + " v" + findProperty("version") + ".jar" +} + +jar { + archiveFileName = findProperty("plugin-name") + " v" + findProperty("version") + " " + "unshaded" + ".jar" +} + +group = 'com.willfp' +archivesBaseName = project.name +version = findProperty("version") +java.sourceCompatibility = JavaVersion.VERSION_17 + +compileJava.options.encoding = 'UTF-8' + +build.dependsOn shadowJar + +tasks.register('buyThePlugins') { + dependsOn subprojects.build + + doLast { + println 'If you like the plugin, please consider buying it on Spigot or Polymart!' + println 'Spigot: https://www.spigotmc.org/resources/authors/auxilor.507394/' + println 'Polymart: https://polymart.org/user/auxilor.1107/' + println 'Buying gives you access to support and the plugin auto-updater, and it allows me to keep developing plugins.' + } +} +build.finalizedBy buyThePlugins \ No newline at end of file diff --git a/eco-core/build.gradle b/eco-core/build.gradle new file mode 100644 index 0000000..50f9ee4 --- /dev/null +++ b/eco-core/build.gradle @@ -0,0 +1,2 @@ +group 'com.willfp' +version rootProject.version \ No newline at end of file diff --git a/eco-core/core-plugin/build.gradle b/eco-core/core-plugin/build.gradle new file mode 100644 index 0000000..dcbc8e7 --- /dev/null +++ b/eco-core/core-plugin/build.gradle @@ -0,0 +1,7 @@ +group 'com.willfp' +version rootProject.version + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.19.1-R0.1-SNAPSHOT' + compileOnly fileTree(dir: '../../lib', include: ['*.jar']) +} \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/EcoShopPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/EcoShopPlugin.kt new file mode 100644 index 0000000..e47bc00 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/EcoShopPlugin.kt @@ -0,0 +1,96 @@ +package com.willfp.ecoshop + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.eco.core.config.ConfigType +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.config.readConfig +import com.willfp.eco.core.integrations.shop.ShopManager +import com.willfp.ecoshop.commands.CommandEcoShop +import com.willfp.ecoshop.commands.CommandSell +import com.willfp.ecoshop.config.UsermadeConfig +import com.willfp.ecoshop.integration.EcoShopAdapter +import org.bukkit.event.Listener +import java.io.File +import java.util.zip.ZipFile + +class EcoShopPlugin : EcoPlugin() { + init { + instance = this + + ShopManager.register(EcoShopAdapter) + } + + override fun handleEnable() { + copyConfigs("categories") + copyConfigs("shops") + } + + private fun copyConfigs(directory: String) { + val folder = File(this.dataFolder, directory) + if (!folder.exists()) { + val files = mutableListOf() + + try { + for (entry in ZipFile(this.file).entries().asIterator()) { + if (entry.name.startsWith("$directory/")) { + files.add(entry.name.removePrefix("$directory/")) + } + } + } catch (_: Exception) { + // Sometimes, ZipFile likes to completely fail. No idea why, but here's the 'solution'! + } + + files.removeIf { !it.endsWith(".yml") } + files.replaceAll { it.replace(".yml", "") } + + for (configName in files) { + UsermadeConfig(configName, directory, this) + } + } + } + + fun getConfigs(directory: String): Map { + val configs = mutableMapOf() + + for (file in File(this.dataFolder, directory).walk()) { + if (file.nameWithoutExtension == "_example") { + continue + } + + if (!file.name.endsWith(".yml")) { + continue + } + + + val id = file.nameWithoutExtension + val config = file.readConfig(ConfigType.YAML) + configs[id] = config + } + + return configs + } + + override fun loadListeners(): List { + return listOf( + + ) + } + + override fun loadPluginCommands(): List { + return listOf( + CommandEcoShop(this), + CommandSell(this) + ) + } + + override fun getMinimumEcoVersion(): String { + return "6.47.0" + } + + companion object { + /** Instance of the plugin. */ + lateinit var instance: EcoShopPlugin + private set + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandEcoShop.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandEcoShop.kt new file mode 100644 index 0000000..9f25668 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandEcoShop.kt @@ -0,0 +1,21 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import org.bukkit.command.CommandSender + +class CommandEcoShop(plugin: EcoPlugin) : PluginCommand( + plugin, + "ecoshop", + "ecoshop.command.ecoshop", + false +) { + init { + this.addSubcommand(CommandReload(plugin)) + .addSubcommand(CommandResetBuys(plugin)) + } + + override fun onExecute(sender: CommandSender, args: List) { + sender.sendMessage(plugin.langYml.getMessage("invalid-command")) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandReload.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandReload.kt new file mode 100644 index 0000000..8e8c29a --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandReload.kt @@ -0,0 +1,21 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.Subcommand +import com.willfp.eco.util.NumberUtils +import com.willfp.eco.util.StringUtils +import org.bukkit.command.CommandSender + +class CommandReload(plugin: EcoPlugin) : Subcommand( + plugin, + "reload", + "ecoshop.command.reload", + false +) { + override fun onExecute(sender: CommandSender, args: List) { + sender.sendMessage( + plugin.langYml.getMessage("reloaded", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS) + .replace("%time%", NumberUtils.format(plugin.reloadWithTime().toDouble())) + ) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandResetBuys.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandResetBuys.kt new file mode 100644 index 0000000..1621df5 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandResetBuys.kt @@ -0,0 +1,78 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.Subcommand +import com.willfp.eco.util.StringUtils +import com.willfp.eco.util.savedDisplayName +import com.willfp.ecoshop.shop.ShopItems +import org.bukkit.Bukkit +import org.bukkit.command.CommandSender +import org.bukkit.util.StringUtil + +class CommandResetBuys(plugin: EcoPlugin) : Subcommand( + plugin, + "resetbuys", + "ecoshop.command.resetbuys", + false +) { + override fun onExecute(sender: CommandSender, args: List) { + if (args.isEmpty()) { + sender.sendMessage(plugin.langYml.getMessage("must-specify-player")) + return + } + + @Suppress("DEPRECATION") + val player = Bukkit.getOfflinePlayer(args[0]) + + if (!player.hasPlayedBefore() && !player.isOnline) { + sender.sendMessage(plugin.langYml.getMessage("invalid-player")) + return + } + + if (args.size == 1) { + sender.sendMessage(plugin.langYml.getMessage("must-specify-item")) + return + } + + val item = ShopItems.getByID(args[1]) + + if (item == null) { + sender.sendMessage(plugin.langYml.getMessage("invalid-item")) + return + } + + item.resetTimesBought(player) + + sender.sendMessage( + plugin.langYml.getMessage("reset-buys", StringUtils.FormatOption.WITHOUT_PLACEHOLDERS) + .replace("%player%", player.savedDisplayName) + .replace("%item%", item.displayName) + ) + } + + override fun tabComplete(sender: CommandSender, args: List): List { + val completions = mutableListOf() + + if (args.isEmpty()) { + return Bukkit.getOnlinePlayers().map { it.name } + } + + if (args.size == 1) { + StringUtil.copyPartialMatches( + args[0], + Bukkit.getOnlinePlayers().map { it.name }, + completions + ) + } + + if (args.size == 2) { + StringUtil.copyPartialMatches( + args[1], + ShopItems.values().map { it.id }, + completions + ) + } + + return completions + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSell.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSell.kt new file mode 100644 index 0000000..55046f1 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSell.kt @@ -0,0 +1,27 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.ecoshop.shop.gui.SellGUI +import org.bukkit.entity.Player + +class CommandSell(plugin: EcoPlugin) : PluginCommand( + plugin, + "sell", + "ecoshop.command.sell", + true +) { + init { + this.addSubcommand(CommandSellHand(plugin)) + .addSubcommand(CommandSellHandall(plugin)) + .addSubcommand(CommandSellAll(plugin)) + } + + override fun onExecute(player: Player, args: List) { + if (args.isEmpty()) { + SellGUI.open(player) + } else { + player.sendMessage(plugin.langYml.getMessage("invalid-sell-type")) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellAll.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellAll.kt new file mode 100644 index 0000000..9694f22 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellAll.kt @@ -0,0 +1,30 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.ecoshop.shop.sell +import org.bukkit.entity.Player + +class CommandSellAll(plugin: EcoPlugin) : PluginCommand( + plugin, + "all", + "ecoshop.command.sell.all", + true +) { + override fun onExecute(player: Player, args: List) { + var didSell = false + + for (i in 0..35) { + val itemStack = player.inventory.getItem(i) + + if (itemStack?.sell(player) == true) { + didSell = true + player.inventory.clear(i) + } + } + + if (!didSell) { + player.sendMessage(plugin.langYml.getMessage("no-sellable")) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellHand.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellHand.kt new file mode 100644 index 0000000..5aba5f7 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellHand.kt @@ -0,0 +1,21 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.ecoshop.shop.sell +import org.bukkit.entity.Player + +class CommandSellHand(plugin: EcoPlugin) : PluginCommand( + plugin, + "hand", + "ecoshop.command.sell.hand", + true +) { + override fun onExecute(player: Player, args: List) { + val item = player.inventory.itemInMainHand + + if (!item.sell(player)) { + player.sendMessage(plugin.langYml.getMessage("not-sellable")) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellHandall.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellHandall.kt new file mode 100644 index 0000000..c06d155 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandSellHandall.kt @@ -0,0 +1,38 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.ecoshop.shop.sell +import com.willfp.ecoshop.shop.shopItem +import org.bukkit.entity.Player + +class CommandSellHandall(plugin: EcoPlugin) : PluginCommand( + plugin, + "handall", + "ecoshop.command.sell.handall", + true +) { + override fun onExecute(player: Player, args: List) { + val test = player.inventory.itemInMainHand.shopItem?.item + + if (test == null) { + player.sendMessage(plugin.langYml.getMessage("not-sellable")) + return + } + + for (i in 0..35) { + val itemStack = player.inventory.getItem(i) + + if (!test.matches(itemStack) || itemStack == null) { + continue + } + + if (!itemStack.sell(player)) { + player.sendMessage("not-sellable") + return + } else { + player.inventory.clear(i) + } + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandShop.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandShop.kt new file mode 100644 index 0000000..4dad104 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/commands/CommandShop.kt @@ -0,0 +1,31 @@ +package com.willfp.ecoshop.commands + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.command.impl.PluginCommand +import com.willfp.ecoshop.shop.Shop +import com.willfp.ecoshop.shop.ShopCategories +import org.bukkit.command.CommandSender +import org.bukkit.entity.Player + +class CommandShop( + private val shop: Shop, + plugin: EcoPlugin +) : PluginCommand( + plugin, + shop.commandName, + "ecoshop.open.${shop.id}", + true +) { + override fun onExecute(player: Player, args: List) { + if (shop.menu != null) { + shop.menu.open(player) + } else { + if (shop.directCategory == null) { + player.sendMessage(plugin.langYml.getMessage("invalid-shop-config").replace("%shop%", shop.id)) + return + } + + shop.directCategory?.openDirect(player, shop) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/config/UsermadeConfig.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/config/UsermadeConfig.kt new file mode 100644 index 0000000..7fa7f80 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/config/UsermadeConfig.kt @@ -0,0 +1,14 @@ +package com.willfp.ecoshop.config + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.config.ConfigType +import com.willfp.eco.core.config.ExtendableConfig + +class UsermadeConfig(name: String, directory: String, plugin: EcoPlugin) : ExtendableConfig( + name, + true, + plugin, + plugin::class.java, + "$directory/", + ConfigType.YAML +) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/event/EcoShopSellEvent.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/event/EcoShopSellEvent.kt new file mode 100644 index 0000000..f6b479a --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/event/EcoShopSellEvent.kt @@ -0,0 +1,32 @@ +package com.willfp.ecoshop.event + +import com.willfp.eco.core.price.Price +import com.willfp.ecoshop.shop.ShopItem +import org.bukkit.entity.Player +import org.bukkit.event.HandlerList +import org.bukkit.event.player.PlayerEvent +import org.bukkit.inventory.ItemStack + +class EcoShopSellEvent @JvmOverloads constructor( + who: Player, + val shopItem: ShopItem, + var price: Price, + val item: ItemStack, + var multiplier: Double = 1.0 +) : PlayerEvent(who) { + + // Below here is bukkit boilerplate + override fun getHandlers(): HandlerList { + return HANDLERS + } + + companion object { + @JvmStatic + private val HANDLERS: HandlerList = HandlerList() + + @JvmStatic + fun getHandlerList(): HandlerList { + return HANDLERS + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/integration/EcoShopAdapter.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/integration/EcoShopAdapter.kt new file mode 100644 index 0000000..7c1c430 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/integration/EcoShopAdapter.kt @@ -0,0 +1,40 @@ +package com.willfp.ecoshop.integration + +import com.willfp.eco.core.integrations.shop.ShopIntegration +import com.willfp.eco.core.integrations.shop.ShopSellEvent +import com.willfp.eco.core.price.Price +import com.willfp.ecoshop.event.EcoShopSellEvent +import com.willfp.ecoshop.shop.getUnitSellValue +import com.willfp.ecoshop.shop.isSellable +import org.bukkit.Bukkit +import org.bukkit.entity.Player +import org.bukkit.event.EventHandler +import org.bukkit.event.Listener +import org.bukkit.inventory.ItemStack + +object EcoShopAdapter : ShopIntegration { + override fun getUnitValue(itemStack: ItemStack, player: Player): Price { + return itemStack.getUnitSellValue(player) + } + + override fun getSellEventAdapter(): Listener { + return SellEventAdapter + } + + override fun isSellable(itemStack: ItemStack, player: Player): Boolean { + return itemStack.isSellable(player) + } + + override fun getPluginName() = "EcoShop" + + private object SellEventAdapter : Listener { + @EventHandler + fun adaptShopSellEvent(event: EcoShopSellEvent) { + val ecoEvent = ShopSellEvent(event.player, event.price, event.item) + Bukkit.getPluginManager().callEvent(ecoEvent) + + event.multiplier = ecoEvent.multiplier + event.price = ecoEvent.value + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/InvalidShopItemException.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/InvalidShopItemException.kt new file mode 100644 index 0000000..1b7cb87 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/InvalidShopItemException.kt @@ -0,0 +1,5 @@ +package com.willfp.ecoshop.shop + +class InvalidShopItemException( + override val message: String +) : RuntimeException() diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Shop.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Shop.kt new file mode 100644 index 0000000..47b11e3 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Shop.kt @@ -0,0 +1,158 @@ +package com.willfp.ecoshop.shop + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.gui.addPage +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.menu.MenuLayer +import com.willfp.eco.core.gui.page.PageChanger +import com.willfp.eco.core.gui.slot.ConfigSlot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.sound.PlayableSound +import com.willfp.eco.util.formatEco +import com.willfp.eco.util.savedDisplayName +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.commands.CommandShop +import org.bukkit.Bukkit +import org.bukkit.entity.Player + +fun Config.ifHasOrNull(key: String, block: (String) -> T): T? = + if (this.has(key)) block(key) else null + +fun Menu.openWithParentShop(player: Player, from: Menu) { + val parent = from.parentShop[player] + this.open(player) + this.parentShop[player] = parent +} + +fun Menu.openAndStack(player: Player, from: Menu) { + val parent = from.parentShop[player] + this.open(player) + this.previousMenus[player] += from + this.parentShop[player] = parent +} + +fun Menu.kickBack(player: Player) = + this.previousMenus[player].popOrNull()?.openWithParentShop(player, this) ?: player.closeInventory() + +class Shop( + val plugin: EcoShopPlugin, + val id: String, + val config: Config +) { + val clickSound = config.ifHasOrNull("click-sound") { + PlayableSound.create(config.getSubsection(it)) + } + + val buySound = config.ifHasOrNull("buy-sound") { + PlayableSound.create(config.getSubsection(it)) + } + + val sellSound = config.ifHasOrNull("sell-sound") { + PlayableSound.create(config.getSubsection(it)) + } + + private val broadcastSound = config.ifHasOrNull("buy-broadcasts.sound") { + PlayableSound.create(config.getSubsection(it)) + } + + val isBroadcasting = config.getBool("buy-broadcasts.enabled") + + val commandName = config.getString("command") + + val directCategory: ShopCategory? + get() = ShopCategories.getByID(config.getString("direct-category")) + + val menu = if (config.has("pages")) menu(config.getInt("rows")) { + title = config.getFormattedString("title") + + allowChangingHeldItem() + + val pages = config.getSubsections("pages") + + maxPages(pages.size) + + val forwardsArrow = PageChanger( + Items.lookup(config.getString("forwards-arrow.item")).item, + PageChanger.Direction.FORWARDS + ) + + val backwardsArrow = PageChanger( + Items.lookup(config.getString("backwards-arrow.item")).item, + PageChanger.Direction.BACKWARDS + ) + + addComponent( + MenuLayer.TOP, + config.getInt("forwards-arrow.row"), + config.getInt("forwards-arrow.column"), + forwardsArrow + ) + + addComponent( + MenuLayer.TOP, + config.getInt("backwards-arrow.row"), + config.getInt("backwards-arrow.column"), + backwardsArrow + ) + + for (pageConfig in pages) { + val pageNumber = pageConfig.getInt("page") + + addPage(pageNumber) { + setMask( + FillerMask( + MaskItems.fromItemNames(pageConfig.getStrings("mask.items")), + *pageConfig.getStrings("mask.pattern").toTypedArray() + ) + ) + + for (config in pageConfig.getSubsections("categories")) { + val category = ShopCategories.getByID(config.getString("id")) ?: continue + + setSlot( + config.getInt("row"), + config.getInt("column"), + category.slot + ) + } + + for (config in pageConfig.getSubsections("custom-slots")) { + setSlot( + config.getInt("row"), + config.getInt("column"), + ConfigSlot(config) + ) + } + } + } + + onOpen { player, menu -> menu.parentShop[player] = this@Shop } + } else null + + val command = CommandShop(this, plugin) + + fun broadcastPurchase(player: Player, item: ShopItem, amount: Int) { + Bukkit.broadcastMessage( + config.getString("buy-broadcasts.message") + .replace("%player%", player.savedDisplayName) + .replace("%item%", item.displayName) + .replace("%amount%", amount.toString()) + .formatEco(player) + ) + + for (p in Bukkit.getOnlinePlayers()) { + broadcastSound?.playTo(p) + } + } + + init { + command.register() + } + + fun remove() { + command.unregister() + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopCategories.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopCategories.kt new file mode 100644 index 0000000..0e6fda0 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopCategories.kt @@ -0,0 +1,37 @@ +package com.willfp.ecoshop.shop + +import com.google.common.collect.HashBiMap +import com.google.common.collect.ImmutableList +import com.willfp.ecoshop.EcoShopPlugin + +@Suppress("UNUSED") +object ShopCategories { + private val BY_ID = HashBiMap.create() + + /** + * Get category matching id. + * + * @param id The id to query. + * @return The matching category, or null if not found. + */ + @JvmStatic + fun getByID(id: String): ShopCategory? { + return BY_ID[id] + } + + /** All shop categories. */ + @JvmStatic + fun values(): List { + return ImmutableList.copyOf(BY_ID.values) + } + + @JvmStatic + internal fun update(plugin: EcoShopPlugin) { + ShopItems.clear() + BY_ID.clear() + + for ((id, config) in plugin.getConfigs("categories")) { + BY_ID[id] = ShopCategory(plugin, id, config) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopCategory.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopCategory.kt new file mode 100644 index 0000000..7344660 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopCategory.kt @@ -0,0 +1,133 @@ +package com.willfp.ecoshop.shop + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.gui.addPage +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.menu.MenuLayer +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.page.PageChanger +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.ConfigSlot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.gui.slot.Slot +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.builder.modify +import com.willfp.ecomponent.components.pageChangerWithDefault +import com.willfp.ecomponent.menuStateVar +import com.willfp.ecoshop.EcoShopPlugin +import org.bukkit.entity.Player +import java.util.Stack + +// Menu state keys +val Menu.previousMenus by menuStateVar>("previous-menu", Stack()) +val Menu.parentShop by menuStateVar("parent-shop") + +fun Stack.popOrNull(): T? = + if (this.empty()) null else this.pop() + +class ShopCategory( + val plugin: EcoShopPlugin, + val id: String, + val config: Config +) { + val items = config.getSubsections("items").mapNotNull { + try { + val item = ShopItem(plugin, it) + ShopItems.addNewItem(item) + item + } catch (e: InvalidShopItemException) { + plugin.logger.warning(e.message) + null + } + } + + val slot: Slot = slot(Items.lookup(config.getString("item")).modify { + addLoreLines(config.getStrings("lore")) + }) { + onLeftClick { player, _, _, previousMenu -> + // Previous for category should be shop + + val parent = previousMenu.parentShop[player] + + parent?.clickSound?.playTo(player) + + menu.openAndStack(player, previousMenu) + } + } + + private val menu: Menu = menu(config.getInt("gui.rows")) { + title = config.getFormattedString("gui.title") + + allowChangingHeldItem() + + val pages = config.getSubsections("gui.pages") + + maxPages(pages.size) + + val forwardsArrow = PageChanger( + Items.lookup(config.getString("gui.forwards-arrow.item")).item, + PageChanger.Direction.FORWARDS + ) + + val backwardsArrow = pageChangerWithDefault( + Items.lookup(config.getString("gui.backwards-arrow.item")).item, + PageChanger.Direction.BACKWARDS + ) { player, _, _, menu -> + menu.kickBack(player) + } + + addComponent( + MenuLayer.TOP, + config.getInt("gui.forwards-arrow.row"), + config.getInt("gui.forwards-arrow.column"), + forwardsArrow + ) + + addComponent( + MenuLayer.TOP, + config.getInt("gui.backwards-arrow.row"), + config.getInt("gui.backwards-arrow.column"), + backwardsArrow + ) + + for (pageConfig in pages) { + val pageNumber = pageConfig.getInt("page") + + addPage(pageNumber) { + setMask( + FillerMask( + MaskItems.fromItemNames(pageConfig.getStrings("mask.items")), + *pageConfig.getStrings("mask.pattern").toTypedArray() + ) + ) + + for (item in items) { + if (item.page != pageNumber) { + continue + } + + setSlot( + item.row, + item.column, + item.slot + ) + } + + for (config in pageConfig.getSubsections("custom-slots")) { + setSlot( + config.getInt("row"), + config.getInt("column"), + ConfigSlot(config) + ) + } + } + } + } + + fun openDirect(player: Player, shop: Shop) { + menu.open(player) + menu.parentShop[player] = shop + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopItem.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopItem.kt new file mode 100644 index 0000000..6243a06 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopItem.kt @@ -0,0 +1,480 @@ +@file:JvmName("ShopItemUtils") + +package com.willfp.ecoshop.shop + +import com.github.benmanes.caffeine.cache.Caffeine +import com.willfp.eco.core.config.interfaces.Config +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.core.drops.DropQueue +import com.willfp.eco.core.fast.fast +import com.willfp.eco.core.items.HashedItem +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.builder.ItemStackBuilder +import com.willfp.eco.core.price.ConfiguredPrice +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.event.EcoShopSellEvent +import com.willfp.ecoshop.shop.gui.BuyMenu +import com.willfp.ecoshop.shop.gui.SellMenu +import com.willfp.ecoshop.shop.gui.ShopItemSlot +import org.bukkit.Bukkit +import org.bukkit.Material +import org.bukkit.OfflinePlayer +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack +import org.bukkit.permissions.Permission +import org.bukkit.permissions.PermissionDefault +import java.util.Optional +import java.util.concurrent.TimeUnit + +enum class BuyType { + NORMAL, + ALT +} + +class ShopItem( + plugin: EcoShopPlugin, + val config: Config +) { + val id = config.getString("id") + + val commands = config.getStringsOrNull("command") + + val item = if (config.has("item")) Items.lookup(config.getString("item")) else null + + val buyAmount = config.getIntOrNull("buy.amount") ?: 1 + + private val _displayItem = ItemStackBuilder( + if (config.has("gui.display.item")) { + Items.lookup("gui.display.item").item + } else item?.item ?: ItemStack(Material.AIR) + ) + .setAmount(buyAmount) + .addLoreLines(config.getStrings("gui.display.lore")) + .build() + + val displayItem: ItemStack + get() = this._displayItem.clone() + + // Formatted on render for placeholder support. + val bottomLore = config.getStrings("gui.display.bottom-lore") + + private val _displayName = config.getFormattedStringOrNull("name") + + val displayName: String + get() = _displayName ?: this.displayItem.fast().displayName + + val row = config.getInt("gui.row") + + val column = config.getInt("gui.column") + + val page = config.getInt("gui.page") + + val isBuyable = config.has("buy") + + val isSellable = config.has("sell") + + val hasAltBuy = config.has("alt-buy") + + val buyPrice = ConfiguredPrice.create(config.getSubsection("buy")) + + val altBuyPrice = ConfiguredPrice.create(config.getSubsection("alt-buy")) + + val sellPrice = ConfiguredPrice.create(config.getSubsection("sell")) + + val slot = ShopItemSlot(this, plugin) + + val isShowingQuickBuySell = config.getBoolOrNull("gui.show-quick-buy-sell") ?: true + + private val buyMenus = BuyType.values().associateWith { BuyMenu(this, plugin, it) } + + val sellMenu = SellMenu(this, plugin) + + private val limit = config.getIntOrNull("buy.limit") ?: Int.MAX_VALUE + + private val maxAtOnce = config.getIntOrNull("buy.max-at-once") ?: Int.MAX_VALUE + + private val timesBoughtKey = PersistentDataKey( + plugin.createNamespacedKey("${id}_times_bought"), + PersistentDataKeyType.INT, + 0 + ) + + init { + if (this.item != null && this.item.item.amount != 1) { + throw InvalidShopItemException( + "Item $id is buying/selling an item " + + "with a stack size greater than 1. If you want to sell" + + "more than one item at a time, use the buy amount amount option." + ) + } + + if (this.hasAltBuy) { + if (this.isSellable) { + throw InvalidShopItemException( + "Item $id cannot be both alt-buyable and sellable!" + ) + } + + if (!this.isBuyable) { + throw InvalidShopItemException( + "Item $id must be buyable in order to be alt buyable!" + ) + } + } + + if (Bukkit.getPluginManager().getPermission("ecoshop.buy.$id") == null) { + val permission = Permission( + "ecoshop.buy.$id", + "Allows buying $id", + PermissionDefault.TRUE + ) + + if (Bukkit.getPluginManager().getPermission("ecoshop.buy.*") == null) { + Bukkit.getPluginManager().addPermission( + Permission( + "ecoshop.buy.*", + "Allows buying all items from shops", + PermissionDefault.TRUE + ) + ) + } + + permission.addParent( + Bukkit.getPluginManager().getPermission("ecoshop.buy.*")!!, + true + ) + + Bukkit.getPluginManager().addPermission(permission) + } + + if (Bukkit.getPluginManager().getPermission("ecoshop.sell.$id") == null) { + val permission = Permission( + "ecoshop.sell.$id", + "Allows selling $id", + PermissionDefault.TRUE + ) + + if (Bukkit.getPluginManager().getPermission("ecoshop.sell.*") == null) { + Bukkit.getPluginManager().addPermission( + Permission( + "ecoshop.sell.*", + "Allows selling all items to shops", + PermissionDefault.TRUE + ) + ) + } + + permission.addParent( + Bukkit.getPluginManager().getPermission("ecoshop.sell.*")!!, + true + ) + + Bukkit.getPluginManager().addPermission(permission) + } + } + + /** Get the max amount of times this item can be bought at a single time. */ + fun getMaxBuysAtOnce(player: Player): Int { + return maxAtOnce.coerceAtMost(getBuysLeft(player)) + } + + /** Get the max amount of times this player can buy this item again. */ + fun getBuysLeft(player: Player): Int { + return limit - player.profile.read(timesBoughtKey) + } + + /** If a [player] is allowed to purchase this item. */ + fun getBuyStatus(player: Player, amount: Int, buyType: BuyType): BuyStatus { + when (buyType) { + BuyType.NORMAL -> buyPrice ?: return BuyStatus.CANNOT_BUY + BuyType.ALT -> altBuyPrice ?: return BuyStatus.CANNOT_BUY + } + + if (player.profile.read(timesBoughtKey) + amount > limit) { + return BuyStatus.BOUGHT_TOO_MANY + } + + if (!player.hasPermission("ecoshop.buy.$id")) { + return BuyStatus.NO_PERMISSION + } + + if (config.has("buy.require")) { + if (config.getDoubleFromExpression("buy.require", player) != 1.0) { + return BuyStatus.MISSING_REQUIREMENTS + } + } + + if (!getBuyPrice(buyType)!!.canAfford(player, amount.toDouble())) { + return BuyStatus.CANNOT_AFFORD + } + + return BuyStatus.ALLOW + } + + /** + * Make a [player] buy this item a certain [amount] of times. + * + * This handles payment and dispatching the items / commands. + */ + fun buy( + player: Player, + amount: Int, + buyType: BuyType, + shop: Shop? = null + ) { + require(amount in 1..getMaxBuysAtOnce(player)) + + when (buyType) { + BuyType.NORMAL -> buyPrice?.pay(player, amount.toDouble()) + BuyType.ALT -> altBuyPrice?.pay(player, amount.toDouble()) + } + + if (item != null) { + val queue = DropQueue(player) + .forceTelekinesis() + + repeat(amount) { + queue.addItem(item.item) + } + + queue.push() + } + + if (commands != null) { + for (command in commands) { + Bukkit.dispatchCommand( + Bukkit.getConsoleSender(), + command.replace("%player%", player.name) + .replace("%amount%", amount.toString()) + ) + } + } + + player.profile.write(timesBoughtKey, player.profile.read(timesBoughtKey) + 1) + + if (shop?.isBroadcasting == true) { + shop.broadcastPurchase(player, this, amount) + } + + shop?.buySound?.playTo(player) + } + + /** Get if a [player] is allowed to sell this item. */ + fun getSellStatus(player: Player): SellStatus { + // Can't sell a command + if (item == null || sellPrice == null) { + return SellStatus.CANNOT_SELL + } + + if (!player.hasPermission("ecoshop.sell.$id")) { + return SellStatus.NO_PERMISSION + } + + if (config.has("sell.require")) { + if (config.getDoubleFromExpression("sell.require", player) != 1.0) { + return SellStatus.MISSING_REQUIREMENTS + } + } + + return SellStatus.ALLOW + } + + /** Get if a [player] is allowed to sell this item. */ + @JvmOverloads + fun getCurrentSellStatus(player: Player, amount: Int? = null): SellStatus { + val base = getSellStatus(player) + + if (base != SellStatus.ALLOW) { + return base + } else { + if (getAmountInPlayerInventory(player) == 0) { + return SellStatus.DONT_HAVE_ITEM + } + + if (amount != null) { + if (getAmountInPlayerInventory(player) < amount) { + return SellStatus.DONT_HAVE_ENOUGH + } + } + + return SellStatus.ALLOW + } + } + + /** + * Make a [player] sell the item up to a certain [amount] of times. + * + * Returns the actual amount of times the item was sold, for example if a + * player doesn't have a certain amount of items it will sell as many as + * possible. + */ + fun sell( + player: Player, + amount: Int, + shop: Shop? = null + ): Int { + if (sellPrice == null) { + return 0 + } + + if (item == null) { + return 0 + } + + val amountSold = amount.coerceAtMost(getAmountInPlayerInventory(player)) + + val priceMultipliers = deductItems(player, amountSold) + for ((multiplier, times) in priceMultipliers) { + sellPrice.giveTo(player, multiplier * times) + } + + shop?.sellSound?.playTo(player) + + return amountSold + } + + fun getAmountInPlayerInventory(player: Player): Int { + if (item == null) { + return 0 + } + + var amountOfItems = 0 + + for (itemStack in player.inventory.storageContents) { + if (!item.matches(itemStack)) { + continue + } + + amountOfItems += itemStack.amount + } + + return amountOfItems + } + + /** + * Deducts items, calls events, and returns a map of how many times each + * multiplier is given. + * + * Map maps multipliers to amounts of times. + */ + private fun deductItems(player: Player, amount: Int): Map { + val multipliers = mutableMapOf() + + var left = amount + + if (item == null) { + return emptyMap() + } + + // Using slots because of some freakish bug that prevented clearing the item? + for (i in 0..35) { + val itemStack = player.inventory.getItem(i) + + if (!item.matches(itemStack) || itemStack == null) { + continue + } + + + val event = EcoShopSellEvent(player, this, this.sellPrice!!, itemStack) + Bukkit.getPluginManager().callEvent(event) + + multipliers[event.multiplier] = (multipliers[event.multiplier] ?: 1) + 1 + + + if (itemStack.amount <= left) { + left -= itemStack.amount + player.inventory.clear(i) + } else { + itemStack.amount -= left + left = 0 + } + + if (left == 0) { + break + } + } + + return multipliers + } + + fun resetTimesBought(player: OfflinePlayer) { + player.profile.write(timesBoughtKey, 0) + } + + fun getBuyPrice(buyType: BuyType) = when (buyType) { + BuyType.ALT -> altBuyPrice + else -> buyPrice + } + + fun getBuyMenu(buyType: BuyType) = buyMenus[buyType]!! +} + +fun ConfiguredPrice?.getDisplay(player: Player, amount: Number): String = + this?.getDisplay(player, amount.toDouble()) ?: "" + +private val itemCache = Caffeine.newBuilder() + .expireAfterAccess(5, TimeUnit.SECONDS) + .build>() + +val ItemStack.shopItem: ShopItem? + get() = itemCache.get(HashedItem.of(this)) { + for (item in ShopItems.values()) { + if (item.item?.matches(this) == true) { + return@get Optional.of(item) + } + } + + Optional.ofNullable(null) + }.orElse(null) + +fun ItemStack.isSellable(player: Player): Boolean { + val item = this.shopItem ?: return false + if (item.getSellStatus(player) != SellStatus.ALLOW) { + return false + } + + return item.sellPrice != null +} + +fun ItemStack.getUnitSellValue(player: Player): ConfiguredPrice { + val item = this.shopItem ?: return ConfiguredPrice.FREE + if (item.getSellStatus(player) != SellStatus.ALLOW) { + return ConfiguredPrice.FREE + } + + return item.sellPrice ?: ConfiguredPrice.FREE +} + +/** Sell the item as a [player] and return if successful. */ +fun ItemStack.sell( + player: Player, + shop: Shop? = null +): Boolean { + if (!this.isSellable(player)) { + return false + } + + val price = this.getUnitSellValue(player) + val item = this.shopItem!! + + val event = EcoShopSellEvent(player, item, item.sellPrice!!, this) + Bukkit.getPluginManager().callEvent(event) + + price.giveTo(player, this.amount.toDouble() * event.multiplier) + + player.sendMessage( + EcoShopPlugin.instance.langYml.getMessage("sold-item") + .replace("%amount%", this.amount.toString()) + .replace("%item%", item.displayName) + .replace("%price%", price.getDisplay(player, this.amount.toDouble() * event.multiplier)) + ) + + shop?.sellSound?.playTo(player) + + this.amount = 0 + this.type = Material.AIR + + return true +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopItems.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopItems.kt new file mode 100644 index 0000000..1575102 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/ShopItems.kt @@ -0,0 +1,36 @@ +package com.willfp.ecoshop.shop + +import com.google.common.collect.HashBiMap +import com.google.common.collect.ImmutableList + +@Suppress("UNUSED") +object ShopItems { + private val BY_ID = HashBiMap.create() + + /** + * Get item matching id. + * + * @param id The id to query. + * @return The matching item, or null if not found. + */ + @JvmStatic + fun getByID(id: String): ShopItem? { + return BY_ID[id] + } + + /** All shop items. */ + @JvmStatic + fun values(): List { + return ImmutableList.copyOf(BY_ID.values) + } + + /** Add a new [item]. */ + fun addNewItem(item: ShopItem) { + BY_ID[item.id] = item + } + + /** Clear registry. */ + internal fun clear() { + BY_ID.clear() + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Shops.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Shops.kt new file mode 100644 index 0000000..a51ceb6 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Shops.kt @@ -0,0 +1,48 @@ +package com.willfp.ecoshop.shop + +import com.google.common.collect.HashBiMap +import com.google.common.collect.ImmutableList +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.ecoshop.EcoShopPlugin + +@Suppress("UNUSED") +object Shops { + private val BY_ID = HashBiMap.create() + + /** + * Get shop matching id. + * + * @param id The id to query. + * @return The matching shop, or null if not found. + */ + @JvmStatic + fun getByID(id: String): Shop? { + return BY_ID[id] + } + + /** + * List of all shops. + * + * @return The shops. + */ + @JvmStatic + fun values(): List { + return ImmutableList.copyOf(BY_ID.values) + } + + @ConfigUpdater + @JvmStatic + fun update(plugin: EcoShopPlugin) { + ShopCategories.update(plugin) + + for (shop in values()) { + shop.remove() + } + + BY_ID.clear() + + for ((id, config) in plugin.getConfigs("shops")) { + BY_ID[id] = Shop(plugin, id, config) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Status.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Status.kt new file mode 100644 index 0000000..2decfe9 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/Status.kt @@ -0,0 +1,24 @@ +package com.willfp.ecoshop.shop + +/** Represents the ability of a player to buy an item. */ +enum class BuyStatus { + CANNOT_BUY, + BOUGHT_TOO_MANY, + NO_PERMISSION, + MISSING_REQUIREMENTS, + CANNOT_AFFORD, + ALLOW +} + +/** Represents the ability of a player to sell an item. */ +enum class SellStatus { + CANNOT_SELL, + NO_PERMISSION, + MISSING_REQUIREMENTS, + DONT_HAVE_ITEM, + DONT_HAVE_ENOUGH, + ALLOW +} + +val > T.configKey: String + get() = this.name.lowercase().replace("_", "-") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/AmountSelector.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/AmountSelector.kt new file mode 100644 index 0000000..6ffe246 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/AmountSelector.kt @@ -0,0 +1,72 @@ +package com.willfp.ecoshop.shop.gui + +import com.willfp.eco.core.config.interfaces.Config +import com.willfp.eco.core.gui.GUIComponent +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.Slot +import com.willfp.eco.core.items.Items +import com.willfp.ecomponent.menuStateVar +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.shop.ShopItem +import com.willfp.ecoshop.shop.parentShop +import org.bukkit.entity.Player +import kotlin.math.min + +val Menu.amountOfItem by menuStateVar(1) + +class AmountAdjustSelector( + private val item: ShopItem, + private val adjust: Int, + config: Config +) : GUIComponent { + private val slot = slot(Items.lookup(config.getString("item"))) { + onLeftClick { player, _, _, menu -> + menu.parentShop[player]?.clickSound?.playTo(player) + menu.amountOfItem[player] += adjust + } + } + + override fun getRows() = 1 + override fun getColumns() = 1 + + override fun getSlotAt(row: Int, column: Int, player: Player, menu: Menu): Slot? { + val currentAmount = menu.amountOfItem[player] + + val adjusted = currentAmount + adjust + + val max = min(item.getMaxBuysAtOnce(player), item.item?.item?.type?.maxStackSize ?: Int.MAX_VALUE) + + return if (adjusted !in 1..max) { + null + } else { + slot + } + } +} + +class AmountSetSelector( + config: Config, + private val amount: (Player) -> Int +) : GUIComponent { + private val slot = slot(Items.lookup(config.getString("item"))) { + onLeftClick { player, _, _, menu -> + menu.parentShop[player]?.clickSound?.playTo(player) + menu.amountOfItem[player] = amount(player) + } + } + + override fun getRows() = 1 + override fun getColumns() = 1 + + override fun getSlotAt(row: Int, column: Int, player: Player, menu: Menu): Slot? { + val currentAmount = menu.amountOfItem[player] + + return if (currentAmount == amount(player)) { + null + } else { + slot + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/BuyMenu.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/BuyMenu.kt new file mode 100644 index 0000000..47e399a --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/BuyMenu.kt @@ -0,0 +1,213 @@ +package com.willfp.ecoshop.shop.gui + +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.ConfigSlot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.builder.modify +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.shop.BuyStatus +import com.willfp.ecoshop.shop.BuyType +import com.willfp.ecoshop.shop.ShopItem +import com.willfp.ecoshop.shop.configKey +import com.willfp.ecoshop.shop.getDisplay +import com.willfp.ecoshop.shop.kickBack +import com.willfp.ecoshop.shop.openAndStack +import com.willfp.ecoshop.shop.parentShop +import org.bukkit.entity.Player +import kotlin.math.min + +class BuyMenu( + val item: ShopItem, + private val plugin: EcoShopPlugin, + private val buyType: BuyType +) { + private val buyMoreMenu = MoreMenu(item, plugin, "buy") { amount, stacks -> + slot({ player, _ -> + item.displayItem + .modify { + setAmount(stacks) + setDisplayName( + plugin.configYml.getString("buy-more.item-name") + .replace("%stacks%", stacks.toString()) + ) + addLoreLines( + plugin.langYml.getStrings("confirm-buy-price") + .replaceIn("%price%", item.getBuyPrice(buyType).getDisplay(player, amount)) + ) + } + }) { + onLeftClick { player, _, _, menu -> + val status = item.getBuyStatus(player, amount, buyType) + + if (status == BuyStatus.ALLOW) { + item.buy( + player, + amount, + buyType, + shop = menu.parentShop[player] + ) + + player.sendMessage( + plugin.langYml.getMessage("bought-item-multiple") + .replace("%amount%", amount.toString()) + .replace("%item%", item.displayName) + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, amount)) + ) + } else { + player.sendMessage( + plugin.langYml.getMessage("buy-status.${status.configKey}") + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, amount)) + ) + } + } + } + } + + private val menu = menu(plugin.configYml.getInt("buy-menu.rows")) { + title = plugin.configYml.getFormattedString("buy-menu.title") + .replace("%item%", item.displayName) + + allowChangingHeldItem() + + setMask( + FillerMask( + MaskItems.fromItemNames( + plugin.configYml.getStrings("buy-menu.mask.items") + ), + *plugin.configYml.getStrings("buy-menu.mask.pattern").toTypedArray() + ) + ) + + setSlot( + plugin.configYml.getInt("buy-menu.item.row"), + plugin.configYml.getInt("buy-menu.item.column"), + slot { player, menu -> + item.displayItem.modify { + val amount = menu.amountOfItem[player] + + setAmount(amount) + addLoreLines( + plugin.langYml.getStrings("confirm-buy-price") + .replaceIn("%price%", item.getBuyPrice(buyType).getDisplay(player, amount)) + ) + } + } + ) + + addComponent( + plugin.configYml.getInt("buy-menu.buy-more.row"), + plugin.configYml.getInt("buy-menu.buy-more.column"), + slot(Items.lookup(plugin.configYml.getString("buy-menu.buy-more.item"))) { + onLeftClick { player, _, _, menu -> + menu.parentShop[player]?.clickSound?.playTo(player) + buyMoreMenu.open(player, menu) + } + } + ) + + for (config in plugin.configYml.getSubsections("buy-menu.add-buttons")) { + addComponent( + config.getInt("row"), + config.getInt("column"), + AmountAdjustSelector( + item, + config.getInt("add"), + config + ) + ) + } + + for (config in plugin.configYml.getSubsections("buy-menu.set-buttons")) { + addComponent( + config.getInt("row"), + config.getInt("column"), + AmountSetSelector( + config + ) { + min( + item.getMaxBuysAtOnce(it), + item.item?.item?.type?.maxStackSize ?: Int.MAX_VALUE + ).coerceAtMost( + min( + 64, + config.getInt("set") + ) + ) + } + ) + } + + setSlot( + plugin.configYml.getInt("buy-menu.cancel.row"), + plugin.configYml.getInt("buy-menu.cancel.column"), + slot(Items.lookup(plugin.configYml.getString("buy-menu.cancel.item"))) { + onLeftClick { player, _, _, menu -> + menu.kickBack(player) + } + } + ) + + setSlot( + plugin.configYml.getInt("buy-menu.confirm.row"), + plugin.configYml.getInt("buy-menu.confirm.column"), + slot({ player, menu -> + Items.lookup(plugin.configYml.getString("buy-menu.confirm.item")).modify { + addLoreLines( + plugin.langYml.getStrings("confirm-buy-price") + .replaceIn("%price%", item.getBuyPrice(buyType).getDisplay(player, menu.amountOfItem[player])) + ) + } + }) { + onLeftClick { player, _, _, menu -> + val amount = menu.amountOfItem[player] + + val status = item.getBuyStatus(player, amount, buyType) + + if (status == BuyStatus.ALLOW) { + item.buy( + player, + amount, + buyType, + menu.parentShop[player] + ) + + player.sendMessage( + plugin.langYml.getMessage("bought-item-multiple") + .replace("%amount%", amount.toString()) + .replace("%item%", item.displayName) + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, amount)) + ) + + menu.kickBack(player) + } else { + player.sendMessage( + plugin.langYml.getMessage("buy-status.${status.configKey}") + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, amount)) + ) + } + } + } + ) + + for (config in plugin.configYml.getSubsections("buy-menu.custom-slots")) { + setSlot( + config.getInt("row"), + config.getInt("column"), + ConfigSlot(config) + ) + } + + onOpen { player, menu -> + menu.amountOfItem[player] = item.buyAmount + } + } + + fun open(player: Player, previousMenu: Menu) { + menu.openAndStack(player, previousMenu) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/MoreMenu.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/MoreMenu.kt new file mode 100644 index 0000000..a5b6fc3 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/MoreMenu.kt @@ -0,0 +1,73 @@ +package com.willfp.ecoshop.shop.gui + +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.ConfigSlot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.gui.slot.Slot +import com.willfp.eco.core.items.Items +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.shop.ShopItem +import com.willfp.ecoshop.shop.kickBack +import com.willfp.ecoshop.shop.openAndStack +import org.bukkit.entity.Player + +/** Key is buy or sell, slot is the actual slot given the amount of stacks. */ +class MoreMenu( + val item: ShopItem, + private val plugin: EcoShopPlugin, + private val key: String, + val slotBuilder: (amount: Int, stacks: Int) -> Slot, +) { + private val menu = menu(plugin.configYml.getInt("$key-more.rows")) { + title = plugin.configYml.getFormattedString("$key-more.title") + .replace("%item%", item.displayName) + + allowChangingHeldItem() + + setMask( + FillerMask( + MaskItems.fromItemNames( + plugin.configYml.getStrings("$key-more.mask.items") + ), + *plugin.configYml.getStrings("$key-more.mask.pattern").toTypedArray() + ) + ) + + for (config in plugin.configYml.getSubsections("$key-more.amounts")) { + val stacks = config.getInt("stacks") + val amount = stacks * (item.item?.item?.maxStackSize ?: 1) + + setSlot( + config.getInt("row"), + config.getInt("column"), + slotBuilder(amount, stacks) + ) + } + + setSlot( + plugin.configYml.getInt("$key-more.back.row"), + plugin.configYml.getInt("$key-more.back.column"), + slot(Items.lookup(plugin.configYml.getString("$key-more.back.item"))) { + onLeftClick { player, _, _, menu -> + menu.kickBack(player) + } + } + ) + + for (config in plugin.configYml.getSubsections("$key-more.custom-slots")) { + setSlot( + config.getInt("row"), + config.getInt("column"), + ConfigSlot(config) + ) + } + } + + fun open(player: Player, previousMenu: Menu) { + menu.openAndStack(player, previousMenu) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/SellGUI.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/SellGUI.kt new file mode 100644 index 0000000..c76c1a7 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/SellGUI.kt @@ -0,0 +1,75 @@ +package com.willfp.ecoshop.shop.gui + +import com.willfp.eco.core.config.updating.ConfigUpdater +import com.willfp.eco.core.drops.DropQueue +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.menu.MenuLayer +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.ConfigSlot +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.shop.isSellable +import com.willfp.ecoshop.shop.sell +import org.bukkit.Material +import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack + +object SellGUI { + private lateinit var menu: Menu + + @JvmStatic + @ConfigUpdater + fun update(plugin: EcoShopPlugin) { + val rows = plugin.configYml.getInt("sell-gui.rows") + + menu = menu(rows) { + title = plugin.configYml.getFormattedString("sell-gui.title") + + allowChangingHeldItem() + + for (i in 1..rows) { + for (j in 1..columns) { + addComponent( + MenuLayer.LOWER, + i, j, + slot(ItemStack(Material.AIR)) { + setCaptive(true) + + setCaptiveFilter { player, _, itemStack -> + itemStack?.isSellable(player) ?: true + } + } + ) + } + } + + onClose { event, menu -> + val player = event.player as Player + + val items = menu.getCaptiveItems(player) + + for (item in items) { + if (!item.sell(player)) { + // Extra safety check + DropQueue(player) + .addItem(item) + .forceTelekinesis() + .push() + } + } + } + + for (config in plugin.configYml.getSubsections("sell-gui.custom-slots")) { + setSlot( + config.getInt("row"), + config.getInt("column"), + ConfigSlot(config) + ) + } + } + } + + fun open(player: Player) { + menu.open(player) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/SellMenu.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/SellMenu.kt new file mode 100644 index 0000000..b866327 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/SellMenu.kt @@ -0,0 +1,207 @@ +package com.willfp.ecoshop.shop.gui + +import com.willfp.eco.core.gui.menu +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.ConfigSlot +import com.willfp.eco.core.gui.slot.FillerMask +import com.willfp.eco.core.gui.slot.MaskItems +import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.builder.modify +import com.willfp.ecoshop.EcoShopPlugin +import com.willfp.ecoshop.shop.SellStatus +import com.willfp.ecoshop.shop.ShopItem +import com.willfp.ecoshop.shop.configKey +import com.willfp.ecoshop.shop.getDisplay +import com.willfp.ecoshop.shop.kickBack +import com.willfp.ecoshop.shop.openAndStack +import com.willfp.ecoshop.shop.parentShop +import org.bukkit.entity.Player +import kotlin.math.min + +class SellMenu( + val item: ShopItem, + private val plugin: EcoShopPlugin +) { + private val sellMoreMenu = MoreMenu(item, plugin, "sell") { amount, stacks -> + slot({ player, _ -> + item.displayItem + .modify { + setAmount(stacks) + setDisplayName( + plugin.configYml.getString("sell-more.item-name") + .replace("%stacks%", stacks.toString()) + ) + addLoreLines( + plugin.langYml.getStrings("confirm-sell-price") + .replaceIn("%price%", item.sellPrice.getDisplay(player, amount)) + ) + } + }) { + onLeftClick { player, _, _, menu -> + val status = item.getCurrentSellStatus(player, amount) + + if (status == SellStatus.ALLOW) { + val didSell = item.sell( + player, + amount, + shop = menu.parentShop[player] + ) + + player.sendMessage( + plugin.langYml.getMessage("sold-item") + .replace("%amount%", didSell.toString()) + .replace("%item%", item.displayName) + .replace("%price%", item.sellPrice.getDisplay(player, didSell)) + ) + } else { + player.sendMessage( + plugin.langYml.getMessage("sell-status.${status.configKey}") + ) + } + } + } + } + + private val menu = menu(plugin.configYml.getInt("sell-menu.rows")) { + title = plugin.configYml.getFormattedString("sell-menu.title") + .replace("%item%", item.displayName) + + allowChangingHeldItem() + + setMask( + FillerMask( + MaskItems.fromItemNames( + plugin.configYml.getStrings("sell-menu.mask.items") + ), + *plugin.configYml.getStrings("sell-menu.mask.pattern").toTypedArray() + ) + ) + + setSlot( + plugin.configYml.getInt("sell-menu.item.row"), + plugin.configYml.getInt("sell-menu.item.column"), + slot { player, menu -> + item.displayItem.modify { + val amount = menu.amountOfItem[player] + + setAmount(amount) + addLoreLines( + plugin.langYml.getStrings("confirm-sell-price") + .replaceIn("%price%", item.sellPrice.getDisplay(player, amount)) + ) + } + } + ) + + addComponent( + plugin.configYml.getInt("sell-menu.sell-more.row"), + plugin.configYml.getInt("sell-menu.sell-more.column"), + slot(Items.lookup(plugin.configYml.getString("sell-menu.sell-more.item"))) { + onLeftClick { player, _, _, menu -> + menu.parentShop[player]?.clickSound?.playTo(player) + sellMoreMenu.open(player, menu) + } + } + ) + + for (config in plugin.configYml.getSubsections("sell-menu.add-buttons")) { + addComponent( + config.getInt("row"), + config.getInt("column"), + AmountAdjustSelector( + item, + config.getInt("add"), + config + ) + ) + } + + for (config in plugin.configYml.getSubsections("sell-menu.set-buttons")) { + addComponent( + config.getInt("row"), + config.getInt("column"), + AmountSetSelector( + config + ) { + min( + item.getMaxBuysAtOnce(it), + item.item?.item?.type?.maxStackSize ?: Int.MAX_VALUE + ).coerceAtMost( + min( + 64, + config.getInt("set") + ) + ) + } + ) + } + + setSlot( + plugin.configYml.getInt("sell-menu.cancel.row"), + plugin.configYml.getInt("sell-menu.cancel.column"), + slot(Items.lookup(plugin.configYml.getString("sell-menu.cancel.item"))) { + onLeftClick { player, _, _, menu -> + menu.kickBack(player) + } + } + ) + + setSlot( + plugin.configYml.getInt("sell-menu.confirm.row"), + plugin.configYml.getInt("sell-menu.confirm.column"), + slot({ player, menu -> + Items.lookup(plugin.configYml.getString("sell-menu.confirm.item")).modify { + addLoreLines( + plugin.langYml.getStrings("confirm-sell-price") + .replaceIn("%price%", item.sellPrice.getDisplay(player, menu.amountOfItem[player])) + ) + } + }) { + onLeftClick { player, _, _, menu -> + val amount = menu.amountOfItem[player] + + val status = item.getCurrentSellStatus(player, amount) + + if (status == SellStatus.ALLOW) { + val didSell = item.sell( + player, + amount, + shop = menu.parentShop[player] + ) + + player.sendMessage( + plugin.langYml.getMessage("sold-item") + .replace("%amount%", didSell.toString()) + .replace("%item%", item.displayName) + .replace("%price%", item.sellPrice.getDisplay(player, amount)) + ) + + menu.kickBack(player) + } else { + player.sendMessage( + plugin.langYml.getMessage("sell-status.${status.configKey}") + ) + } + } + } + ) + + for (config in plugin.configYml.getSubsections("sell-menu.custom-slots")) { + setSlot( + config.getInt("row"), + config.getInt("column"), + ConfigSlot(config) + ) + } + + onOpen { player, menu -> + menu.amountOfItem[player] = 1 + } + } + + fun open(player: Player, previousMenu: Menu) { + menu.openAndStack(player, previousMenu) + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/ShopItemSlot.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/ShopItemSlot.kt new file mode 100644 index 0000000..a89f7a9 --- /dev/null +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoshop/shop/gui/ShopItemSlot.kt @@ -0,0 +1,221 @@ +package com.willfp.ecoshop.shop.gui + +import com.willfp.eco.core.EcoPlugin +import com.willfp.eco.core.gui.menu.Menu +import com.willfp.eco.core.gui.onLeftClick +import com.willfp.eco.core.gui.onRightClick +import com.willfp.eco.core.gui.onShiftLeftClick +import com.willfp.eco.core.gui.onShiftRightClick +import com.willfp.eco.core.gui.slot +import com.willfp.eco.core.gui.slot.CustomSlot +import com.willfp.eco.core.items.builder.modify +import com.willfp.eco.util.formatEco +import com.willfp.eco.util.toNiceString +import com.willfp.ecoshop.shop.BuyStatus +import com.willfp.ecoshop.shop.BuyType +import com.willfp.ecoshop.shop.SellStatus +import com.willfp.ecoshop.shop.ShopItem +import com.willfp.ecoshop.shop.configKey +import com.willfp.ecoshop.shop.getDisplay +import com.willfp.ecoshop.shop.parentShop +import org.bukkit.entity.Player + +fun Collection.replaceIn(token: String, replacement: Any?) = + this.map { it.replace(token, replacement.toNiceString()) } + +class ShopItemSlot( + item: ShopItem, + plugin: EcoPlugin +) : CustomSlot() { + private val slot = slot({ player, _ -> + item.displayItem.modify { + if (item.isBuyable) { + addLoreLines( + /* + Big ugly tree. + This code sucks and I should probably refactor it. + */ + when (val status = item.getBuyStatus(player, 1, BuyType.NORMAL)) { + BuyStatus.MISSING_REQUIREMENTS, + BuyStatus.NO_PERMISSION, + -> plugin.langYml.getStrings("lore.${status.configKey}") + + else -> when (item.getBuysLeft(player)) { + 0 -> plugin.langYml.getStrings("cant-buy-again") + + 1 -> if (item.hasAltBuy) plugin.langYml.getStrings("dual-buy-price") + .replaceIn("%price%", item.buyPrice?.getDisplay(player) ?: "") + .replaceIn("%alt_price%", item.altBuyPrice?.getDisplay(player) ?: "") + else plugin.langYml.getStrings("one-buy-price") + .replaceIn("%price%", item.buyPrice?.getDisplay(player) ?: "") + + else -> if (item.hasAltBuy) plugin.langYml.getStrings("dual-buy-price") + .replaceIn("%price%", item.buyPrice?.getDisplay(player) ?: "") + .replaceIn("%alt_price%", item.altBuyPrice?.getDisplay(player) ?: "") + else plugin.langYml.getStrings("buy-price") + .replaceIn("%price%", item.buyPrice?.getDisplay(player) ?: "") + } + } + ) + } + + if (item.isSellable) { + addLoreLines( + plugin.langYml.getStrings("sell-price") + .replaceIn("%price%", item.sellPrice?.getDisplay(player) ?: "") + ) + } + + if (item.isShowingQuickBuySell) { + if (item.isBuyable && item.getMaxBuysAtOnce(player) > item.buyAmount) { + if (item.hasAltBuy) { + addLoreLines( + plugin.langYml.getStrings("quick-buy-alt-present") + .replaceIn("%price%", item.buyPrice.getDisplay(player, item.buyAmount)) + .replaceIn("%amount%", item.buyAmount.toString()) + ) + addLoreLines( + plugin.langYml.getStrings("quick-buy-alt") + .replaceIn("%price%", item.altBuyPrice.getDisplay(player, item.buyAmount)) + .replaceIn("%amount%", item.buyAmount.toString()) + ) + } else { + addLoreLines( + plugin.langYml.getStrings("quick-buy") + .replaceIn("%amount%", item.buyAmount.toString()) + ) + } + } + + if (item.isSellable) { + addLoreLines( + plugin.langYml.getStrings("quick-sell") + ) + + addLoreLines( + plugin.configYml.getStrings("shop-items.global-bottom-lore.sell").formatEco(player) + ) + } + } + + addLoreLines( + item.bottomLore.formatEco(player) + ) + + if (item.isBuyable) { + addLoreLines(plugin.configYml.getStrings("shop-items.global-bottom-lore.buy").formatEco(player)) + } + + if (item.isSellable) { + addLoreLines(plugin.configYml.getStrings("shop-items.global-bottom-lore.sell").formatEco(player)) + } + + addLoreLines(plugin.configYml.getStrings("shop-items.global-bottom-lore.always").formatEco(player)) + } + }) { + fun handleMainBuyClick(player: Player, menu: Menu, buyType: BuyType) { + val status = item.getBuyStatus(player, 1, buyType) + + if (status != BuyStatus.ALLOW) { + player.sendMessage( + plugin.langYml.getMessage("buy-status.${status.configKey}") + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, 1)) + ) + } else { + if (item.getMaxBuysAtOnce(player) == 1) { + item.buy( + player, + 1, + buyType, + shop = menu.parentShop[player] + ) + + player.sendMessage( + plugin.langYml.getMessage("bought-item") + .replace("%item%", item.displayName) + .replace("%price%", item.getBuyPrice(buyType)?.getDisplay(player) ?: "") + ) + } else { + menu.parentShop[player]?.clickSound?.playTo(player) + item.getBuyMenu(buyType).open(player, menu) + } + } + } + + fun handleQuickBuyClick(player: Player, menu: Menu, buyType: BuyType) { + val status = item.getBuyStatus(player, item.buyAmount, buyType) + + if (status != BuyStatus.ALLOW) { + player.sendMessage( + plugin.langYml.getMessage("buy-status.${status.configKey}") + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, item.buyAmount)) + ) + } else { + item.buy( + player, + item.buyAmount, + buyType, + shop = menu.parentShop[player] + ) + + player.sendMessage( + plugin.langYml.getMessage("bought-item-multiple") + .replace("%amount%", item.buyAmount.toString()) + .replace("%item%", item.displayName) + .replace("%price%", item.getBuyPrice(buyType).getDisplay(player, item.buyAmount)) + ) + } + } + + onLeftClick { player, _, _, menu -> handleMainBuyClick(player, menu, BuyType.NORMAL) } + + onShiftLeftClick { player, _, _, menu -> handleQuickBuyClick(player, menu, BuyType.NORMAL) } + + onRightClick { player, _, _, menu -> + if (item.hasAltBuy) { + handleMainBuyClick(player, menu, BuyType.ALT) + } else { + // Is selling + val status = item.getCurrentSellStatus(player) + + if (status != SellStatus.ALLOW) { + player.sendMessage( + plugin.langYml.getMessage("sell-status.${status.configKey}") + ) + } else { + menu.parentShop[player]?.clickSound?.playTo(player) + item.sellMenu.open(player, menu) + } + } + } + + onShiftRightClick { player, _, _, menu -> + if (item.hasAltBuy) { + handleQuickBuyClick(player, menu, BuyType.ALT) + } else { + // Is Selling + val status = item.getCurrentSellStatus(player) + + if (status != SellStatus.ALLOW) { + player.sendMessage( + plugin.langYml.getMessage("sell-status.${status.configKey}") + ) + } else { + val amount = item.getAmountInPlayerInventory(player) + + item.sell(player, amount) + player.sendMessage( + plugin.langYml.getMessage("sold-item") + .replace("%amount%", amount.toString()) + .replace("%item%", item.displayName) + .replace("%price%", item.sellPrice.getDisplay(player, amount)) + ) + } + } + } + } + + init { + init(slot) + } +} diff --git a/eco-core/core-plugin/src/main/resources/categories/_example.yml b/eco-core/core-plugin/src/main/resources/categories/_example.yml new file mode 100644 index 0000000..508029a --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/_example.yml @@ -0,0 +1,151 @@ +# The ID of the category is the name of the .yml file, +# for example trails.yml has the ID of trails +# You can place categories anywhere in this folder, +# including in subfolders if you want to organize your category configs +# _example.yml is not loaded. + +item: diamond_sword name:"&fExample Category" # The item shown in the shop. +lore: [ ] # The lore of the item shown in the shop. + +# Options for the category GUI. +gui: + rows: 6 # The amount of rows to have (1-6). + title: "Demo Category" # The title of the GUI. + + # Navigation options, hidden if on the first/last page. + forwards-arrow: + item: arrow name:"&fNext Page" + row: 6 + column: 6 + backwards-arrow: + item: arrow name:"&fPrevious Page" + row: 6 + column: 4 + + # Add as many pages as you want by appending to this list + pages: + - page: 1 + mask: + items: # The background material + - gray_stained_glass_pane + - black_stained_glass_pane + pattern: # 0 for empty, 1 for the first item, 2 for the second item, etc + - "222222222" + - "211111112" + - "211111112" + - "211111112" + - "211111112" + - "222222222" + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] + + - page: 2 + mask: + items: + - gray_stained_glass_pane + - black_stained_glass_pane + pattern: + - "222222222" + - "211111112" + - "211111112" + - "211111112" + - "211111112" + - "222222222" + + +items: + - id: enchanted_diamond # The ID of the item, not shown to players. + + # The item to buy/sell. Must have a quantity of one, so 'stone 16' would not be allowed. + # https://plugins.auxilor.io/all-plugins/the-item-lookup-system + item: ecoitems:enchanted_diamond + + # (Optional) The custom display name, will inherit from the GUI item by default. + name: "&b&k!!&r Enchanted Diamond&r &b&k!!" + + # Options for buying the item, see here: + # https://plugins.auxilor.io/all-plugins/prices + buy: + value: 500 - (%player_rank% * 25) + type: coins + display: "$%value%" + + amount: 8 # (Optional) The quick buy / default buy amount. Defaults to 1 if not specified. + max-at-once: 16 # (Optional) The maximum amount that can be bought at once. Defaults to infinity if not specified. + + # Options for selling the item, see here: + # https://plugins.auxilor.io/all-plugins/prices + sell: + value: 100 + (%player_rank% * 25) + type: coins + display: "$%value%" + + require: "%player_rank% > 1" # (Optional) This expression must hold true to be allowed to sell this item. + + gui: + column: 4 # How far left to right (1-9). + row: 3 # How far up or down (1-6). + page: 1 # The page. + + - id: iron_rank + + commands: # The commands to execute. You can use %player% and %amount% as placeholders.q + - lp user %player% parent set iron + + buy: + value: "%ecomc_iron_price%" + type: crystals + display: "&b%value% Crystals ❖" + + require: "%ecomc_iron_price% >= 0" # (Optional) This expression must hold true in order to be allowed to buy the item. + + limit: 1 # (Optional) The max amount of times each player can buy this item, defaults to infinite. + + gui: + display: # This item is shown in the GUI. If you're selling an item, this defaults to the item itself. + item: diamond_chestplate + lore: + - "&fBuy &7&lIRON&r&f rank to get" + - "&fthe following benefits:" + - " &8»&f &eExample Perk" + column: 5 # The column. + row: 3 # The row. + page: 2 # The page. + + - id: valkyrie_egg + + item: ecobosses:valkyrie_spawn_egg + + buy: + value: 76850 + type: coins + display: "&a$%value%" + + require: "%actions_allow_bosses_is_met%" # You can use actions to use conditions here! (https://plugins.auxilor.io/actions/placeholderapi) + + max-at-once: 1 # If you want to skip the amount selection GUI, set max at once to 1 so clicking will instant-buy. + + # Instead of having the item be buyable and sellable, you can have + # two buy options (Buy being left-click, Alt-Buy being right-click). + # limit / max-at-once, etc. are inherited from the buy options. + alt-buy: + value: 65 + type: crystals + display: "&b%value%❖" + + gui: + display: + lore: # You can inherit the item and just add your own extra lore to show additional information. + - "" + - "&fExample Lore" + - "" + bottom-lore: # You can also add lore to be put under other lore (e.g. price, quick buy/sell info, etc.) + - "" + - "&e&oLeft click to buy with money," + - "&e&oRight click to buy with &bCrystals ❖&e&o!" + column: 6 # How far left to right (1-9). + row: 3 # How far up or down (1-6). + page: 1 # The page. + + show-quick-buy-sell: false # (Optional) disable quick buy / quick sell text. diff --git a/eco-core/core-plugin/src/main/resources/categories/blocks.yml b/eco-core/core-plugin/src/main/resources/categories/blocks.yml new file mode 100644 index 0000000..df5d606 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/blocks.yml @@ -0,0 +1,729 @@ +item: grass_block name:"&aBlocks" +lore: [ ] + +gui: + rows: 6 + title: Blocks + + forwards-arrow: + item: arrow name:"&fNext Page" + column: 6 + row: 6 + + backwards-arrow: + item: arrow name:"&fPrevious Page" + column: 4 + row: 6 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + + - page: 2 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: sand + item: sand + + buy: + type: coins + value: 4 + display: $%value% + + gui: + column: 1 + row: 2 + page: 1 + + - id: glass + item: glass + + buy: + type: coins + value: 6 + display: $%value% + + gui: + column: 2 + row: 2 + page: 1 + + - id: red_sand + item: red_sand + + buy: + type: coins + value: 4 + display: $%value% + + gui: + column: 3 + row: 2 + page: 1 + + - id: oak_log + item: oak_log + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 4 + row: 2 + page: 1 + + - id: spruce_log + item: spruce_log + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 5 + row: 2 + page: 1 + + - id: birch_log + item: birch_log + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 6 + row: 2 + page: 1 + + - id: jungle_log + item: jungle_log + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 7 + row: 2 + page: 1 + + - id: acacia_log + item: acacia_log + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 8 + row: 2 + page: 1 + + - id: dark_oak_log + item: dark_oak_log + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 9 + row: 2 + page: 1 + + - id: stone_bricks + item: stone_bricks + buy: + type: coins + value: 6 + display: $%value% + + gui: + column: 1 + row: 3 + page: 1 + + - id: stone + item: stone + + buy: + type: coins + value: 4 + display: $%value% + + sell: + type: coins + value: 0.5 + display: $%value% + + gui: + column: 1 + row: 1 + page: 1 + + - id: granite + item: granite + + buy: + type: coins + value: 5 + display: $%value% + + sell: + type: coins + value: 0.5 + display: $%value% + + gui: + column: 2 + row: 1 + page: 1 + + - id: diorite + item: diorite + + buy: + type: coins + value: 5 + display: $%value% + + sell: + type: coins + value: 0.5 + display: $%value% + + gui: + column: 3 + row: 1 + page: 1 + + - id: andesite + item: andesite + + buy: + type: coins + value: 5 + display: $%value% + + sell: + type: coins + value: 0.5 + display: $%value% + + gui: + column: 4 + row: 1 + page: 1 + + - id: grass_block + item: grass_block + + buy: + type: coins + value: 6 + display: $%value% + + gui: + column: 5 + row: 1 + page: 1 + + - id: dirt + item: dirt + + buy: + type: coins + value: 2 + display: $%value% + + gui: + column: 6 + row: 1 + page: 1 + + - id: podzol + item: podzol + + buy: + type: coins + value: 8 + display: $%value% + + gui: + column: 7 + row: 1 + page: 1 + + - id: mycelium + item: mycelium + + buy: + type: coins + value: 10 + display: $%value% + + gui: + column: 8 + row: 1 + page: 1 + + - id: coarse_dirt + item: coarse_dirt + + buy: + type: coins + value: 8 + display: $%value% + + gui: + column: 9 + row: 1 + page: 1 + + - id: mossy_stone_bricks + item: mossy_stone_bricks + + buy: + type: coins + value: 8 + display: $%value% + + gui: + column: 2 + row: 3 + page: 1 + + - id: quartz_block + item: quartz_block + + buy: + type: coins + value: 35 + display: $%value% + + gui: + column: 3 + row: 3 + page: 1 + + - id: glowstone + item: glowstone + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 4 + row: 3 + page: 1 + + - id: prismarine + item: prismarine + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 5 + row: 3 + page: 1 + + - id: prismarine_bricks + item: prismarine_bricks + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 6 + row: 3 + page: 1 + + - id: dark_prismarine + item: dark_prismarine + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 7 + row: 3 + page: 1 + + - id: sea_lantern + item: sea_lantern + + buy: + type: coins + value: 40 + display: $%value% + + gui: + column: 8 + row: 3 + page: 1 + + - id: purpur_block + item: purpur_block + + buy: + type: coins + value: 80 + display: $%value% + + gui: + column: 9 + row: 3 + page: 1 + + - id: ice + item: ice + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 1 + row: 4 + page: 1 + + - id: netherrack + item: netherrack + + buy: + type: coins + value: 8 + display: $%value% + + gui: + column: 2 + row: 4 + page: 1 + + - id: soul_sand + item: soul_sand + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 3 + row: 4 + page: 1 + + - id: nether_bricks + item: nether_bricks + + buy: + type: coins + value: 15 + display: $%value% + + gui: + column: 4 + row: 4 + page: 1 + + - id: red_nether_bricks + item: red_nether_bricks + + buy: + type: coins + value: 18 + display: $%value% + + gui: + column: 5 + row: 4 + page: 1 + + - id: end_stone + item: end_stone + + buy: + type: coins + value: 10 + display: $%value% + + gui: + column: 6 + row: 4 + page: 1 + + - id: end_stone_bricks + item: end_stone_bricks + + buy: + type: coins + value: 12 + display: $%value% + + gui: + column: 7 + row: 4 + page: 1 + + - id: obsidian + item: obsidian + + buy: + type: coins + value: 200 + display: $%value% + + gui: + column: 8 + row: 4 + page: 1 + + - id: bricks + item: bricks + + buy: + type: coins + value: 12 + display: $%value% + + gui: + column: 9 + row: 4 + page: 1 + + - id: clay + item: clay + + buy: + type: coins + value: 8 + display: $%value% + + gui: + column: 1 + row: 1 + page: 2 + + - id: gravel + item: gravel + + buy: + type: coins + value: 8 + display: $%value% + + gui: + column: 2 + row: 1 + page: 2 + + - id: end_rod + item: end_rod + + buy: + type: coins + value: 250 + display: $%value% + + gui: + column: 3 + row: 1 + page: 2 + + - id: cobblestone + item: cobblestone + + buy: + type: coins + value: 4 + display: $%value% + + sell: + type: coins + value: 0.5 + display: $%value% + + gui: + column: 4 + row: 1 + page: 2 + + - id: smooth_stone + item: smooth_stone + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 5 + row: 1 + page: 2 + + - id: sandstone + item: sandstone + + buy: + type: coins + value: 4 + display: $%value% + + gui: + column: 6 + row: 1 + page: 2 + + - id: crimson_stem + item: crimson_stem + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 7 + row: 1 + page: 2 + + - id: warped_stem + item: warped_stem + + buy: + type: coins + value: 5 + display: $%value% + + gui: + column: 8 + row: 1 + page: 2 + + - id: shroomlight + item: shroomlight + + buy: + type: coins + value: 20 + display: $%value% + + gui: + column: 9 + row: 1 + page: 2 + + - id: deepslate + item: deepslate + + buy: + type: coins + value: 10 + display: $%value% + + sell: + type: coins + value: 1 + display: $%value% + + gui: + column: 1 + row: 2 + page: 2 + + - id: cobbled_deepslate + item: cobbled_deepslate + + buy: + type: coins + value: 10 + display: $%value% + + sell: + type: coins + value: 1 + display: $%value% + + gui: + column: 2 + row: 2 + page: 2 + + - id: dripstone_block + item: dripstone_block + + buy: + type: coins + value: 10 + display: $%value% + + sell: + type: coins + value: 1 + display: $%value% + + gui: + column: 3 + row: 2 + page: 2 + + - id: crying_obsidian + item: crying_obsidian + + buy: + type: coins + value: 400 + display: $%value% + + gui: + column: 4 + row: 2 + page: 2 + + - id: moss_block + item: moss_block + + buy: + type: coins + value: 100 + display: $%value% + + gui: + column: 5 + row: 2 + page: 2 diff --git a/eco-core/core-plugin/src/main/resources/categories/colored_blocks.yml b/eco-core/core-plugin/src/main/resources/categories/colored_blocks.yml new file mode 100644 index 0000000..1e3563f --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/colored_blocks.yml @@ -0,0 +1,1022 @@ +item: lime_concrete name:"&aColored Blocks" +lore: [ ] + +gui: + rows: 6 + title: Colored Blocks + + forwards-arrow: + column: 6 + item: arrow name:"&fNext Page" + row: 6 + backwards-arrow: + column: 4 + item: arrow name:"&fPrevious Page" + row: 6 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + - page: 2 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + - page: 3 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + - page: 4 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: brown_wool + item: brown_wool + + buy: + type: coins + value: 6 + display: $%value% + + gui: + column: 2 + row: 1 + page: 4 + + - id: brown_terracotta + gui: + column: 3 + row: 1 + page: 4 + item: brown_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: brown_stained_glass + gui: + column: 4 + row: 1 + page: 4 + item: brown_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: brown_concrete + gui: + column: 6 + row: 1 + page: 4 + item: brown_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: brown_concrete_powder + gui: + column: 7 + row: 1 + page: 4 + item: brown_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: brown_glazed_terracotta + gui: + column: 8 + row: 1 + page: 4 + item: brown_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: magenta_wool + gui: + column: 2 + row: 3 + page: 1 + item: magenta_wool + buy: + type: coins + value: 6 + display: $%value% + - id: magenta_terracotta + gui: + column: 3 + row: 3 + page: 1 + item: magenta_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: magenta_stained_glass + gui: + column: 4 + row: 3 + page: 1 + item: magenta_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: magenta_concrete + gui: + column: 6 + row: 3 + page: 1 + item: magenta_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: magenta_concrete_powder + gui: + column: 7 + row: 3 + page: 1 + item: magenta_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: magenta_glazed_terracotta + gui: + column: 8 + row: 3 + page: 1 + item: magenta_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: green_wool + gui: + column: 2 + row: 2 + page: 4 + item: green_wool + buy: + type: coins + value: 6 + display: $%value% + - id: green_terracotta + gui: + column: 3 + row: 2 + page: 4 + item: green_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: green_stained_glass + gui: + column: 4 + row: 2 + page: 4 + item: green_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: orange_wool + gui: + column: 2 + row: 2 + page: 1 + item: orange_wool + buy: + type: coins + value: 6 + display: $%value% + - id: green_concrete + gui: + column: 6 + row: 2 + page: 4 + item: green_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: orange_terracotta + gui: + column: 3 + row: 2 + page: 1 + item: orange_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: green_concrete_powder + gui: + column: 7 + row: 2 + page: 4 + item: green_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: orange_stained_glass + gui: + column: 4 + row: 2 + page: 1 + item: orange_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: green_glazed_terracotta + gui: + column: 8 + row: 2 + page: 4 + item: green_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: orange_concrete + gui: + column: 6 + row: 2 + page: 1 + item: orange_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: orange_concrete_powder + gui: + column: 7 + row: 2 + page: 1 + item: orange_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: orange_glazed_terracotta + gui: + column: 8 + row: 2 + page: 1 + item: orange_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: light_blue_wool + gui: + column: 2 + row: 4 + page: 1 + item: light_blue_wool + buy: + type: coins + value: 6 + display: $%value% + - id: light_blue_terracotta + gui: + column: 3 + row: 4 + page: 1 + item: light_blue_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: light_blue_stained_glass + gui: + column: 4 + row: 4 + page: 1 + item: light_blue_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: light_blue_concrete + gui: + column: 6 + row: 4 + page: 1 + item: light_blue_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: light_blue_concrete_powder + gui: + column: 7 + row: 4 + page: 1 + item: light_blue_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: light_blue_glazed_terracotta + gui: + column: 8 + row: 4 + page: 1 + item: light_blue_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: red_wool + gui: + column: 2 + row: 3 + page: 4 + item: red_wool + buy: + type: coins + value: 6 + display: $%value% + - id: red_terracotta + gui: + column: 3 + row: 3 + page: 4 + item: red_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: red_stained_glass + gui: + column: 4 + row: 3 + page: 4 + item: red_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: red_concrete + gui: + column: 6 + row: 3 + page: 4 + item: red_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: red_concrete_powder + gui: + column: 7 + row: 3 + page: 4 + item: red_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: red_glazed_terracotta + gui: + column: 8 + row: 3 + page: 4 + item: red_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: yellow_wool + gui: + column: 2 + row: 1 + page: 2 + item: yellow_wool + buy: + type: coins + value: 6 + display: $%value% + - id: yellow_terracotta + gui: + column: 3 + row: 1 + page: 2 + item: yellow_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: yellow_stained_glass + gui: + column: 4 + row: 1 + page: 2 + item: yellow_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: yellow_concrete + gui: + column: 6 + row: 1 + page: 2 + item: yellow_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: yellow_concrete_powder + gui: + column: 7 + row: 1 + page: 2 + item: yellow_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: yellow_glazed_terracotta + gui: + column: 8 + row: 1 + page: 2 + item: yellow_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: black_wool + gui: + column: 2 + row: 4 + page: 4 + item: black_wool + buy: + type: coins + value: 6 + display: $%value% + - id: black_terracotta + gui: + column: 3 + row: 4 + page: 4 + item: black_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: black_stained_glass + gui: + column: 4 + row: 4 + page: 4 + item: black_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: black_concrete + gui: + column: 6 + row: 4 + page: 4 + item: black_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: black_concrete_powder + gui: + column: 7 + row: 4 + page: 4 + item: black_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: black_glazed_terracotta + gui: + column: 8 + row: 4 + page: 4 + item: black_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: lime_wool + gui: + column: 2 + row: 2 + page: 2 + item: lime_wool + buy: + type: coins + value: 6 + display: $%value% + - id: lime_terracotta + gui: + column: 3 + row: 2 + page: 2 + item: lime_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: lime_stained_glass + gui: + column: 4 + row: 2 + page: 2 + item: lime_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: lime_concrete + gui: + column: 6 + row: 2 + page: 2 + item: lime_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: lime_concrete_powder + gui: + column: 7 + row: 2 + page: 2 + item: lime_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: lime_glazed_terracotta + gui: + column: 8 + row: 2 + page: 2 + item: lime_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: white_wool + gui: + column: 2 + row: 1 + page: 1 + item: white_wool + buy: + type: coins + value: 6 + display: $%value% + - id: white_terracotta + gui: + column: 3 + row: 1 + page: 1 + item: white_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: white_stained_glass + gui: + column: 4 + row: 1 + page: 1 + item: white_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: white_concrete + gui: + column: 6 + row: 1 + page: 1 + item: white_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: white_concrete_powder + gui: + column: 7 + row: 1 + page: 1 + item: white_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: white_glazed_terracotta + gui: + column: 8 + row: 1 + page: 1 + item: white_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: pink_wool + gui: + column: 2 + row: 3 + page: 2 + item: pink_wool + buy: + type: coins + value: 6 + display: $%value% + - id: pink_terracotta + gui: + column: 3 + row: 3 + page: 2 + item: pink_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: pink_stained_glass + gui: + column: 4 + row: 3 + page: 2 + item: pink_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: pink_concrete + gui: + column: 6 + row: 3 + page: 2 + item: pink_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: pink_concrete_powder + gui: + column: 7 + row: 3 + page: 2 + item: pink_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: pink_glazed_terracotta + gui: + column: 8 + row: 3 + page: 2 + item: pink_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: gray_wool + gui: + column: 2 + row: 4 + page: 2 + item: gray_wool + buy: + type: coins + value: 6 + display: $%value% + - id: gray_terracotta + gui: + column: 3 + row: 4 + page: 2 + item: gray_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: gray_stained_glass + gui: + column: 4 + row: 4 + page: 2 + item: gray_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: gray_concrete + gui: + column: 6 + row: 4 + page: 2 + item: gray_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: gray_concrete_powder + gui: + column: 7 + row: 4 + page: 2 + item: gray_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: gray_glazed_terracotta + gui: + column: 8 + row: 4 + page: 2 + item: gray_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: light_gray_wool + gui: + column: 2 + row: 1 + page: 3 + item: light_gray_wool + buy: + type: coins + value: 6 + display: $%value% + - id: light_gray_terracotta + gui: + column: 3 + row: 1 + page: 3 + item: light_gray_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: light_gray_stained_glass + gui: + column: 4 + row: 1 + page: 3 + item: light_gray_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: light_gray_concrete + gui: + column: 6 + row: 1 + page: 3 + item: light_gray_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: light_gray_concrete_powder + gui: + column: 7 + row: 1 + page: 3 + item: light_gray_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: light_gray_glazed_terracotta + gui: + column: 8 + row: 1 + page: 3 + item: light_gray_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: cyan_wool + gui: + column: 2 + row: 2 + page: 3 + item: cyan_wool + buy: + type: coins + value: 6 + display: $%value% + - id: cyan_terracotta + gui: + column: 3 + row: 2 + page: 3 + item: cyan_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: cyan_stained_glass + gui: + column: 4 + row: 2 + page: 3 + item: cyan_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: cyan_concrete + gui: + column: 6 + row: 2 + page: 3 + item: cyan_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: cyan_concrete_powder + gui: + column: 7 + row: 2 + page: 3 + item: cyan_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: cyan_glazed_terracotta + gui: + column: 8 + row: 2 + page: 3 + item: cyan_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: purple_wool + gui: + column: 2 + row: 3 + page: 3 + item: purple_wool + buy: + type: coins + value: 6 + display: $%value% + - id: purple_terracotta + gui: + column: 3 + row: 3 + page: 3 + item: purple_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: purple_stained_glass + gui: + column: 4 + row: 3 + page: 3 + item: purple_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: purple_concrete + gui: + column: 6 + row: 3 + page: 3 + item: purple_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: purple_concrete_powder + gui: + column: 7 + row: 3 + page: 3 + item: purple_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: purple_glazed_terracotta + gui: + column: 8 + row: 3 + page: 3 + item: purple_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% + - id: blue_wool + gui: + column: 2 + row: 4 + page: 3 + item: blue_wool + buy: + type: coins + value: 6 + display: $%value% + - id: blue_terracotta + gui: + column: 3 + row: 4 + page: 3 + item: blue_terracotta + buy: + type: coins + value: 10 + display: $%value% + - id: blue_stained_glass + gui: + column: 4 + row: 4 + page: 3 + item: blue_stained_glass + buy: + type: coins + value: 5 + display: $%value% + - id: blue_concrete + gui: + column: 6 + row: 4 + page: 3 + item: blue_concrete + buy: + type: coins + value: 12 + display: $%value% + - id: blue_concrete_powder + gui: + column: 7 + row: 4 + page: 3 + item: blue_concrete_powder + buy: + type: coins + value: 8 + display: $%value% + - id: blue_glazed_terracotta + gui: + column: 8 + row: 4 + page: 3 + item: blue_glazed_terracotta + buy: + type: coins + value: 13 + display: $%value% diff --git a/eco-core/core-plugin/src/main/resources/categories/dyes.yml b/eco-core/core-plugin/src/main/resources/categories/dyes.yml new file mode 100644 index 0000000..39eab41 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/dyes.yml @@ -0,0 +1,330 @@ +item: lime_dye name:"&aDyes" +lore: [ ] + +gui: + rows: 4 + title: "Dyes" + + forwards-arrow: + item: arrow name:"&fNext Page" + row: 4 + column: 6 + backwards-arrow: + item: arrow name:"&fPrevious Page" + row: 4 + column: 4 + + pages: + - page: 1 + mask: + items: [] + pattern: + - "000000000" + - "000000000" + - "000000000" + - "000000000" + +items: + - id: black_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: black_dye + + gui: + column: 1 + row: 1 + page: 1 + + - id: blue_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: blue_dye + + gui: + column: 2 + row: 1 + page: 1 + + - id: orange_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: orange_dye + + gui: + column: 3 + row: 1 + page: 1 + + - id: magenta_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: magenta_dye + + gui: + column: 4 + row: 1 + page: 1 + + - id: light_blue_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: light_blue_dye + + gui: + column: 5 + row: 1 + page: 1 + + - id: yellow_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: yellow_dye + + gui: + column: 6 + row: 1 + page: 1 + + - id: lime_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: lime_dye + + gui: + column: 7 + row: 1 + page: 1 + + - id: pink_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: pink_dye + + gui: + column: 8 + row: 1 + page: 1 + + - id: gray_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: gray_dye + + gui: + column: 9 + row: 1 + page: 1 + + - id: light_gray_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: light_gray_dye + + gui: + column: 1 + row: 2 + page: 1 + + - id: cyan_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: cyan_dye + + gui: + column: 2 + row: 2 + page: 1 + + - id: purple_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: purple_dye + + gui: + column: 3 + row: 2 + page: 1 + + - id: brown_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: brown_dye + + gui: + column: 4 + row: 2 + page: 1 + + - id: green_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: green_dye + + gui: + column: 5 + row: 2 + page: 1 + + - id: red_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: red_dye + + gui: + column: 6 + row: 2 + page: 1 + + - id: white_dye + + buy: + value: 25 + type: coins + display: "$%value%" + + sell: + value: 2 + type: coins + display: "$%value%" + + item: white_dye + + gui: + column: 7 + row: 2 + page: 1 diff --git a/eco-core/core-plugin/src/main/resources/categories/food.yml b/eco-core/core-plugin/src/main/resources/categories/food.yml new file mode 100644 index 0000000..45f69b2 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/food.yml @@ -0,0 +1,108 @@ +item: cooked_beef name:"&aFood" +lore: [ ] + +gui: + rows: 3 + title: Food + + forwards-arrow: + column: 6 + item: arrow name:"&fNext Page" + row: 3 + backwards-arrow: + column: 4 + item: arrow name:"&fPrevious Page" + row: 3 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: cooked_chicken + gui: + column: 2 + row: 1 + page: 1 + item: cooked_chicken + buy: + type: coins + value: 20 + display: $%value% + amount: 32 + + - id: baked_potato + gui: + column: 3 + row: 1 + page: 1 + item: baked_potato + buy: + type: coins + value: 15 + display: $%value% + amount: 32 + + - id: cooked_mutton + gui: + column: 4 + row: 1 + page: 1 + item: cooked_mutton + buy: + type: coins + value: 20 + display: $%value% + amount: 32 + + - id: cooked_porkchop + gui: + column: 5 + row: 1 + page: 1 + item: cooked_porkchop + buy: + type: coins + value: 30 + display: $%value% + amount: 32 + + - id: cooked_beef + gui: + column: 6 + row: 1 + page: 1 + item: cooked_beef + buy: + type: coins + value: 30 + display: $%value% + amount: 32 + + - id: golden_carrot + gui: + column: 7 + row: 1 + page: 1 + item: golden_carrot + buy: + type: coins + value: 60 + display: $%value% + amount: 32 + + - id: golden_apple + gui: + column: 8 + row: 1 + page: 1 + item: golden_apple + buy: + type: coins + value: 550 + display: $%value% diff --git a/eco-core/core-plugin/src/main/resources/categories/gear.yml b/eco-core/core-plugin/src/main/resources/categories/gear.yml new file mode 100644 index 0000000..1e435ba --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/gear.yml @@ -0,0 +1,288 @@ +item: iron_chestplate name:"&aGear" +lore: [ ] + +gui: + rows: 5 + title: Gear + + forwards-arrow: + column: 6 + item: arrow name:"&fNext Page" + row: 5 + backwards-arrow: + column: 4 + item: arrow name:"&fPrevious Page" + row: 5 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: diamond_helmet + gui: + column: 1 + row: 2 + page: 1 + item: diamond_helmet + buy: + type: coins + value: 7500 + display: $%value% + - id: diamond_chestplate + gui: + column: 2 + row: 2 + page: 1 + item: diamond_chestplate + buy: + type: coins + value: 12000 + display: $%value% + - id: diamond_leggings + gui: + column: 3 + row: 2 + page: 1 + item: diamond_leggings + buy: + type: coins + value: 10500 + display: $%value% + - id: diamond_boots + gui: + column: 4 + row: 2 + page: 1 + item: diamond_boots + buy: + type: coins + value: 6000 + display: $%value% + - id: diamond_pickaxe + gui: + column: 5 + row: 2 + page: 1 + item: diamond_pickaxe + buy: + type: coins + value: 4500 + display: $%value% + - id: diamond_sword + gui: + column: 6 + row: 2 + page: 1 + item: diamond_sword + buy: + type: coins + value: 3000 + display: $%value% + - id: diamond_axe + gui: + column: 7 + row: 2 + page: 1 + item: diamond_axe + buy: + type: coins + value: 4500 + display: $%value% + - id: diamond_shovel + gui: + column: 8 + row: 2 + page: 1 + item: diamond_shovel + buy: + type: coins + value: 1500 + display: $%value% + - id: diamond_hoe + gui: + column: 9 + row: 2 + page: 1 + item: diamond_hoe + buy: + type: coins + value: 3000 + display: $%value% + - id: elytra + gui: + column: 1 + row: 3 + page: 1 + item: elytra + buy: + type: coins + value: 17500 + display: $%value% + - id: iron_helmet + gui: + column: 1 + row: 1 + page: 1 + item: iron_helmet + buy: + type: coins + value: 250 + display: $%value% + - id: iron_chestplate + gui: + column: 2 + row: 1 + page: 1 + item: iron_chestplate + buy: + type: coins + value: 400 + display: $%value% + - id: iron_leggings + gui: + column: 3 + row: 1 + page: 1 + item: iron_leggings + buy: + type: coins + value: 350 + display: $%value% + - id: iron_boots + gui: + column: 4 + row: 1 + page: 1 + item: iron_boots + buy: + type: coins + value: 200 + display: $%value% + - id: iron_pickaxe + gui: + column: 5 + row: 1 + page: 1 + item: iron_pickaxe + buy: + type: coins + value: 150 + display: $%value% + - id: iron_sword + gui: + column: 6 + row: 1 + page: 1 + item: iron_sword + buy: + type: coins + value: 100 + display: $%value% + - id: iron_axe + gui: + column: 7 + row: 1 + page: 1 + item: iron_axe + buy: + type: coins + value: 150 + display: $%value% + - id: iron_shovel + gui: + column: 8 + row: 1 + page: 1 + item: iron_shovel + buy: + type: coins + value: 50 + display: $%value% + - id: iron_hoe + gui: + column: 9 + row: 1 + page: 1 + item: iron_hoe + buy: + type: coins + value: 100 + display: $%value% + - id: bow + gui: + column: 2 + row: 3 + page: 1 + item: bow + buy: + type: coins + value: 150 + display: $%value% + - id: trident + gui: + column: 3 + row: 3 + page: 1 + item: trident + buy: + type: coins + value: 20000 + display: $%value% + - id: crossbow + gui: + column: 4 + row: 3 + page: 1 + item: crossbow + buy: + type: coins + value: 300 + display: $%value% + - id: firework_rocket + gui: + column: 5 + row: 3 + page: 1 + item: firework_rocket + buy: + type: coins + value: 25 + display: $%value% + - id: shield + gui: + column: 6 + row: 3 + page: 1 + item: shield + buy: + type: coins + value: 75 + display: $%value% + - id: name_tag + gui: + column: 7 + row: 3 + page: 1 + item: name_tag + buy: + type: coins + value: 2500 + display: $%value% + - id: saddle + gui: + column: 8 + row: 3 + page: 1 + item: saddle + buy: + type: coins + value: 2500 + display: $%value% diff --git a/eco-core/core-plugin/src/main/resources/categories/minerals.yml b/eco-core/core-plugin/src/main/resources/categories/minerals.yml new file mode 100644 index 0000000..f86ccfa --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/minerals.yml @@ -0,0 +1,279 @@ +item: diamond name:"&aMinerals" +lore: [ ] + +gui: + rows: 4 + title: Minerals + + forwards-arrow: + column: 6 + item: arrow name:"&fNext Page" + row: 4 + backwards-arrow: + column: 4 + item: arrow name:"&fPrevious Page" + row: 4 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: iron_block + gui: + column: 2 + row: 2 + page: 1 + item: iron_block + buy: + type: coins + value: 1800 + display: $%value% + sell: + type: coins + value: 180 + display: $%value% + - id: gold_block + gui: + column: 3 + row: 2 + page: 1 + item: gold_block + buy: + type: coins + value: 2250 + display: $%value% + sell: + type: coins + value: 225 + display: $%value% + - id: lapis_block + gui: + column: 4 + row: 2 + page: 1 + item: lapis_block + buy: + type: coins + value: 270 + display: $%value% + sell: + type: coins + value: 27 + display: $%value% + - id: amethyst_block + gui: + column: 5 + row: 2 + page: 1 + item: amethyst_block + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 20 + display: $%value% + - id: netherite_ingot + gui: + column: 9 + row: 1 + page: 1 + item: netherite_ingot + buy: + type: coins + value: 15000 + display: $%value% + sell: + type: coins + value: 1500 + display: $%value% + - id: emerald_block + gui: + column: 6 + row: 2 + page: 1 + item: emerald_block + buy: + type: coins + value: 4950 + display: $%value% + sell: + type: coins + value: 495 + display: $%value% + - id: diamond_block + gui: + column: 7 + row: 2 + page: 1 + item: diamond_block + buy: + type: coins + value: 24750 + display: $%value% + sell: + type: coins + value: 2475 + display: $%value% + - id: copper_block + gui: + column: 8 + row: 2 + page: 1 + item: copper_block + buy: + type: coins + value: 1800 + display: $%value% + sell: + type: coins + value: 180 + display: $%value% + - id: netherite_block + gui: + column: 9 + row: 2 + page: 1 + item: netherite_block + buy: + type: coins + value: 135000 + display: $%value% + sell: + type: coins + value: 13500 + display: $%value% + - id: coal + gui: + column: 1 + row: 1 + page: 1 + item: coal + buy: + type: coins + value: 100 + display: $%value% + sell: + type: coins + value: 10 + display: $%value% + - id: iron_ingot + gui: + column: 2 + row: 1 + page: 1 + item: iron_ingot + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 20 + display: $%value% + - id: gold_ingot + gui: + column: 3 + row: 1 + page: 1 + item: gold_ingot + buy: + type: coins + value: 250 + display: $%value% + sell: + type: coins + value: 25 + display: $%value% + - id: lapis_lazuli + gui: + column: 4 + row: 1 + page: 1 + item: lapis_lazuli + buy: + type: coins + value: 30 + display: $%value% + sell: + type: coins + value: 3 + display: $%value% + - id: amethyst_shard + gui: + column: 5 + row: 1 + page: 1 + item: amethyst_shard + buy: + type: coins + value: 50 + display: $%value% + sell: + type: coins + value: 5 + display: $%value% + - id: emerald + gui: + column: 6 + row: 1 + page: 1 + item: emerald + buy: + type: coins + value: 550 + display: $%value% + sell: + type: coins + value: 55 + display: $%value% + - id: diamond + gui: + column: 7 + row: 1 + page: 1 + item: diamond + buy: + type: coins + value: 2750 + display: $%value% + sell: + type: coins + value: 275 + display: $%value% + - id: copper_ingot + gui: + column: 8 + row: 1 + page: 1 + item: copper_ingot + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 20 + display: $%value% + - id: coal_block + gui: + column: 1 + row: 2 + page: 1 + item: coal_block + buy: + type: coins + value: 900 + display: $%value% + sell: + type: coins + value: 90 + display: $%value% diff --git a/eco-core/core-plugin/src/main/resources/categories/mob_drops.yml b/eco-core/core-plugin/src/main/resources/categories/mob_drops.yml new file mode 100644 index 0000000..d676ecf --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/mob_drops.yml @@ -0,0 +1,423 @@ +item: rotten_flesh name:"&aMob Drops" +lore: [ ] + +gui: + rows: 5 + title: "Mob Drops" + + forwards-arrow: + item: arrow name:"&fNext Page" + row: 5 + column: 6 + backwards-arrow: + item: arrow name:"&fPrevious Page" + row: 5 + column: 4 + + pages: + - page: 1 + mask: + items: [] + pattern: + - "000000000" + - "000000000" + - "000000000" + - "000000000" + - "000000000" + +items: + - id: ender_pearl + + sell: + value: 5 + type: coins + display: "$%value%" + + item: ender_pearl + + gui: + column: 1 + row: 1 + page: 1 + + - id: string + + buy: + value: 30 + type: coins + display: "$%value%" + + sell: + value: 3 + type: coins + display: "$%value%" + + item: string + + gui: + column: 2 + row: 1 + page: 1 + + - id: rotten_flesh + + sell: + value: 5 + type: coins + display: "$%value%" + + item: rotten_flesh + + gui: + column: 3 + row: 1 + page: 1 + + - id: gunpowder + + sell: + value: 15 + type: coins + display: "$%value%" + + item: gunpowder + + gui: + column: 4 + row: 1 + page: 1 + + - id: arrow + + buy: + value: 20 + type: coins + display: "$%value%" + + sell: + value: 3 + type: coins + display: "$%value%" + + item: arrow + + gui: + column: 5 + row: 1 + page: 1 + + - id: magma_cream + + buy: + value: 120 + type: coins + display: "$%value%" + + sell: + value: 12 + type: coins + display: "$%value%" + + item: magma_cream + + gui: + column: 6 + row: 1 + page: 1 + + - id: lead + + sell: + value: 50 + type: coins + display: "$%value%" + + item: lead + + gui: + column: 7 + row: 1 + page: 1 + + - id: glistering_melon_slice + + sell: + value: 15 + type: coins + display: "$%value%" + + item: glistering_melon_slice + + gui: + column: 8 + row: 1 + page: 1 + + - id: blaze_rod + + buy: + value: 50 + type: coins + display: "$%value%" + + sell: + value: 8 + type: coins + display: "$%value%" + + item: blaze_rod + + gui: + column: 9 + row: 1 + page: 1 + + - id: slime_ball + + buy: + value: 40 + type: coins + display: "$%value%" + + sell: + value: 4 + type: coins + display: "$%value%" + + item: slime_ball + + gui: + column: 1 + row: 2 + page: 1 + + - id: ink_sac + + sell: + value: 15 + type: coins + display: "$%value%" + + item: ink_sac + + gui: + column: 2 + row: 2 + page: 1 + + - id: glow_ink_sac + + sell: + value: 15 + type: coins + display: "$%value%" + + item: glow_ink_sac + + gui: + column: 3 + row: 2 + page: 1 + + - id: feather + + buy: + value: 150 + type: coins + display: "$%value%" + + sell: + value: 15 + type: coins + display: "$%value%" + + item: feather + + gui: + column: 4 + row: 2 + page: 1 + + - id: leather + + buy: + value: 90 + type: coins + display: "$%value%" + + sell: + value: 15 + type: coins + display: "$%value%" + + item: leather + + gui: + column: 5 + row: 2 + page: 1 + + - id: bone + + sell: + value: 15 + type: coins + display: "$%value%" + + item: bone + + gui: + column: 6 + row: 2 + page: 1 + + - id: shulker_shell + + buy: + value: 7500 + type: coins + display: "$%value%" + + sell: + value: 125 + type: coins + display: "$%value%" + + item: shulker_shell + + gui: + column: 7 + row: 2 + page: 1 + + - id: ghast_tear + + buy: + value: 500 + type: coins + display: "$%value%" + + sell: + value: 50 + type: coins + display: "$%value%" + + item: ghast_tear + + gui: + column: 8 + row: 2 + page: 1 + + - id: spider_eye + + sell: + value: 5 + type: coins + display: "$%value%" + + item: spider_eye + + gui: + column: 9 + row: 2 + page: 1 + + - id: nether_star + + sell: + value: 17500 + type: coins + display: "$%value%" + + item: nether_star + + gui: + column: 1 + row: 3 + page: 1 + + - id: nautilus_shell + + sell: + value: 50 + type: coins + display: "$%value%" + + item: nautilus_shell + + gui: + column: 2 + row: 3 + page: 1 + + - id: wither_skeleton_skull + + buy: + value: 50000 + type: coins + display: "$%value%" + + item: wither_skeleton_skull + + gui: + column: 3 + row: 3 + page: 1 + + - id: honey_bottle + + buy: + value: 850 + type: coins + display: "$%value%" + + sell: + value: 135 + type: coins + display: "$%value%" + + item: honey_bottle + + gui: + column: 4 + row: 3 + page: 1 + + - id: honey_block + + buy: + value: 3400 + type: coins + display: "$%value%" + + sell: + value: 540 + type: coins + display: "$%value%" + + item: honey_block + + gui: + column: 5 + row: 3 + page: 1 + + - id: prismarine_shard + + buy: + value: 200 + type: coins + display: "$%value%" + + sell: + value: 20 + type: coins + display: "$%value%" + + item: honey_block + + gui: + column: 6 + row: 3 + page: 1 diff --git a/eco-core/core-plugin/src/main/resources/categories/nature.yml b/eco-core/core-plugin/src/main/resources/categories/nature.yml new file mode 100644 index 0000000..dcf0622 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/nature.yml @@ -0,0 +1,745 @@ +item: allium name:"&aNature" +lore: [ ] + +gui: + rows: 6 + title: Nature + + forwards-arrow: + column: 6 + item: arrow name:"&fNext Page" + row: 6 + backwards-arrow: + column: 4 + item: arrow name:"&fPrevious Page" + row: 6 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + - page: 2 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: melon_slice + gui: + column: 1 + row: 2 + page: 1 + item: melon_slice + buy: + type: coins + value: 50 + display: $%value% + sell: + type: coins + value: 2 + display: $%value% + - id: carrot + gui: + column: 2 + row: 1 + page: 1 + item: carrot + buy: + type: coins + value: 60 + display: $%value% + sell: + type: coins + value: 4 + display: $%value% + - id: vine + gui: + column: 7 + row: 2 + page: 2 + item: vine + buy: + type: coins + value: 50 + display: $%value% + - id: lily_pad + gui: + column: 8 + row: 2 + page: 2 + item: lily_pad + buy: + type: coins + value: 50 + display: $%value% + - id: cactus + gui: + column: 1 + row: 4 + page: 1 + item: cactus + buy: + type: coins + value: 50 + display: $%value% + - id: grass + gui: + column: 2 + row: 4 + page: 1 + item: grass + buy: + type: coins + value: 50 + display: $%value% + - id: melon_seeds + gui: + column: 2 + row: 2 + page: 1 + item: melon_seeds + buy: + type: coins + value: 40 + display: $%value% + sell: + type: coins + value: 2 + display: $%value% + - id: fern + gui: + column: 3 + row: 4 + page: 1 + item: fern + buy: + type: coins + value: 50 + display: $%value% + - id: dead_bush + gui: + column: 4 + row: 4 + page: 1 + item: dead_bush + buy: + type: coins + value: 50 + display: $%value% + - id: seagrass + gui: + column: 5 + row: 4 + page: 1 + item: seagrass + buy: + type: coins + value: 50 + display: $%value% + - id: potato + gui: + column: 3 + row: 1 + page: 1 + item: potato + buy: + type: coins + value: 60 + display: $%value% + sell: + type: coins + value: 4 + display: $%value% + - id: birch_sapling + gui: + column: 4 + row: 3 + page: 1 + item: birch_sapling + buy: + type: coins + value: 600 + display: $%value% + - id: spruce_sapling + gui: + column: 3 + row: 3 + page: 1 + item: spruce_sapling + buy: + type: coins + value: 600 + display: $%value% + - id: oak_sapling + gui: + column: 2 + row: 3 + page: 1 + item: oak_sapling + buy: + type: coins + value: 600 + display: $%value% + - id: azalea + gui: + column: 8 + row: 3 + page: 1 + item: azalea + buy: + type: coins + value: 600 + display: $%value% + - id: dark_oak_sapling + gui: + column: 7 + row: 3 + page: 1 + item: dark_oak_sapling + buy: + type: coins + value: 600 + display: $%value% + - id: acacia_sapling + gui: + column: 6 + row: 3 + page: 1 + item: acacia_sapling + buy: + type: coins + value: 600 + display: $%value% + - id: jungle_sapling + gui: + column: 5 + row: 3 + page: 1 + item: jungle_sapling + buy: + type: coins + value: 600 + display: $%value% + - id: sea_pickle + gui: + column: 6 + row: 4 + page: 1 + item: sea_pickle + buy: + type: coins + value: 50 + display: $%value% + - id: poppy + gui: + column: 7 + row: 4 + page: 1 + item: poppy + buy: + type: coins + value: 50 + display: $%value% + - id: dandelion + gui: + column: 8 + row: 4 + page: 1 + item: dandelion + buy: + type: coins + value: 50 + display: $%value% + - id: blue_orchid + gui: + column: 9 + row: 4 + page: 1 + item: blue_orchid + buy: + type: coins + value: 50 + display: $%value% + - id: allium + gui: + column: 1 + row: 1 + page: 2 + item: allium + buy: + type: coins + value: 50 + display: $%value% + - id: azure_bluet + gui: + column: 7 + row: 4 + page: 1 + item: azure_bluet + buy: + type: coins + value: 50 + display: $%value% + - id: red_tulip + gui: + column: 2 + row: 1 + page: 2 + item: red_tulip + buy: + type: coins + value: 50 + display: $%value% + - id: orange_tulip + gui: + column: 3 + row: 1 + page: 2 + item: orange_tulip + buy: + type: coins + value: 50 + display: $%value% + - id: white_tulip + gui: + column: 4 + row: 1 + page: 2 + item: white_tulip + buy: + type: coins + value: 50 + display: $%value% + - id: pink_tulip + gui: + column: 5 + row: 1 + page: 2 + item: pink_tulip + buy: + type: coins + value: 50 + display: $%value% + - id: beetroot + gui: + column: 4 + row: 1 + page: 1 + item: beetroot + buy: + type: coins + value: 60 + display: $%value% + sell: + type: coins + value: 4 + display: $%value% + - id: oxeye_daisy + gui: + column: 6 + row: 1 + page: 2 + item: oxeye_daisy + buy: + type: coins + value: 50 + display: $%value% + - id: cornflower + gui: + column: 7 + row: 1 + page: 2 + item: cornflower + buy: + type: coins + value: 50 + display: $%value% + - id: lily_of_the_valley + gui: + column: 8 + row: 1 + page: 2 + item: lily_of_the_valley + buy: + type: coins + value: 50 + display: $%value% + - id: wither_rose + gui: + column: 9 + row: 1 + page: 2 + item: wither_rose + buy: + type: coins + value: 1000 + display: $%value% + - id: sunflower + gui: + column: 1 + row: 2 + page: 2 + item: sunflower + buy: + type: coins + value: 50 + display: $%value% + - id: lilac + gui: + column: 2 + row: 2 + page: 2 + item: lilac + buy: + type: coins + value: 50 + display: $%value% + - id: rose_bush + gui: + column: 3 + row: 2 + page: 2 + item: rose_bush + buy: + type: coins + value: 50 + display: $%value% + - id: peony + gui: + column: 4 + row: 2 + page: 2 + item: peony + buy: + type: coins + value: 50 + display: $%value% + - id: tall_grass + gui: + column: 5 + row: 2 + page: 2 + item: tall_grass + buy: + type: coins + value: 50 + display: $%value% + - id: large_fern + gui: + column: 6 + row: 2 + page: 2 + item: large_fern + buy: + type: coins + value: 50 + display: $%value% + - id: apple + gui: + column: 5 + row: 1 + page: 1 + item: apple + buy: + type: coins + value: 300 + display: $%value% + sell: + type: coins + value: 20 + display: $%value% + - id: sugar_cane + gui: + column: 9 + row: 2 + page: 2 + item: sugar_cane + buy: + type: coins + value: 60 + display: $%value% + sell: + type: coins + value: 4 + display: $%value% + - id: melon + gui: + column: 1 + row: 3 + page: 2 + item: melon + buy: + type: coins + value: 400 + display: $%value% + sell: + type: coins + value: 6 + display: $%value% + - id: pumpkin + gui: + column: 2 + row: 3 + page: 2 + item: pumpkin + buy: + type: coins + value: 300 + display: $%value% + sell: + type: coins + value: 4 + display: $%value% + - id: kelp + gui: + column: 3 + row: 3 + page: 2 + item: kelp + buy: + type: coins + value: 300 + display: $%value% + sell: + type: coins + value: 2 + display: $%value% + - id: bamboo + gui: + column: 4 + row: 3 + page: 2 + item: bamboo + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 1 + display: $%value% + - id: red_mushroom + gui: + column: 5 + row: 3 + page: 2 + item: red_mushroom + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 5 + display: $%value% + - id: brown_mushroom + gui: + column: 6 + row: 3 + page: 2 + item: brown_mushroom + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 5 + display: $%value% + - id: glow_lichen + gui: + column: 7 + row: 3 + page: 2 + item: glow_lichen + buy: + type: coins + value: 50 + display: $%value% + - id: nether_wart + gui: + column: 8 + row: 3 + page: 2 + item: nether_wart + buy: + type: coins + value: 60 + display: $%value% + sell: + type: coins + value: 6 + display: $%value% + - id: porkchop + gui: + column: 7 + row: 1 + page: 1 + item: porkchop + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 15 + display: $%value% + - id: beef + gui: + column: 8 + row: 1 + page: 1 + item: beef + buy: + type: coins + value: 200 + display: $%value% + sell: + type: coins + value: 15 + display: $%value% + - id: oak_leaves + gui: + column: 3 + row: 2 + page: 1 + item: oak_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: spruce_leaves + gui: + column: 4 + row: 2 + page: 1 + item: spruce_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: birch_leaves + gui: + column: 5 + row: 2 + page: 1 + item: birch_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: azalea_leaves + gui: + column: 1 + row: 3 + page: 1 + item: azalea_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: wheat_seeds + gui: + column: 6 + row: 1 + page: 1 + item: wheat_seeds + buy: + type: coins + value: 40 + display: $%value% + sell: + type: coins + value: 2 + display: $%value% + - id: flowering_azalea + gui: + column: 9 + row: 3 + page: 1 + item: flowering_azalea + buy: + type: coins + value: 600 + display: $%value% + - id: jungle_leaves + gui: + column: 6 + row: 2 + page: 1 + item: jungle_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: acacia_leaves + gui: + column: 7 + row: 2 + page: 1 + item: acacia_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: dark_oak_leaves + gui: + column: 8 + row: 2 + page: 1 + item: dark_oak_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: azalea_leaves + gui: + column: 9 + row: 2 + page: 1 + item: azalea_leaves + buy: + type: coins + value: 4 + display: $%value% + - id: chicken + gui: + column: 9 + row: 1 + page: 1 + item: chicken + buy: + type: coins + value: 100 + display: $%value% + sell: + type: coins + value: 6 + display: $%value% + - id: wheat + gui: + column: 1 + row: 1 + page: 1 + item: wheat + buy: + type: coins + value: 60 + display: $%value% + sell: + type: coins + value: 4 + display: $%value% diff --git a/eco-core/core-plugin/src/main/resources/categories/redstone.yml b/eco-core/core-plugin/src/main/resources/categories/redstone.yml new file mode 100644 index 0000000..a5fcfc7 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/categories/redstone.yml @@ -0,0 +1,185 @@ +item: hopper name:"&aRedstone" +lore: [ ] + +gui: + rows: 4 + title: Redstone + + forwards-arrow: + column: 6 + item: arrow name:"&fNext Page" + row: 4 + backwards-arrow: + column: 4 + item: arrow name:"&fPrevious Page" + row: 4 + + pages: + - page: 1 + mask: + pattern: + - '000000000' + - '000000000' + - '000000000' + - '000000000' + items: [] + +items: + - id: redstone + gui: + column: 1 + row: 2 + page: 1 + item: redstone + buy: + type: coins + value: 20 + display: $%value% + sell: + type: coins + value: 10 + display: $%value% + - id: hopper + gui: + column: 2 + row: 2 + page: 1 + item: hopper + buy: + type: coins + value: 280 + display: $%value% + - id: dropper + gui: + column: 3 + row: 2 + page: 1 + item: dropper + buy: + type: coins + value: 40 + display: $%value% + - id: observer + gui: + column: 4 + row: 2 + page: 1 + item: observer + buy: + type: coins + value: 135 + display: $%value% + - id: repeater + gui: + column: 5 + row: 2 + page: 1 + item: repeater + buy: + type: coins + value: 100 + display: $%value% + - id: comparator + gui: + column: 6 + row: 2 + page: 1 + item: comparator + buy: + type: coins + value: 180 + display: $%value% + - id: dispenser + gui: + column: 1 + row: 1 + page: 1 + item: dispenser + buy: + type: coins + value: 450 + display: $%value% + - id: sticky_piston + gui: + column: 2 + row: 1 + page: 1 + item: sticky_piston + buy: + type: coins + value: 400 + display: $%value% + - id: piston + gui: + column: 3 + row: 1 + page: 1 + item: piston + buy: + type: coins + value: 350 + display: $%value% + - id: lever + gui: + column: 4 + row: 1 + page: 1 + item: lever + buy: + type: coins + value: 10 + display: $%value% + - id: redstone_torch + gui: + column: 5 + row: 1 + page: 1 + item: redstone_torch + buy: + type: coins + value: 30 + display: $%value% + - id: redstone_lamp + gui: + column: 6 + row: 1 + page: 1 + item: redstone_lamp + buy: + type: coins + value: 180 + display: $%value% + - id: tripwire_hook + gui: + column: 7 + row: 1 + page: 1 + item: tripwire_hook + buy: + type: coins + value: 75 + display: $%value% + - id: daylight_detector + gui: + column: 8 + row: 1 + page: 1 + item: daylight_detector + buy: + type: coins + value: 150 + display: $%value% + - id: redstone_block + gui: + column: 9 + row: 1 + page: 1 + item: redstone_block + buy: + type: coins + value: 180 + display: $%value% + sell: + type: coins + value: 90 + display: $%value% diff --git a/eco-core/core-plugin/src/main/resources/config.yml b/eco-core/core-plugin/src/main/resources/config.yml new file mode 100644 index 0000000..267edf6 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/config.yml @@ -0,0 +1,286 @@ +# +# EcoShop +# by Auxilor +# + +shop-items: + global-bottom-lore: # Options for global lore to be shown on all shop icons, disabled by default. + buy: [ ] # Shown under buyable items. + # - "&e&oLeft Click to buy" + sell: [ ] # Shown under sellable items. + # - "&e&oRight Click to sell" + always: [ ] # Always shown. + +buy-menu: + rows: 6 # How many rows for the GUI + + title: "Buying %item%" + + mask: # The background material + items: + - black_stained_glass_pane + - gray_stained_glass_pane + pattern: # 1 for the first item, 2 for the second item, etc + - "111111111" + - "122202221" + - "122222221" + - "122222221" + - "122020221" + - "111101111" + + item: + row: 2 + column: 5 + + buy-more: + row: 6 + column: 5 + item: emerald 64 unbreaking:1 hide_enchants name:"&aBuy More" + + cancel: + row: 5 + column: 4 + item: barrier name:"&cCancel" + + confirm: + row: 5 + column: 6 + item: diamond unbreaking:1 hide_enchants name:"&aConfirm" + + add-buttons: + - add: 1 + row: 4 + column: 6 + item: lime_concrete 1 name:"&a+1" + + - add: 10 + row: 4 + column: 7 + item: lime_concrete 10 name:"&a+10" + + - add: -1 + row: 4 + column: 4 + item: red_concrete 1 name:"&c-1" + + - add: -10 + row: 4 + column: 3 + item: red_concrete 10 name:"&c-10" + + set-buttons: + - set: 1 + row: 4 + column: 2 + item: red_concrete 1 name:"&cSet to one" + + - set: 64 + row: 4 + column: 8 + item: lime_concrete 64 name:"&aSet to full stack" + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] + +buy-more: + rows: 2 + + title: "Buying more %item%" + + mask: # The background material + items: + - black_stained_glass_pane + pattern: # 1 for the first item, 2 for the second item, etc + - "000000000" + - "111101111" + + item-name: "&fBuy &a%stacks%&f stacks" + + amounts: + - stacks: 1 + row: 1 + column: 1 + + - stacks: 2 + row: 1 + column: 2 + + - stacks: 3 + row: 1 + column: 3 + + - stacks: 4 + row: 1 + column: 4 + + - stacks: 5 + row: 1 + column: 5 + + - stacks: 6 + row: 1 + column: 6 + + - stacks: 7 + row: 1 + column: 7 + + - stacks: 8 + row: 1 + column: 8 + + - stacks: 9 + row: 1 + column: 9 + + back: + row: 2 + column: 5 + item: arrow 1 name:"&cGo Back" + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] + +sell-menu: + rows: 6 # How many rows for the GUI + + title: "Selling %item%" + + mask: # The background material + items: + - black_stained_glass_pane + - gray_stained_glass_pane + pattern: # 1 for the first item, 2 for the second item, etc + - "111111111" + - "122202221" + - "122222221" + - "122222221" + - "122020221" + - "111101111" + + item: + row: 2 + column: 5 + + sell-more: + row: 6 + column: 5 + item: emerald 64 unbreaking:1 hide_enchants name:"&aSell More" + + cancel: + row: 5 + column: 4 + item: barrier name:"&cCancel" + + confirm: + row: 5 + column: 6 + item: diamond unbreaking:1 hide_enchants name:"&aConfirm" + + add-buttons: + - add: 1 + row: 4 + column: 6 + item: red_concrete 1 name:"&c+1" + + - add: 10 + row: 4 + column: 7 + item: red_concrete 10 name:"&c+10" + + - add: -1 + row: 4 + column: 4 + item: lime_concrete 1 name:"&a-1" + + - add: -10 + row: 4 + column: 3 + item: lime_concrete 10 name:"&a-10" + + set-buttons: + - set: 1 + row: 4 + column: 2 + item: lime_concrete 1 name:"&aSet to one" + + - set: 64 + row: 4 + column: 8 + item: red_concrete 64 name:"&cSet to full stack" + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] + +sell-more: + rows: 2 + + title: "Selling more %item%" + + mask: # The background material + items: + - black_stained_glass_pane + pattern: # 1 for the first item, 2 for the second item, etc + - "000000000" + - "111101111" + + item-name: "&fSell &a%stacks%&f stacks" + + amounts: + - stacks: 1 + row: 1 + column: 1 + + - stacks: 2 + row: 1 + column: 2 + + - stacks: 3 + row: 1 + column: 3 + + - stacks: 4 + row: 1 + column: 4 + + - stacks: 5 + row: 1 + column: 5 + + - stacks: 6 + row: 1 + column: 6 + + - stacks: 7 + row: 1 + column: 7 + + - stacks: 8 + row: 1 + column: 8 + + - stacks: 9 + row: 1 + column: 9 + + back: + row: 2 + column: 5 + item: arrow 1 name:"&cGo Back" + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] + +# Options for the mass-sell gui (/sell) +sell-gui: + rows: 6 + title: Sell Items + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: + - row: 6 + column: 9 + item: paper 1 unbreaking:1 hide_enchants name:"&aDrop items in here to sell them!" + lore: + - "&fWhen you close this menu, all" + - "&fitems inside it will be sold!" diff --git a/eco-core/core-plugin/src/main/resources/eco.yml b/eco-core/core-plugin/src/main/resources/eco.yml new file mode 100644 index 0000000..4b55bed --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/eco.yml @@ -0,0 +1,4 @@ +resource-id: 0 +bstats-id: 16978 +color: 'Lb852' +supports-extensions: false \ No newline at end of file diff --git a/eco-core/core-plugin/src/main/resources/lang.yml b/eco-core/core-plugin/src/main/resources/lang.yml new file mode 100644 index 0000000..7cf296d --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/lang.yml @@ -0,0 +1,71 @@ +messages: + prefix: "Lb852&lEcoShop&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" + + must-specify-player: "&cYou must specify a player!" + invalid-player: "&cInvalid player!" + must-specify-item: "&cYou must specify an item!" + invalid-item: "&cInvalid item!" + reset-buys: "&fReset how many times &r%player%&r&f bought &r%item%&f!" + + sell-status: + cannot-sell: "&cThis item can't be sold!" + no-permission: "&cYou don't have permission to sell this item!" + missing-requirements: "&cYou can't sell this item!" + dont-have-item: "&cYou don't have any of this item!" + dont-have-enough: "&cYou don't have enough of this item!" + + buy-status: + cannot-buy: "&cThis item can't be bought!" + bought-too-many: "&cYou can't buy this item again!" + no-permission: "&cYou don't have permission to buy this item!" + missing-requirements: "&cYou can't buy this item!" + cannot-afford: "&cYou need &a%price%&r&c to buy this!" + + bought-item: "&fYou bought %item%&r&f for %price%&r&f!" + bought-item-multiple: "&fYou bought %amount%x&r %item%&r&f for %price%&r&f!" + sold-item: "&fYou sold %amount%x&r %item%&r&f for %price%&r&f!" + + must-specify-sell-type: "&cYou must specify sell type! (hand/all/handall)" + invalid-sell-type: "&cInvalid sell type! (hand/all/handall)" + + not-sellable: "&cYou can't sell this item!" + no-sellable: "&cThere are no sellable items in your inventory!" + + invalid-shop-config: "&cYour config for shop %shop% is invalid! Check that your direct-category points to a category that exists." + +lore: + missing-requirements: + - "&cYou can't buy this item!" + no-permission: + - "&cYou don't have permission to buy this item!" + +one-buy-price: + - "&fPrice: &a%price%" +dual-buy-price: + - "&fPrice: &a%price%&r&f or &a%alt_price%" +cant-buy-again: + - "&cYou can't buy this item again!" + +buy-price: + - "&fBuy Price: &a%price%&r&f each" +sell-price: + - "&fSell Price: &c%price%&r&f each" + +confirm-buy-price: + - "&fBuy Price: &a%price%" +confirm-sell-price: + - "&fSell Price: &c%price%" + +quick-buy: + - "&8&oQuick-buy %amount% by shift left-clicking" +quick-sell: + - "&8&oQuick-sell all by shift right-clicking" + +quick-buy-alt-present: + - "&8&oQuick-buy %amount% for %price%&r&8&o by shift left-clicking" +quick-buy-alt: + - "&8&oQuick-buy %amount% for %price%&r&8&o by shift right-clicking" diff --git a/eco-core/core-plugin/src/main/resources/plugin.yml b/eco-core/core-plugin/src/main/resources/plugin.yml new file mode 100644 index 0000000..d07a701 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/plugin.yml @@ -0,0 +1,59 @@ +name: EcoShop +version: ${projectVersion} +main: com.willfp.ecoshop.EcoShopPlugin +api-version: 1.17 +authors: [ Auxilor ] +website: willfp.com +load: STARTUP +depend: + - eco + - ProtocolLib +softdepend: [] + +commands: + ecoshop: + description: Base plugin command + permission: ecoshop.command.ecoshop + sell: + description: Sells items + permission: ecoshop.command.sell + +permissions: + ecoshop.command.sell.*: + description: All sell permissions + default: true + children: + ecoshop.command.sell: true + ecoshop.command.sell.hand: true + ecoshop.command.sell.all: true + ecoshop.command.sell.handall: true + ecoshop.*: + description: All ecoshop permissions + default: op + children: + ecoshop.command.reload: true + ecoshop.command.resetbuys: true + ecoshop.command.ecoshop: true + ecoshop.command.sell.*: true + + ecoshop.command.ecoshop: + description: Allows the use of /ecoshop (base command) + default: true + ecoshop.command.reload: + description: Allows reloading the config + default: op + ecoshop.command.resetbuys: + description: Allows resetting buys (for testing) + default: op + ecoshop.command.sell: + description: Allows the use of /sell and the /sell GUI + default: true + ecoshop.command.sell.hand: + description: Allows the use of /sell hand + default: true + ecoshop.command.sell.all: + description: Allows the use of /sell all + default: true + ecoshop.command.sell.handall: + description: Allows the use of /sell handall + default: true diff --git a/eco-core/core-plugin/src/main/resources/shops/_example.yml b/eco-core/core-plugin/src/main/resources/shops/_example.yml new file mode 100644 index 0000000..017df92 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/shops/_example.yml @@ -0,0 +1,75 @@ +# The ID of the shop is the name of the .yml file, +# for example donator.yml has the ID of donator +# You can place shops anywhere in this folder, +# including in subfolders if you want to organize your shop configs +# _example.yml is not loaded. + +title: Demo Shop # The GUI title. +command: demoshop # The command to open the shop. + +forwards-arrow: # The arrow for switching between pages. If on the last page, this will not show up. + item: arrow name:"&fNext Page" + row: 6 + column: 6 + +backwards-arrow: # The arrow for switching between pages. If on the first page, this will not show up. + item: arrow name:"&fPrevious Page" + row: 6 + column: 4 + +buy-broadcasts: # Options for buy broadcasts + enabled: true # If purchases in this shop should be broadcast to the server, good for /buy menus. + message: "&b&lCrystal Shop&r &8»&r %player%&r&f has bought &r%item%&r&ffrom the &bCrystal Shop ❖&f!" # Use %player%, %item%, and %amount% + sound: # Broadcast sound, remove this section if you don't want a sound. + sound: ui_toast_challenge_complete + pitch: 1.5 + volume: 2 + +click-sound: # A sound to be played when clicking an icon in this shop, remove this section if you don't want a sound. + sound: block_stone_button_click_on # The sound https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html + pitch: 1 # The pitch (0.5 - 2) + volume: 1 + +buy-sound: # A sound to be played when buying something in this shop, remove this section if you don't want a sound. + sound: entity_player_levelup + pitch: 2 + volume: 1 + +sell-sound: # A sound to be played when selling something in this shop, remove this section if you don't want a sound. + sound: block_amethyst_block_place + pitch: 1.5 + volume: 1 + +# Shops can work in two ways. + +# You can either have a shop contain a list of categories, or you can make a shop be one +# category that you're instantly sent to (for single page shops, e.g. a boss spawn egg shop) + +# If you want a single-page shop, use direct-category to link it straight to a category +# direct-category: example_category + +# If you want a regular shop that contains multiple categories, use these options here +rows: 3 +pages: # All the pages in the preview GUI. You can add as many pages as you want. + - page: 1 + mask: # Filler items for decoration + items: # Add as many items as you want + - gray_stained_glass_pane # Item 1 + - black_stained_glass_pane # Item 2 + pattern: + - "222222222" + - "211111112" + - "211000112" + - "211000112" + - "211111112" + - "222222222" + categories: # Where to put categories in the GUI + - id: example # The category ID + row: 3 # The row + column: 3 # The column + - id: example_2 + row: 4 + column: 6 + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] diff --git a/eco-core/core-plugin/src/main/resources/shops/shop.yml b/eco-core/core-plugin/src/main/resources/shops/shop.yml new file mode 100644 index 0000000..fafd038 --- /dev/null +++ b/eco-core/core-plugin/src/main/resources/shops/shop.yml @@ -0,0 +1,83 @@ +title: Shop +command: shop + +forwards-arrow: + item: arrow name:"&fNext Page" + row: 3 + column: 6 + +backwards-arrow: + item: arrow name:"&fPrevious Page" + row: 3 + column: 4 + +buy-broadcasts: + enabled: false + message: "" + +click-sound: + sound: block_stone_button_click_on + pitch: 1 + volume: 1 + +buy-sound: + sound: entity_player_levelup + pitch: 2 + volume: 1 + +sell-sound: + sound: block_amethyst_block_place + pitch: 1.5 + volume: 1 + +rows: 3 +pages: + - page: 1 + mask: + items: + - lime_stained_glass_pane + - black_stained_glass_pane + pattern: + - "221111122" + - "000000000" + - "221111122" + + categories: + - id: dyes + row: 2 + column: 1 + + - id: mob_drops + row: 2 + column: 2 + + - id: blocks + row: 2 + column: 3 + + - id: colored_blocks + row: 2 + column: 4 + + - id: minerals + row: 2 + column: 5 + + - id: nature + row: 2 + column: 6 + + - id: redstone + row: 2 + column: 7 + + - id: food + row: 2 + column: 8 + + - id: gear + row: 2 + column: 9 + + # Custom GUI slots; see here for a how-to: https://plugins.auxilor.io/all-plugins/custom-gui-slots + custom-slots: [ ] diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..6f17569 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +version = 1.0.0 +plugin-name = EcoShop \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..41d9927 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/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/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${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 + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + 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 +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 +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# 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. + +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' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..caba981 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,6 @@ +jdk: openjdk17 +before_install: + - source "$HOME/.sdkman/bin/sdkman-init.sh" + - sdk update + - sdk install java 17.0.1-tem + - sdk use java 17.0.1-tem \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..66c4cb4 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'EcoShop' + +// Core +include ':eco-core' +include ':eco-core:core-plugin'