Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f228180350 | |||
| 072e7e294c | |||
| 3a708c054c |
+16
-20
@@ -1,31 +1,27 @@
|
||||
# Build output
|
||||
# Maven build outputs
|
||||
target/
|
||||
build/
|
||||
.gradle/
|
||||
out/
|
||||
bin/
|
||||
*.class
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
# Node (remnants of any old embedded web-panel)
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
# IDE / tooling
|
||||
# IntelliJ IDEA
|
||||
.idea/
|
||||
*.iml
|
||||
.vscode/
|
||||
.claude/
|
||||
.settings/
|
||||
*.iws
|
||||
*.ipr
|
||||
|
||||
# Eclipse
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
|
||||
# OS
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
|
||||
# Local / logs
|
||||
# Local dev
|
||||
*.log
|
||||
build_output.txt
|
||||
dependency-reduced-pom.xml
|
||||
run/
|
||||
logs/
|
||||
|
||||
@@ -1,674 +1,22 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Copyright (c) 2026 Henrique
|
||||
|
||||
Preamble
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
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.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
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
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
# CommunityMarket
|
||||
|
||||
[](https://modrinth.com/plugin/carrageis-communitymarket)
|
||||
[](https://modrinth.com/plugin/communitymarket)
|
||||
[](LICENSE)
|
||||
|
||||
A professional, production-ready **GUI-only marketplace plugin** for Minecraft Paper 1.21+.
|
||||
|
||||
Players can create fixed-price listings and auctions, browse, buy, bid, claim items, and withdraw earnings — all through intuitive GUIs. **No complex commands to learn!**
|
||||
|
||||
Features
|
||||
## ✨ Features
|
||||
|
||||
Fixed-Price Market
|
||||
### 🛒 Fixed-Price Market
|
||||
- Create listings with custom prices and durations
|
||||
- Browse paginated listings with sorting
|
||||
- Safe atomic purchases to prevent double-buying
|
||||
- Configurable taxes on sales
|
||||
|
||||
Auction System
|
||||
### 🔨 Auction System
|
||||
- Start auctions with minimum bid and optional buyout price
|
||||
- **Anti-snipe protection** extends auction when bids arrive near the end
|
||||
- Bid history and automatic outbid notifications
|
||||
- Safe handling of auction endings and payouts
|
||||
|
||||
Claim Storage
|
||||
### 📦 Claim Storage
|
||||
- Items from expired listings go to claim storage
|
||||
- Won auction items are safely delivered
|
||||
- Handles full inventories gracefully
|
||||
|
||||
Earnings Management
|
||||
### 💰 Earnings Management
|
||||
- Pending earnings from sales accumulate
|
||||
- Withdraw all earnings at once
|
||||
- Complete transaction history
|
||||
|
||||
Admin Features (GUI-based)
|
||||
### 🔐 Admin Features (GUI-based)
|
||||
- View all listings and auctions
|
||||
- Remove any listing or cancel auctions
|
||||
- Force-end auctions
|
||||
- Reload configuration in-game
|
||||
|
||||
Intuitive GUI Flow
|
||||
### 🎮 Intuitive GUI Flow
|
||||
The creation flow for listings and auctions:
|
||||
1. **Main Menu** - Central hub for all actions
|
||||
2. **Select Item** - Click an item from your inventory
|
||||
@@ -45,7 +45,7 @@ The creation flow for listings and auctions:
|
||||
4. **Settings** - Set price and duration with easy click-to-adjust controls
|
||||
5. **Confirm** - Review and create your listing/auction
|
||||
|
||||
Requirements
|
||||
## 📋 Requirements
|
||||
|
||||
| Requirement | Version |
|
||||
|-------------|---------|
|
||||
@@ -57,23 +57,23 @@ Requirements
|
||||
CommunityMarket supports two economy configurations:
|
||||
|
||||
1. **Vault + Economy Plugin** (Recommended)
|
||||
- Install [VaultUnlocked](https://modrinth.com/plugin/vaultunlocked)
|
||||
- Install [Vault](https://modrinth.com/plugin/vault-2.0-economy-plugins)
|
||||
- Install an economy plugin: [EssentialsX](https://essentialsx.net/), CMI, or any Vault-compatible economy
|
||||
|
||||
2. **EssentialsX Standalone** (Fallback)
|
||||
- Install [EssentialsX](https://essentialsx.net/) with economy enabled
|
||||
- CommunityMarket will use EssentialsX directly if Vault is not present
|
||||
|
||||
Installation
|
||||
## 📥 Installation
|
||||
|
||||
1. Download the latest `CommunityMarket-x.x.x.jar` from [Modrinth](https://modrinth.com/plugin/carrageis-communitymarket)
|
||||
1. Download the latest `CommunityMarket-x.x.x.jar` from [Modrinth](https://modrinth.com/plugin/communitymarket)
|
||||
2. Place it in your server's `plugins/` folder
|
||||
3. Ensure you have an economy system installed (see above)
|
||||
4. Start or restart your server
|
||||
5. Edit `plugins/CommunityMarket/config.yml` as needed
|
||||
6. Use `/market` to open the marketplace!
|
||||
|
||||
Commands
|
||||
## 🎮 Commands
|
||||
|
||||
| Command | Alias | Description | Permission |
|
||||
|---------|-------|-------------|------------|
|
||||
@@ -81,7 +81,7 @@ Commands
|
||||
|
||||
**That's it!** Everything else is done through GUIs.
|
||||
|
||||
Permissions
|
||||
## 🔒 Permissions
|
||||
|
||||
| Permission | Description | Default |
|
||||
|------------|-------------|---------|
|
||||
@@ -94,8 +94,11 @@ Permissions
|
||||
| `communitymarket.claim` | Claim items from storage | everyone |
|
||||
| `communitymarket.withdraw` | Withdraw earnings | everyone |
|
||||
| `communitymarket.admin` | Access admin functions | op |
|
||||
| `communitymarket.admin.viewall` | View all listings/auctions | op |
|
||||
| `communitymarket.admin.remove` | Remove any listing/auction | op |
|
||||
| `communitymarket.admin.reload` | Reload configuration | op |
|
||||
|
||||
Configuration
|
||||
## ⚙️ Configuration
|
||||
|
||||
### config.yml Highlights
|
||||
|
||||
@@ -145,7 +148,7 @@ gui:
|
||||
|
||||
Language files are located in `plugins/CommunityMarket/lang/` and can be customized.
|
||||
|
||||
Troubleshooting
|
||||
## 🔧 Troubleshooting
|
||||
|
||||
### "No compatible economy provider found!"
|
||||
|
||||
@@ -153,7 +156,7 @@ This error appears when CommunityMarket cannot find an economy system.
|
||||
|
||||
**Solutions:**
|
||||
1. **Install Vault + an economy plugin:**
|
||||
- Download [VaultUnlocked](https://modrinth.com/plugin/vaultunlocked)
|
||||
- Download [Vault]([https://www.spigotmc.org/resources/vault.34315/](https://modrinth.com/plugin/vault-2.0-economy-plugins))
|
||||
- Download [EssentialsX](https://essentialsx.net/) or another economy plugin
|
||||
- Restart your server
|
||||
|
||||
@@ -187,20 +190,20 @@ database:
|
||||
password: your_password
|
||||
```
|
||||
|
||||
API
|
||||
## 📊 API
|
||||
|
||||
CommunityMarket does not currently provide a public API. If you need integration capabilities, please open an issue on GitHub.
|
||||
|
||||
Support
|
||||
## 🤝 Support
|
||||
|
||||
- **Issues & Bug Reports:** [GitHub Issues](https://github.com/henriquescrrrr/carrageis-communitymarket/issues)
|
||||
- **Feature Requests:** [GitHub Issues](https://github.com/henriquescrrrr/carrageis-communitymarket/issues)
|
||||
- **Issues & Bug Reports:** [GitHub Issues](https://github.com/henrique/CommunityMarket/issues)
|
||||
- **Feature Requests:** [GitHub Issues](https://github.com/henrique/CommunityMarket/issues)
|
||||
|
||||
License
|
||||
## 📜 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
Credits
|
||||
## 🙏 Credits
|
||||
|
||||
- Built for the Paper/Spigot community
|
||||
- Uses [Vault](https://github.com/MilkBowl/VaultAPI) for economy integration
|
||||
|
||||
@@ -39,14 +39,6 @@
|
||||
</relocation>
|
||||
</relocations>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>org.xerial:sqlite-jdbc</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -95,20 +95,6 @@
|
||||
</relocation>
|
||||
</relocations>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<!--
|
||||
The SQLite driver is loaded by class name at runtime
|
||||
(setDriverClassName("org.sqlite.JDBC")), so minimizeJar's static
|
||||
reachability analysis cannot see it and would strip it, breaking the
|
||||
default SQLite backend. Force its classes (and native libs) to be kept.
|
||||
-->
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>org.xerial:sqlite-jdbc</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
# ServerShop
|
||||
|
||||
A professional **server-run global market** plugin for **Paper/Purpur 1.21** using **Java 21** and **Maven**.
|
||||
|
||||
ServerShop is designed to complement the [CommunityMarket](../README.md) player-to-player marketplace plugin. By maintaining a **large spread** between buy and sell prices (default: server buys at only 25% of the buy price), the server shop provides an economic safety net while keeping player-to-player trading attractive.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **GUI-only** — all interactions through clean, paginated GUIs
|
||||
- **Category-based shop** — Blocks, Ores, Farming, Food, Mob Drops, Redstone, Decoration, Tools, Combat, Brewing, Misc
|
||||
- **All Minecraft items** supported via `Material` enumeration; unknown/new items fall back to Misc
|
||||
- **Quantity selector** — adjust buy/sell quantity in the item detail GUI
|
||||
- **Vault economy integration** (required)
|
||||
- **Configurable pricing** — per-item and per-category overrides in `prices.yml`
|
||||
- **Large spread** — server buys at 25% of sell price by default (fully configurable)
|
||||
- **i18n** — English (`en_US`) and Portuguese (`pt_PT`) included; easy to add more
|
||||
- **Optional SQLite transaction logging**
|
||||
- **Anti-exploit** — shift-click, drag, number-swap events are all cancelled
|
||||
- **Modrinth-ready** documentation
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
| Requirement | Version |
|
||||
|-------------|---------|
|
||||
| Paper / Purpur | 1.21+ |
|
||||
| Java | 21+ |
|
||||
| Vault | Any compatible version |
|
||||
| Economy plugin | e.g. EssentialsX, CMI |
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
1. Download `ServerShop-<version>.jar` from Modrinth / GitHub Releases.
|
||||
2. Place the JAR in your server's `plugins/` folder.
|
||||
3. Make sure [Vault](https://www.spigotmc.org/resources/vault.34315/) and a compatible economy plugin are installed.
|
||||
4. Start the server — default `config.yml`, `prices.yml`, and language files will be generated.
|
||||
5. Edit `plugins/ServerShop/config.yml` and `plugins/ServerShop/prices.yml` as needed.
|
||||
6. Run `/shop reload` (requires `servershop.admin.reload`) to apply changes without restarting.
|
||||
|
||||
---
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Description | Permission |
|
||||
|---------|-------------|------------|
|
||||
| `/shop` | Opens the main shop GUI | `servershop.use` |
|
||||
| `/shop reload` | Reloads all configuration | `servershop.admin.reload` |
|
||||
|
||||
Aliases: `/servershop`, `/sshop`
|
||||
|
||||
---
|
||||
|
||||
## Permissions
|
||||
|
||||
| Permission | Default | Description |
|
||||
|------------|---------|-------------|
|
||||
| `servershop.*` | op | All permissions |
|
||||
| `servershop.use` | true | Open the shop |
|
||||
| `servershop.buy` | true | Buy items |
|
||||
| `servershop.sell` | true | Sell items |
|
||||
| `servershop.admin` | op | Admin commands |
|
||||
| `servershop.admin.reload` | op | Reload configuration |
|
||||
|
||||
---
|
||||
|
||||
## How Pricing Works (Spread Explanation)
|
||||
|
||||
The shop deliberately maintains a **large spread** between buy and sell prices to keep player-to-player trading in CommunityMarket more economically attractive.
|
||||
|
||||
**Example with default settings:**
|
||||
|
||||
| Item | Buy Price (player buys) | Sell Price (player sells) | Spread |
|
||||
|------|------------------------|--------------------------|--------|
|
||||
| Diamond | $50.00 | $12.50 | 75% |
|
||||
| Iron Ingot | $5.00 | $1.25 | 75% |
|
||||
| Wheat | $1.00 | $0.25 | 75% |
|
||||
|
||||
If a player wants to sell diamonds, they get **$12.50** from the server shop. On the CommunityMarket, another player might pay **$35–$45** — much more attractive.
|
||||
|
||||
### Configuring the spread
|
||||
|
||||
In `config.yml`:
|
||||
```yaml
|
||||
pricing:
|
||||
global-sell-multiplier: 0.25 # Server pays 25% of buy price (75% spread)
|
||||
```
|
||||
|
||||
Per-category overrides:
|
||||
```yaml
|
||||
pricing:
|
||||
category-sell-multipliers:
|
||||
BLOCKS: 0.20 # 80% spread on blocks
|
||||
ORES: 0.20 # 80% spread on ores
|
||||
FOOD: 0.30 # 70% spread on food
|
||||
```
|
||||
|
||||
Per-item explicit prices in `prices.yml`:
|
||||
```yaml
|
||||
categories:
|
||||
ORES:
|
||||
items:
|
||||
DIAMOND:
|
||||
buy-price: 50.00
|
||||
sell-price: 12.50 # explicit override
|
||||
NETHERITE_INGOT:
|
||||
buy-price: 500.00
|
||||
sell-enabled: false # cannot sell netherite back to the server
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## How to Edit Categories & Prices
|
||||
|
||||
### `prices.yml` structure
|
||||
|
||||
```yaml
|
||||
categories:
|
||||
CATEGORY_NAME:
|
||||
display-name: "&7Human Readable Name"
|
||||
icon: MATERIAL_NAME # icon shown in the category GUI
|
||||
buy-enabled: true # can players buy from this category?
|
||||
sell-enabled: true # can players sell to this category?
|
||||
items:
|
||||
MATERIAL_NAME:
|
||||
buy-price: 10.00 # price to buy 1x from server
|
||||
sell-price: 2.50 # price server pays for 1x (optional — uses multiplier if omitted)
|
||||
buy-enabled: true # per-item override (optional)
|
||||
sell-enabled: true # per-item override (optional)
|
||||
```
|
||||
|
||||
- Set `buy-price: -1` to disable buying a specific item.
|
||||
- Set `sell-price: -1` (or `sell-enabled: false`) to disable selling a specific item.
|
||||
- Items not listed in any category automatically appear in **Misc** with a default price of $10.00 buy / $2.50 sell.
|
||||
|
||||
### Special-meta items
|
||||
|
||||
By default, items with special metadata (enchanted books, potions, tipped arrows) are **excluded** because they can't be meaningfully sold without meta matching. You can change this:
|
||||
|
||||
```yaml
|
||||
features:
|
||||
include-special-meta-items: false # default
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration Reference
|
||||
|
||||
### `config.yml`
|
||||
|
||||
```yaml
|
||||
language: en_US # Language (en_US, pt_PT)
|
||||
|
||||
economy:
|
||||
currency-format: "$#,##0.00" # Java DecimalFormat pattern
|
||||
currency-symbol: "$"
|
||||
|
||||
pricing:
|
||||
global-sell-multiplier: 0.25 # Global buy→sell multiplier
|
||||
sell-tax-percent: 0.0 # Optional tax on sell proceeds
|
||||
category-sell-multipliers: # Per-category overrides
|
||||
BLOCKS: 0.20
|
||||
|
||||
full-inventory-behavior: DROP # DROP or CANCEL
|
||||
|
||||
gui:
|
||||
main-title: "&6&lServer Shop"
|
||||
filler-material: GRAY_STAINED_GLASS_PANE
|
||||
|
||||
features:
|
||||
enable-buying: true
|
||||
enable-selling: true
|
||||
sell-hand-button: true
|
||||
sell-inventory-button: true
|
||||
include-special-meta-items: false
|
||||
|
||||
logging:
|
||||
enabled: true
|
||||
file: transactions.db
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Transaction Logging
|
||||
|
||||
When `logging.enabled: true` (default), every buy and sell is recorded in an SQLite database at `plugins/ServerShop/transactions.db`.
|
||||
|
||||
Schema:
|
||||
```sql
|
||||
CREATE TABLE transactions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
uuid TEXT,
|
||||
player TEXT,
|
||||
type TEXT, -- 'BUY' or 'SELL'
|
||||
material TEXT,
|
||||
amount INTEGER,
|
||||
unit_price REAL,
|
||||
total REAL,
|
||||
timestamp INTEGER -- Unix epoch seconds
|
||||
);
|
||||
```
|
||||
|
||||
You can query this with any SQLite client or DB browser to generate sales reports.
|
||||
|
||||
---
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- No admin GUI for viewing transaction stats (planned for v2).
|
||||
- Search functionality is not implemented in v1 (planned for v2).
|
||||
- Items with special meta (potions, enchanted books) are excluded by default; when enabled, only the base type is priced (no meta matching).
|
||||
- The `sell-inventory` button sells **all** sellable items in the inventory at once — use with caution.
|
||||
- Quantities are capped to 64 × inventory size; extremely large transactions may be slow.
|
||||
|
||||
---
|
||||
|
||||
## Building from Source
|
||||
|
||||
```bash
|
||||
cd servershop
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
The shaded JAR will be in `servershop/target/servershop-1.0.0.jar`.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT — see the root [LICENSE](../LICENSE) file.
|
||||
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>pt.henrique</groupId>
|
||||
<artifactId>servershop</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ServerShop</name>
|
||||
<description>A server-run global market plugin for Paper/Purpur 1.21 with large buy/sell spread to complement CommunityMarket</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<paper.version>1.21.1-R0.1-SNAPSHOT</paper.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<!-- Paper Repository -->
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<!-- Vault Repository -->
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Paper API -->
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>${paper.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Vault API for Economy -->
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SQLite JDBC Driver -->
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.45.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.12.1</version>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.sqlite</pattern>
|
||||
<shadedPattern>pt.henrique.servershop.libs.sqlite</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,192 @@
|
||||
package pt.henrique.servershop;
|
||||
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import pt.henrique.servershop.category.CategoryRegistry;
|
||||
import pt.henrique.servershop.command.ShopCommand;
|
||||
import pt.henrique.servershop.economy.EconomyManager;
|
||||
import pt.henrique.servershop.gui.*;
|
||||
import pt.henrique.servershop.i18n.LangManager;
|
||||
import pt.henrique.servershop.pricing.PricingService;
|
||||
import pt.henrique.servershop.storage.TransactionLogger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Main entry point for the <strong>ServerShop</strong> plugin.
|
||||
*
|
||||
* <p>ServerShop is a server-run global market designed to coexist with the
|
||||
* CommunityMarket player-to-player plugin. A deliberately large spread
|
||||
* between buy and sell prices keeps player-to-player trading more attractive.
|
||||
*
|
||||
* <p>Startup order:
|
||||
* <ol>
|
||||
* <li>Load {@code config.yml} and {@code prices.yml}</li>
|
||||
* <li>Initialise localisation (LangManager)</li>
|
||||
* <li>Hook into Vault economy (required)</li>
|
||||
* <li>Load categories (CategoryRegistry)</li>
|
||||
* <li>Load prices (PricingService)</li>
|
||||
* <li>Initialise optional transaction logger (SQLite)</li>
|
||||
* <li>Register commands and GUI event listener</li>
|
||||
* </ol>
|
||||
*/
|
||||
public final class ServerShop extends JavaPlugin {
|
||||
|
||||
private static ServerShop instance;
|
||||
|
||||
private FileConfiguration pricesConfig;
|
||||
|
||||
private LangManager langManager;
|
||||
private EconomyManager economyManager;
|
||||
private CategoryRegistry categoryRegistry;
|
||||
private PricingService pricingService;
|
||||
private TransactionLogger transactionLogger;
|
||||
|
||||
// GUI components
|
||||
private GuiController guiController;
|
||||
private MainCategoryGui mainCategoryGui;
|
||||
private CategoryGui categoryGui;
|
||||
private ItemDetailGui itemDetailGui;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
|
||||
// Ensure default config files are present on disk
|
||||
saveDefaultConfig();
|
||||
savePricesConfig();
|
||||
|
||||
// Reload config from disk (picks up any player edits)
|
||||
reloadConfig();
|
||||
|
||||
// Language
|
||||
langManager = new LangManager(this);
|
||||
langManager.load();
|
||||
|
||||
// Vault economy (required)
|
||||
economyManager = new EconomyManager(this);
|
||||
if (!economyManager.setup()) {
|
||||
getLogger().severe("Vault economy provider not found!");
|
||||
getLogger().severe("ServerShop requires Vault and a compatible economy plugin.");
|
||||
getLogger().severe("Disabling ServerShop.");
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Prices configuration
|
||||
pricesConfig = loadPricesConfig();
|
||||
|
||||
// Category registry and pricing
|
||||
categoryRegistry = new CategoryRegistry(this);
|
||||
categoryRegistry.load();
|
||||
|
||||
pricingService = new PricingService(this);
|
||||
pricingService.load();
|
||||
|
||||
// Optional transaction logger
|
||||
transactionLogger = new TransactionLogger(this);
|
||||
transactionLogger.initialize();
|
||||
|
||||
// GUI subsystem
|
||||
guiController = new GuiController();
|
||||
mainCategoryGui = new MainCategoryGui(this);
|
||||
categoryGui = new CategoryGui(this);
|
||||
itemDetailGui = new ItemDetailGui(this);
|
||||
|
||||
// Register GUI listener
|
||||
getServer().getPluginManager().registerEvents(new ShopGuiListener(this), this);
|
||||
|
||||
// Register /shop command
|
||||
ShopCommand shopCommand = new ShopCommand(this);
|
||||
PluginCommand cmd = getCommand("shop");
|
||||
if (cmd != null) {
|
||||
cmd.setExecutor(shopCommand);
|
||||
cmd.setTabCompleter(shopCommand);
|
||||
}
|
||||
|
||||
getLogger().info("ServerShop v" + getDescription().getVersion() + " enabled successfully.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (transactionLogger != null) {
|
||||
transactionLogger.shutdown();
|
||||
}
|
||||
getLogger().info("ServerShop disabled.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads all configuration, language, categories, and prices.
|
||||
* Called by {@code /shop reload}.
|
||||
*
|
||||
* <p>The transaction logger is intentionally NOT reloaded here because
|
||||
* it holds an open database connection. The logging configuration is only
|
||||
* read at startup; a full server restart is required to change it.
|
||||
*/
|
||||
public void reload() {
|
||||
reloadConfig();
|
||||
pricesConfig = loadPricesConfig();
|
||||
langManager.load();
|
||||
categoryRegistry.load();
|
||||
pricingService.load();
|
||||
getLogger().info("ServerShop configuration reloaded.");
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Accessors
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
public static ServerShop getInstance() { return instance; }
|
||||
|
||||
/** @return the loaded {@code prices.yml} configuration */
|
||||
public FileConfiguration getPricesConfig() { return pricesConfig; }
|
||||
|
||||
public LangManager getLangManager() { return langManager; }
|
||||
public EconomyManager getEconomyManager() { return economyManager; }
|
||||
public CategoryRegistry getCategoryRegistry() { return categoryRegistry; }
|
||||
public PricingService getPricingService() { return pricingService; }
|
||||
public TransactionLogger getTransactionLogger() { return transactionLogger; }
|
||||
public GuiController getGuiController() { return guiController; }
|
||||
public MainCategoryGui getMainCategoryGui() { return mainCategoryGui; }
|
||||
public CategoryGui getCategoryGui() { return categoryGui; }
|
||||
public ItemDetailGui getItemDetailGui() { return itemDetailGui; }
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Helpers
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Saves the bundled {@code prices.yml} to the data folder if it does not
|
||||
* already exist.
|
||||
*/
|
||||
private void savePricesConfig() {
|
||||
File pricesFile = new File(getDataFolder(), "prices.yml");
|
||||
if (!pricesFile.exists()) {
|
||||
saveResource("prices.yml", false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads {@code prices.yml} from the data folder, merging bundled defaults.
|
||||
*
|
||||
* @return loaded configuration
|
||||
*/
|
||||
private FileConfiguration loadPricesConfig() {
|
||||
File pricesFile = new File(getDataFolder(), "prices.yml");
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(pricesFile);
|
||||
|
||||
// Merge bundled defaults
|
||||
InputStream stream = getResource("prices.yml");
|
||||
if (stream != null) {
|
||||
YamlConfiguration defaults = YamlConfiguration.loadConfiguration(
|
||||
new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
cfg.setDefaults(defaults);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package pt.henrique.servershop.category;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
/**
|
||||
* Represents a shop category with its display configuration
|
||||
* and a mapping of which {@link Material} values belong to it.
|
||||
*/
|
||||
public final class Category {
|
||||
|
||||
private final String id;
|
||||
private final String displayName;
|
||||
private final Material icon;
|
||||
private final boolean buyEnabled;
|
||||
private final boolean sellEnabled;
|
||||
|
||||
/**
|
||||
* Constructs a new category.
|
||||
*
|
||||
* @param id internal identifier (e.g. "BLOCKS")
|
||||
* @param displayName colour-formatted display name shown in GUIs
|
||||
* @param icon material used as the category icon button
|
||||
* @param buyEnabled whether players can buy items in this category by default
|
||||
* @param sellEnabled whether players can sell items in this category by default
|
||||
*/
|
||||
public Category(String id, String displayName, Material icon,
|
||||
boolean buyEnabled, boolean sellEnabled) {
|
||||
this.id = id;
|
||||
this.displayName = displayName;
|
||||
this.icon = icon;
|
||||
this.buyEnabled = buyEnabled;
|
||||
this.sellEnabled = sellEnabled;
|
||||
}
|
||||
|
||||
/** @return the unique category identifier */
|
||||
public String getId() { return id; }
|
||||
|
||||
/** @return colour-formatted display name */
|
||||
public String getDisplayName() { return displayName; }
|
||||
|
||||
/** @return icon material */
|
||||
public Material getIcon() { return icon; }
|
||||
|
||||
/** @return whether buying is enabled for this category */
|
||||
public boolean isBuyEnabled() { return buyEnabled; }
|
||||
|
||||
/** @return whether selling is enabled for this category */
|
||||
public boolean isSellEnabled() { return sellEnabled; }
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package pt.henrique.servershop.category;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Loads and caches all categories from {@code prices.yml}.
|
||||
* Provides a fallback "MISC" category for any item that is not explicitly
|
||||
* assigned to a category.
|
||||
*/
|
||||
public final class CategoryRegistry {
|
||||
|
||||
/** Fallback category used when a material has no explicit assignment. */
|
||||
public static final String MISC_ID = "MISC";
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
/** Ordered list of all categories (insertion order from config). */
|
||||
private final List<Category> categories = new ArrayList<>();
|
||||
|
||||
/** Maps a Material to the category it belongs to. */
|
||||
private final Map<Material, Category> materialCategoryMap = new EnumMap<>(Material.class);
|
||||
|
||||
public CategoryRegistry(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all categories from {@code prices.yml}.
|
||||
* Must be called (or re-called on reload) from the main thread before the
|
||||
* shop is opened by any player.
|
||||
*/
|
||||
public void load() {
|
||||
categories.clear();
|
||||
materialCategoryMap.clear();
|
||||
|
||||
ConfigurationSection root = plugin.getPricesConfig()
|
||||
.getConfigurationSection("categories");
|
||||
|
||||
if (root == null) {
|
||||
plugin.getLogger().warning("prices.yml has no 'categories' section!");
|
||||
ensureMiscCategory();
|
||||
return;
|
||||
}
|
||||
|
||||
for (String catId : root.getKeys(false)) {
|
||||
ConfigurationSection catSection = root.getConfigurationSection(catId);
|
||||
if (catSection == null) continue;
|
||||
|
||||
String displayName = catSection.getString("display-name", catId);
|
||||
String iconName = catSection.getString("icon", "CHEST");
|
||||
Material icon = parseMaterial(iconName, Material.CHEST);
|
||||
boolean buyEnabled = catSection.getBoolean("buy-enabled", true);
|
||||
boolean sellEnabled = catSection.getBoolean("sell-enabled", true);
|
||||
|
||||
Category category = new Category(catId, displayName, icon, buyEnabled, sellEnabled);
|
||||
categories.add(category);
|
||||
|
||||
// Register all items in this category so we can do reverse lookups
|
||||
ConfigurationSection itemsSection = catSection.getConfigurationSection("items");
|
||||
if (itemsSection != null) {
|
||||
for (String materialName : itemsSection.getKeys(false)) {
|
||||
Material mat = parseMaterial(materialName, null);
|
||||
if (mat != null) {
|
||||
materialCategoryMap.put(mat, category);
|
||||
} else {
|
||||
plugin.getLogger().warning(
|
||||
"prices.yml: unknown material '" + materialName
|
||||
+ "' in category '" + catId + "' — skipping.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ensureMiscCategory();
|
||||
plugin.getLogger().info("Loaded " + categories.size() + " categories with "
|
||||
+ materialCategoryMap.size() + " item mappings.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures a MISC category exists for items without an explicit assignment.
|
||||
* If MISC is already in the list it is used as-is; otherwise a default one
|
||||
* is appended.
|
||||
*/
|
||||
private void ensureMiscCategory() {
|
||||
boolean hasMisc = categories.stream()
|
||||
.anyMatch(c -> c.getId().equals(MISC_ID));
|
||||
if (!hasMisc) {
|
||||
categories.add(new Category(MISC_ID, "&8Miscellaneous",
|
||||
Material.CHEST, true, true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the category for a given material.
|
||||
* Falls back to the MISC category if not explicitly assigned.
|
||||
*
|
||||
* @param material the material to look up
|
||||
* @return the category; never {@code null}
|
||||
*/
|
||||
public Category getCategory(Material material) {
|
||||
Category cat = materialCategoryMap.get(material);
|
||||
if (cat != null) return cat;
|
||||
// Fallback: return the MISC category
|
||||
return categories.stream()
|
||||
.filter(c -> c.getId().equals(MISC_ID))
|
||||
.findFirst()
|
||||
.orElse(categories.isEmpty() ? null : categories.get(categories.size() - 1));
|
||||
}
|
||||
|
||||
/** @return an unmodifiable ordered list of all loaded categories */
|
||||
public List<Category> getCategories() {
|
||||
return Collections.unmodifiableList(categories);
|
||||
}
|
||||
|
||||
/** @return all materials assigned to a given category */
|
||||
public List<Material> getMaterialsInCategory(Category category) {
|
||||
List<Material> result = new ArrayList<>();
|
||||
for (Map.Entry<Material, Category> entry : materialCategoryMap.entrySet()) {
|
||||
if (entry.getValue().getId().equals(category.getId())) {
|
||||
result.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
result.sort(Comparator.comparing(Material::name));
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---- helpers ----
|
||||
|
||||
private Material parseMaterial(String name, Material fallback) {
|
||||
if (name == null) return fallback;
|
||||
try {
|
||||
return Material.valueOf(name.toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package pt.henrique.servershop.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles the {@code /shop} (alias {@code /servershop}) command.
|
||||
*
|
||||
* <p>Usage:
|
||||
* <ul>
|
||||
* <li>{@code /shop} — opens the main category GUI for the player</li>
|
||||
* <li>{@code /shop reload} — reloads all configuration (requires {@code servershop.admin.reload})</li>
|
||||
* </ul>
|
||||
*/
|
||||
public final class ShopCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
public ShopCommand(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command,
|
||||
String label, String[] args) {
|
||||
|
||||
// Sub-command: reload
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
|
||||
if (!sender.hasPermission("servershop.admin.reload")) {
|
||||
sender.sendMessage(plugin.getLangManager().get("no-permission"));
|
||||
return true;
|
||||
}
|
||||
plugin.reload();
|
||||
sender.sendMessage(plugin.getLangManager().get("reload-success"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Player-only: open GUI
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage(plugin.getLangManager().get("player-only"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!player.hasPermission("servershop.use")) {
|
||||
player.sendMessage(plugin.getLangManager().get("no-permission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.getMainCategoryGui().open(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command,
|
||||
String alias, String[] args) {
|
||||
if (args.length == 1 && sender.hasPermission("servershop.admin.reload")) {
|
||||
return List.of("reload");
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package pt.henrique.servershop.economy;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Wraps the Vault {@link Economy} service, providing balance checks,
|
||||
* deposits, withdrawals, and formatted currency strings.
|
||||
*/
|
||||
public final class EconomyManager {
|
||||
|
||||
private final ServerShop plugin;
|
||||
private Economy economy;
|
||||
private DecimalFormat format;
|
||||
|
||||
public EconomyManager(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks into the Vault economy service.
|
||||
*
|
||||
* @return {@code true} if an economy provider was found, {@code false} otherwise
|
||||
*/
|
||||
public boolean setup() {
|
||||
if (plugin.getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
return false;
|
||||
}
|
||||
RegisteredServiceProvider<Economy> rsp =
|
||||
plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) return false;
|
||||
economy = rsp.getProvider();
|
||||
|
||||
String pattern = plugin.getConfig().getString("economy.currency-format", "$#,##0.00");
|
||||
try {
|
||||
format = new DecimalFormat(pattern, DecimalFormatSymbols.getInstance(Locale.US));
|
||||
} catch (IllegalArgumentException e) {
|
||||
plugin.getLogger().warning("Invalid currency-format in config.yml; using default.");
|
||||
format = new DecimalFormat("$#,##0.00", DecimalFormatSymbols.getInstance(Locale.US));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the raw Vault {@link Economy} instance
|
||||
*/
|
||||
public Economy getEconomy() { return economy; }
|
||||
|
||||
/**
|
||||
* @return {@code true} if the economy provider has been successfully hooked
|
||||
*/
|
||||
public boolean isAvailable() { return economy != null; }
|
||||
|
||||
/**
|
||||
* Gets a player's current balance.
|
||||
*
|
||||
* @param player the player
|
||||
* @return balance
|
||||
*/
|
||||
public double getBalance(Player player) {
|
||||
return economy.getBalance(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Withdraws {@code amount} from the player's account.
|
||||
*
|
||||
* @param player the player
|
||||
* @param amount amount to withdraw (must be positive)
|
||||
* @return {@code true} on success
|
||||
*/
|
||||
public boolean withdraw(Player player, double amount) {
|
||||
if (amount <= 0) return false;
|
||||
EconomyResponse response = economy.withdrawPlayer(player, amount);
|
||||
return response.transactionSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deposits {@code amount} into the player's account.
|
||||
*
|
||||
* @param player the player
|
||||
* @param amount amount to deposit (must be positive)
|
||||
* @return {@code true} on success
|
||||
*/
|
||||
public boolean deposit(Player player, double amount) {
|
||||
if (amount <= 0) return false;
|
||||
EconomyResponse response = economy.depositPlayer(player, amount);
|
||||
return response.transactionSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats an amount as a currency string using the configured pattern.
|
||||
*
|
||||
* @param amount the monetary amount
|
||||
* @return formatted string, e.g. "$1,234.56"
|
||||
*/
|
||||
public String format(double amount) {
|
||||
return format.format(amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package pt.henrique.servershop.gui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
import pt.henrique.servershop.category.Category;
|
||||
import pt.henrique.servershop.i18n.LangManager;
|
||||
import pt.henrique.servershop.pricing.ItemPrice;
|
||||
import pt.henrique.servershop.pricing.PricingService;
|
||||
import pt.henrique.servershop.util.TextUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Paginated grid of all items within a single category.
|
||||
*
|
||||
* <p>Layout (54 slots):
|
||||
* <pre>
|
||||
* Row 0-4 (slots 0-44): item grid (9 per row × 5 rows = 45 slots)
|
||||
* Row 5 (slots 45-53): [BACK][fill][fill][PREV][fill][fill][NEXT][fill][fill]
|
||||
* </pre>
|
||||
*/
|
||||
public final class CategoryGui {
|
||||
|
||||
/** Number of item display slots per page. */
|
||||
static final int ITEMS_PER_PAGE = 45;
|
||||
|
||||
static final int SLOT_BACK = 45;
|
||||
static final int SLOT_PREV = 48;
|
||||
static final int SLOT_NEXT = 50;
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
public CategoryGui(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the category GUI for a player.
|
||||
*
|
||||
* @param player the player
|
||||
* @param category the category to display
|
||||
* @param page zero-based page index
|
||||
*/
|
||||
public void open(Player player, Category category, int page) {
|
||||
LangManager lang = plugin.getLangManager();
|
||||
PricingService pricing = plugin.getPricingService();
|
||||
|
||||
List<Material> allItems = plugin.getCategoryRegistry().getMaterialsInCategory(category);
|
||||
int totalPages = Math.max(1, (int) Math.ceil((double) allItems.size() / ITEMS_PER_PAGE));
|
||||
page = Math.max(0, Math.min(page, totalPages - 1));
|
||||
|
||||
String title = lang.get("gui.category-title", "category",
|
||||
TextUtil.stripColour(category.getDisplayName()));
|
||||
Inventory inv = plugin.getServer().createInventory(null, 54, title);
|
||||
|
||||
// Fill bottom row
|
||||
ItemStack filler = createFiller();
|
||||
for (int i = 45; i < 54; i++) inv.setItem(i, filler);
|
||||
// Fill remaining item slots with filler initially
|
||||
for (int i = 0; i < 45; i++) inv.setItem(i, filler);
|
||||
|
||||
// Populate items for this page
|
||||
int start = page * ITEMS_PER_PAGE;
|
||||
int end = Math.min(start + ITEMS_PER_PAGE, allItems.size());
|
||||
for (int i = start; i < end; i++) {
|
||||
Material mat = allItems.get(i);
|
||||
ItemPrice price = pricing.getPrice(mat, category);
|
||||
ItemStack button = createItemButton(mat, price, lang);
|
||||
inv.setItem(i - start, button);
|
||||
}
|
||||
|
||||
// Navigation buttons
|
||||
inv.setItem(SLOT_BACK, createBackButton(lang));
|
||||
|
||||
if (page > 0) {
|
||||
inv.setItem(SLOT_PREV, createPrevButton(lang, page, totalPages));
|
||||
}
|
||||
if (page < totalPages - 1) {
|
||||
inv.setItem(SLOT_NEXT, createNextButton(lang, page, totalPages));
|
||||
}
|
||||
|
||||
player.openInventory(inv);
|
||||
plugin.getGuiController().setGui(player, GuiType.CATEGORY, category, null, page);
|
||||
}
|
||||
|
||||
// ---- item builders ----
|
||||
|
||||
private ItemStack createFiller() {
|
||||
String matName = plugin.getConfig().getString("gui.filler-material", "GRAY_STAINED_GLASS_PANE");
|
||||
Material mat;
|
||||
try { mat = Material.valueOf(matName); }
|
||||
catch (IllegalArgumentException e) { mat = Material.GRAY_STAINED_GLASS_PANE; }
|
||||
ItemStack item = new ItemStack(mat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) { meta.setDisplayName(" "); item.setItemMeta(meta); }
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createItemButton(Material material, ItemPrice price, LangManager lang) {
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return item;
|
||||
|
||||
meta.setDisplayName(TextUtil.colour("&f" + TextUtil.formatMaterialName(material)));
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (price.isBuyEnabled()) {
|
||||
lore.add(lang.get("gui.item-buy-price", "price",
|
||||
plugin.getEconomyManager().format(price.getBuyPrice())));
|
||||
} else {
|
||||
lore.add(lang.get("gui.item-buy-disabled"));
|
||||
}
|
||||
if (price.isSellEnabled()) {
|
||||
lore.add(lang.get("gui.item-sell-price", "price",
|
||||
plugin.getEconomyManager().format(price.getSellPrice())));
|
||||
} else {
|
||||
lore.add(lang.get("gui.item-sell-disabled"));
|
||||
}
|
||||
if (price.isBuyEnabled() && price.isSellEnabled()) {
|
||||
lore.add(lang.get("gui.item-spread", "spread",
|
||||
String.format("%.0f", price.getSpreadPercent())));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createBackButton(LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.BARRIER);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.back-button"));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createPrevButton(LangManager lang, int page, int totalPages) {
|
||||
ItemStack item = new ItemStack(Material.ARROW);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.prev-page"));
|
||||
meta.setLore(List.of(lang.get("gui.page-info",
|
||||
"page", String.valueOf(page), // page is 0-indexed; prev page is (page-1)+1 = page
|
||||
"total", String.valueOf(totalPages))));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createNextButton(LangManager lang, int page, int totalPages) {
|
||||
ItemStack item = new ItemStack(Material.ARROW);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.next-page"));
|
||||
meta.setLore(List.of(lang.get("gui.page-info",
|
||||
"page", String.valueOf(page + 2),
|
||||
"total", String.valueOf(totalPages))));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package pt.henrique.servershop.gui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import pt.henrique.servershop.category.Category;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Tracks which GUI screen each player currently has open and stores
|
||||
* contextual state (active category, selected material, page, quantity).
|
||||
*
|
||||
* <p>This is used by {@link ShopGuiListener} to route inventory-click events
|
||||
* to the correct handler logic without needing to inspect inventory titles.
|
||||
*/
|
||||
public final class GuiController {
|
||||
|
||||
/** Immutable state record for a single player's current GUI session. */
|
||||
record GuiState(GuiType type, Category category, Material material, int page) {}
|
||||
|
||||
/** Tracks open GUIs keyed by player UUID. */
|
||||
private final Map<UUID, GuiState> openGuis = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Records that {@code player} has opened a specific shop GUI screen.
|
||||
*
|
||||
* @param player the player
|
||||
* @param type which screen is open
|
||||
* @param category the active category (may be {@code null} for MAIN_CATEGORY)
|
||||
* @param material the selected material (only meaningful for ITEM_DETAIL)
|
||||
* @param page current page index (CATEGORY) or current quantity (ITEM_DETAIL)
|
||||
*/
|
||||
public void setGui(Player player, GuiType type, Category category,
|
||||
Material material, int page) {
|
||||
openGuis.put(player.getUniqueId(), new GuiState(type, category, material, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the GUI state when the player closes the inventory.
|
||||
*
|
||||
* @param player the player
|
||||
*/
|
||||
public void closeGui(Player player) {
|
||||
openGuis.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current GUI state for a player.
|
||||
*
|
||||
* @param player the player
|
||||
* @return state, or a {@link GuiType#NONE} state if none recorded
|
||||
*/
|
||||
public GuiState getState(Player player) {
|
||||
return openGuis.getOrDefault(player.getUniqueId(),
|
||||
new GuiState(GuiType.NONE, null, null, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player the player
|
||||
* @return {@code true} if the player has a shop GUI open
|
||||
*/
|
||||
public boolean hasShopGui(Player player) {
|
||||
return openGuis.containsKey(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package pt.henrique.servershop.gui;
|
||||
|
||||
/**
|
||||
* Identifies which GUI screen a player currently has open in the server shop.
|
||||
*/
|
||||
public enum GuiType {
|
||||
/** The main category-selection screen. */
|
||||
MAIN_CATEGORY,
|
||||
/** A paginated category item grid. */
|
||||
CATEGORY,
|
||||
/** The item detail / quantity-selector screen. */
|
||||
ITEM_DETAIL,
|
||||
/** Not a shop GUI (player has a different inventory open). */
|
||||
NONE
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
package pt.henrique.servershop.gui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
import pt.henrique.servershop.category.Category;
|
||||
import pt.henrique.servershop.i18n.LangManager;
|
||||
import pt.henrique.servershop.pricing.ItemPrice;
|
||||
import pt.henrique.servershop.pricing.PricingService;
|
||||
import pt.henrique.servershop.util.ItemUtil;
|
||||
import pt.henrique.servershop.util.TextUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The item detail GUI — shows buy/sell price for a specific material and
|
||||
* lets the player choose a quantity before confirming the transaction.
|
||||
*
|
||||
* <p>Slot layout (54 slots):
|
||||
* <pre>
|
||||
* Row 0: [fll][fll][fll][fll][ITEM][fll][fll][fll][fll]
|
||||
* Row 1: [fll][fll][fll][fll][fll][fll][fll][fll][fll]
|
||||
* Row 2: [fll][fll][fll][fll][fll][fll][fll][fll][fll]
|
||||
* Row 3: [-32][-16][-8 ][-1 ][QTY][+1 ][+8 ][+16][+32]
|
||||
* Row 4: [MIN][fll][BUY][fll][BAL][fll][SEL][fll][MAX]
|
||||
* Row 5: [BCK][fll][fll][fll][fll][fll][fll][fll][fll]
|
||||
* </pre>
|
||||
*/
|
||||
public final class ItemDetailGui {
|
||||
|
||||
// Slots (0-indexed)
|
||||
static final int SLOT_ITEM_DISPLAY = 4;
|
||||
|
||||
static final int SLOT_DEC32 = 27;
|
||||
static final int SLOT_DEC16 = 28;
|
||||
static final int SLOT_DEC8 = 29;
|
||||
static final int SLOT_DEC1 = 30;
|
||||
static final int SLOT_QTY = 31;
|
||||
static final int SLOT_INC1 = 32;
|
||||
static final int SLOT_INC8 = 33;
|
||||
static final int SLOT_INC16 = 34;
|
||||
static final int SLOT_INC32 = 35;
|
||||
|
||||
static final int SLOT_MIN = 36;
|
||||
static final int SLOT_BUY = 38;
|
||||
static final int SLOT_BALANCE = 40;
|
||||
static final int SLOT_SELL = 42;
|
||||
static final int SLOT_MAX = 44;
|
||||
|
||||
static final int SLOT_BACK = 45;
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
public ItemDetailGui(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the item detail GUI for a player.
|
||||
*
|
||||
* @param player the player
|
||||
* @param material the material being inspected
|
||||
* @param category the category this item belongs to (for buy/sell flags)
|
||||
* @param quantity initial quantity displayed
|
||||
*/
|
||||
public void open(Player player, Material material, Category category, int quantity) {
|
||||
LangManager lang = plugin.getLangManager();
|
||||
PricingService pricing = plugin.getPricingService();
|
||||
ItemPrice price = pricing.getPrice(material, category);
|
||||
|
||||
quantity = Math.max(1, quantity);
|
||||
|
||||
String title = lang.get("gui.detail-title", "item", TextUtil.formatMaterialName(material));
|
||||
Inventory inv = plugin.getServer().createInventory(null, 54, title);
|
||||
|
||||
// Fill everything with filler
|
||||
ItemStack filler = createFiller();
|
||||
for (int i = 0; i < 54; i++) inv.setItem(i, filler);
|
||||
|
||||
// Item display
|
||||
inv.setItem(SLOT_ITEM_DISPLAY, createItemDisplay(material, price, lang));
|
||||
|
||||
// Quantity adjustment buttons
|
||||
inv.setItem(SLOT_DEC32, createAdjustButton(Material.RED_STAINED_GLASS_PANE, "-32", -32));
|
||||
inv.setItem(SLOT_DEC16, createAdjustButton(Material.RED_STAINED_GLASS_PANE, "-16", -16));
|
||||
inv.setItem(SLOT_DEC8, createAdjustButton(Material.RED_STAINED_GLASS_PANE, "-8", -8));
|
||||
inv.setItem(SLOT_DEC1, createAdjustButton(Material.RED_STAINED_GLASS_PANE, "-1", -1));
|
||||
inv.setItem(SLOT_QTY, createQuantityDisplay(quantity, lang));
|
||||
inv.setItem(SLOT_INC1, createAdjustButton(Material.LIME_STAINED_GLASS_PANE, "+1", 1));
|
||||
inv.setItem(SLOT_INC8, createAdjustButton(Material.LIME_STAINED_GLASS_PANE, "+8", 8));
|
||||
inv.setItem(SLOT_INC16, createAdjustButton(Material.LIME_STAINED_GLASS_PANE, "+16", 16));
|
||||
inv.setItem(SLOT_INC32, createAdjustButton(Material.LIME_STAINED_GLASS_PANE, "+32", 32));
|
||||
|
||||
// MIN / MAX buttons
|
||||
inv.setItem(SLOT_MIN, createMinButton(lang));
|
||||
inv.setItem(SLOT_MAX, createMaxButton(player, price, lang));
|
||||
|
||||
// Wallet display
|
||||
inv.setItem(SLOT_BALANCE, createWalletDisplay(player, lang));
|
||||
|
||||
// Buy / Sell buttons
|
||||
double buyTotal = price.isBuyEnabled() ? price.getBuyPrice() * quantity : 0;
|
||||
double sellTotal = price.isSellEnabled() ? price.getSellPrice() * quantity : 0;
|
||||
int inInventory = ItemUtil.countInInventory(player, material);
|
||||
|
||||
if (price.isBuyEnabled()) {
|
||||
inv.setItem(SLOT_BUY, createBuyButton(quantity, buyTotal, player, lang));
|
||||
}
|
||||
if (price.isSellEnabled()) {
|
||||
inv.setItem(SLOT_SELL, createSellButton(quantity, sellTotal, inInventory, player, lang));
|
||||
}
|
||||
|
||||
// Back button
|
||||
inv.setItem(SLOT_BACK, createBackButton(lang));
|
||||
|
||||
player.openInventory(inv);
|
||||
plugin.getGuiController().setGui(player, GuiType.ITEM_DETAIL, category, material, quantity);
|
||||
}
|
||||
|
||||
// ---- item builders ----
|
||||
|
||||
private ItemStack createFiller() {
|
||||
String matName = plugin.getConfig().getString("gui.filler-material", "GRAY_STAINED_GLASS_PANE");
|
||||
Material mat;
|
||||
try { mat = Material.valueOf(matName); }
|
||||
catch (IllegalArgumentException e) { mat = Material.GRAY_STAINED_GLASS_PANE; }
|
||||
ItemStack item = new ItemStack(mat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) { meta.setDisplayName(" "); item.setItemMeta(meta); }
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createItemDisplay(Material material, ItemPrice price, LangManager lang) {
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return item;
|
||||
|
||||
meta.setDisplayName(TextUtil.colour("&f&l" + TextUtil.formatMaterialName(material)));
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (price.isBuyEnabled()) {
|
||||
lore.add(lang.get("gui.item-buy-price", "price",
|
||||
plugin.getEconomyManager().format(price.getBuyPrice())));
|
||||
} else {
|
||||
lore.add(lang.get("gui.item-buy-disabled"));
|
||||
}
|
||||
if (price.isSellEnabled()) {
|
||||
lore.add(lang.get("gui.item-sell-price", "price",
|
||||
plugin.getEconomyManager().format(price.getSellPrice())));
|
||||
} else {
|
||||
lore.add(lang.get("gui.item-sell-disabled"));
|
||||
}
|
||||
if (price.isBuyEnabled() && price.isSellEnabled()) {
|
||||
lore.add(lang.get("gui.item-spread", "spread",
|
||||
String.format("%.0f", price.getSpreadPercent())));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createAdjustButton(Material mat, String label, int delta) {
|
||||
ItemStack item = new ItemStack(mat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
// Use the delta sign for colour cue
|
||||
String colour = delta < 0 ? "&c" : "&a";
|
||||
meta.setDisplayName(TextUtil.colour(colour + label));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createQuantityDisplay(int qty, LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.PAPER);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.quantity-display", "qty", String.valueOf(qty)));
|
||||
meta.setLore(lang.getList("gui.quantity-lore"));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createMinButton(LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.min-button"));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createMaxButton(Player player, ItemPrice price, LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
// Show both MAX buy (by balance) and MAX sell (by inventory)
|
||||
String label = price.isBuyEnabled()
|
||||
? lang.get("gui.max-button-buy")
|
||||
: lang.get("gui.max-button-sell");
|
||||
meta.setDisplayName(label);
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createWalletDisplay(Player player, LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.EMERALD);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
double bal = plugin.getEconomyManager().getBalance(player);
|
||||
meta.setDisplayName(lang.get("gui.wallet-display", "balance",
|
||||
plugin.getEconomyManager().format(bal)));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createBuyButton(int qty, double total, Player player, LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.LIME_WOOL);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.buy-button", "qty", String.valueOf(qty)));
|
||||
double bal = plugin.getEconomyManager().getBalance(player);
|
||||
meta.setLore(lang.getList("gui.buy-button-lore",
|
||||
"total", plugin.getEconomyManager().format(total),
|
||||
"balance", plugin.getEconomyManager().format(bal)));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createSellButton(int qty, double total, int have, Player player, LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.RED_WOOL);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.sell-button", "qty", String.valueOf(qty)));
|
||||
double bal = plugin.getEconomyManager().getBalance(player);
|
||||
meta.setLore(lang.getList("gui.sell-button-lore",
|
||||
"total", plugin.getEconomyManager().format(total),
|
||||
"balance", plugin.getEconomyManager().format(bal),
|
||||
"have", String.valueOf(have)));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createBackButton(LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.BARRIER);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(lang.get("gui.back-button"));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package pt.henrique.servershop.gui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
import pt.henrique.servershop.category.Category;
|
||||
import pt.henrique.servershop.category.CategoryRegistry;
|
||||
import pt.henrique.servershop.i18n.LangManager;
|
||||
import pt.henrique.servershop.util.TextUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The main category-selection GUI opened by {@code /shop}.
|
||||
*
|
||||
* <p>Layout (54 slots):
|
||||
* <pre>
|
||||
* [CAT][CAT][CAT][CAT][CAT][CAT][CAT][fll][fll]
|
||||
* [CAT][CAT][CAT][CAT][CAT][CAT][CAT][fll][fll]
|
||||
* [CAT][CAT][CAT][CAT][CAT][CAT][CAT][fll][fll]
|
||||
* [CAT][CAT][CAT][CAT][CAT][CAT][CAT][fll][fll]
|
||||
* [CAT][CAT][CAT][CAT][CAT][CAT][CAT][fll][fll]
|
||||
* [fll][fll][fll][SELL_HAND][fll][SELL_INV][fll][fll][fll]
|
||||
* </pre>
|
||||
*/
|
||||
public final class MainCategoryGui {
|
||||
|
||||
/** Slot constants for special buttons on the bottom row. */
|
||||
static final int SLOT_SELL_HAND = 48;
|
||||
static final int SLOT_SELL_INV = 50;
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
public MainCategoryGui(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the main category GUI for a player.
|
||||
*
|
||||
* @param player the player to open the GUI for
|
||||
*/
|
||||
public void open(Player player) {
|
||||
LangManager lang = plugin.getLangManager();
|
||||
CategoryRegistry registry = plugin.getCategoryRegistry();
|
||||
|
||||
String title = lang.get("gui.main-title");
|
||||
Inventory inv = plugin.getServer().createInventory(null, 54, title);
|
||||
|
||||
// Fill background
|
||||
ItemStack filler = createFiller();
|
||||
for (int i = 0; i < 54; i++) inv.setItem(i, filler);
|
||||
|
||||
// Place category buttons in the first 45 slots
|
||||
List<Category> categories = registry.getCategories();
|
||||
int slot = 0;
|
||||
for (Category category : categories) {
|
||||
if (slot >= 45) break; // Max 45 category buttons
|
||||
|
||||
List<Material> items = registry.getMaterialsInCategory(category);
|
||||
int itemCount = items.size();
|
||||
|
||||
ItemStack button = createCategoryButton(category, itemCount, lang);
|
||||
inv.setItem(slot, button);
|
||||
slot++;
|
||||
}
|
||||
|
||||
// Bottom row special buttons
|
||||
boolean sellHandEnabled = plugin.getConfig().getBoolean("features.sell-hand-button", true);
|
||||
boolean sellInvEnabled = plugin.getConfig().getBoolean("features.sell-inventory-button", true);
|
||||
|
||||
if (sellHandEnabled) {
|
||||
inv.setItem(SLOT_SELL_HAND, createSellHandButton(lang));
|
||||
}
|
||||
if (sellInvEnabled) {
|
||||
inv.setItem(SLOT_SELL_INV, createSellInvButton(lang));
|
||||
}
|
||||
|
||||
player.openInventory(inv);
|
||||
plugin.getGuiController().setGui(player, GuiType.MAIN_CATEGORY, null, null, 0);
|
||||
}
|
||||
|
||||
// ---- item builders ----
|
||||
|
||||
private ItemStack createFiller() {
|
||||
String matName = plugin.getConfig().getString("gui.filler-material", "GRAY_STAINED_GLASS_PANE");
|
||||
Material mat;
|
||||
try {
|
||||
mat = Material.valueOf(matName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
mat = Material.GRAY_STAINED_GLASS_PANE;
|
||||
}
|
||||
ItemStack item = new ItemStack(mat);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(" ");
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createCategoryButton(Category category, int itemCount, LangManager lang) {
|
||||
ItemStack item = new ItemStack(category.getIcon());
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return item;
|
||||
|
||||
meta.setDisplayName(TextUtil.colour(category.getDisplayName()));
|
||||
|
||||
List<String> lore = new ArrayList<>(
|
||||
lang.getList("gui.category-lore", "count", String.valueOf(itemCount)));
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createSellHandButton(LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.GOLD_INGOT);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return item;
|
||||
meta.setDisplayName(lang.get("gui.sell-hand-button"));
|
||||
meta.setLore(lang.getList("gui.sell-hand-lore"));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack createSellInvButton(LangManager lang) {
|
||||
ItemStack item = new ItemStack(Material.CHEST);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return item;
|
||||
meta.setDisplayName(lang.get("gui.sell-inventory-button"));
|
||||
meta.setLore(lang.getList("gui.sell-inventory-lore"));
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,426 @@
|
||||
package pt.henrique.servershop.gui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
import pt.henrique.servershop.category.Category;
|
||||
import pt.henrique.servershop.category.CategoryRegistry;
|
||||
import pt.henrique.servershop.gui.GuiController.GuiState;
|
||||
import pt.henrique.servershop.i18n.LangManager;
|
||||
import pt.henrique.servershop.pricing.ItemPrice;
|
||||
import pt.henrique.servershop.pricing.PricingService;
|
||||
import pt.henrique.servershop.util.ItemUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles all inventory events for the ServerShop GUI screens.
|
||||
*
|
||||
* <p>All illegal interactions (shift-click, number-key swap, drag) are cancelled
|
||||
* when the top inventory belongs to a shop GUI to prevent item duplication.
|
||||
*/
|
||||
public final class ShopGuiListener implements Listener {
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
public ShopGuiListener(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Click events
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (!(event.getWhoClicked() instanceof Player player)) return;
|
||||
|
||||
GuiController controller = plugin.getGuiController();
|
||||
if (!controller.hasShopGui(player)) return;
|
||||
|
||||
// Always cancel the click to prevent item movement inside shop GUIs
|
||||
event.setCancelled(true);
|
||||
|
||||
// Only process clicks on the top inventory (the shop GUI itself)
|
||||
if (event.getClickedInventory() == null
|
||||
|| event.getClickedInventory() != event.getView().getTopInventory()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GuiState state = controller.getState(player);
|
||||
int slot = event.getRawSlot();
|
||||
|
||||
switch (state.type()) {
|
||||
case MAIN_CATEGORY -> handleMainCategoryClick(player, slot, state);
|
||||
case CATEGORY -> handleCategoryClick(player, slot, state);
|
||||
case ITEM_DETAIL -> handleItemDetailClick(player, slot, state);
|
||||
default -> { /* ignore */ }
|
||||
}
|
||||
}
|
||||
|
||||
/** Drag events inside shop GUIs are always cancelled. */
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
if (!(event.getWhoClicked() instanceof Player player)) return;
|
||||
if (!plugin.getGuiController().hasShopGui(player)) return;
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
/** Remove GUI state when the player closes the inventory. */
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
if (!(event.getPlayer() instanceof Player player)) return;
|
||||
plugin.getGuiController().closeGui(player);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Main category screen
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
private void handleMainCategoryClick(Player player, int slot, GuiState state) {
|
||||
// Special bottom-row buttons
|
||||
if (slot == MainCategoryGui.SLOT_SELL_HAND) {
|
||||
handleSellHand(player);
|
||||
return;
|
||||
}
|
||||
if (slot == MainCategoryGui.SLOT_SELL_INV) {
|
||||
handleSellInventory(player);
|
||||
return;
|
||||
}
|
||||
|
||||
// Category buttons occupy slots 0-44
|
||||
if (slot < 0 || slot >= 45) return;
|
||||
|
||||
List<Category> categories = plugin.getCategoryRegistry().getCategories();
|
||||
if (slot >= categories.size()) return;
|
||||
|
||||
Category chosen = categories.get(slot);
|
||||
plugin.getCategoryGui().open(player, chosen, 0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Category item grid
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
private void handleCategoryClick(Player player, int slot, GuiState state) {
|
||||
Category category = state.category();
|
||||
int page = state.page();
|
||||
|
||||
if (slot == CategoryGui.SLOT_BACK) {
|
||||
plugin.getMainCategoryGui().open(player);
|
||||
return;
|
||||
}
|
||||
if (slot == CategoryGui.SLOT_PREV) {
|
||||
plugin.getCategoryGui().open(player, category, page - 1);
|
||||
return;
|
||||
}
|
||||
if (slot == CategoryGui.SLOT_NEXT) {
|
||||
plugin.getCategoryGui().open(player, category, page + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Item grid (slots 0-44)
|
||||
if (slot < 0 || slot >= 45) return;
|
||||
|
||||
List<Material> materials = plugin.getCategoryRegistry().getMaterialsInCategory(category);
|
||||
int index = page * CategoryGui.ITEMS_PER_PAGE + slot;
|
||||
if (index >= materials.size()) return;
|
||||
|
||||
Material chosen = materials.get(index);
|
||||
plugin.getItemDetailGui().open(player, chosen, category, 1);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Item detail / quantity selector
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
private void handleItemDetailClick(Player player, int slot, GuiState state) {
|
||||
Category category = state.category();
|
||||
Material material = state.material();
|
||||
int qty = state.page(); // "page" field re-used for quantity in detail GUI
|
||||
|
||||
if (slot == ItemDetailGui.SLOT_BACK) {
|
||||
plugin.getCategoryGui().open(player, category, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Quantity adjustment
|
||||
int delta = switch (slot) {
|
||||
case ItemDetailGui.SLOT_DEC32 -> -32;
|
||||
case ItemDetailGui.SLOT_DEC16 -> -16;
|
||||
case ItemDetailGui.SLOT_DEC8 -> -8;
|
||||
case ItemDetailGui.SLOT_DEC1 -> -1;
|
||||
case ItemDetailGui.SLOT_INC1 -> 1;
|
||||
case ItemDetailGui.SLOT_INC8 -> 8;
|
||||
case ItemDetailGui.SLOT_INC16 -> 16;
|
||||
case ItemDetailGui.SLOT_INC32 -> 32;
|
||||
default -> 0;
|
||||
};
|
||||
|
||||
if (delta != 0) {
|
||||
int newQty = Math.max(1, qty + delta);
|
||||
plugin.getItemDetailGui().open(player, material, category, newQty);
|
||||
return;
|
||||
}
|
||||
|
||||
// MIN button → quantity 1
|
||||
if (slot == ItemDetailGui.SLOT_MIN) {
|
||||
plugin.getItemDetailGui().open(player, material, category, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// MAX button — different behaviour for buy vs sell
|
||||
if (slot == ItemDetailGui.SLOT_MAX) {
|
||||
handleMaxButton(player, material, category);
|
||||
return;
|
||||
}
|
||||
|
||||
// BUY confirm
|
||||
if (slot == ItemDetailGui.SLOT_BUY) {
|
||||
handleBuy(player, material, category, qty);
|
||||
return;
|
||||
}
|
||||
|
||||
// SELL confirm
|
||||
if (slot == ItemDetailGui.SLOT_SELL) {
|
||||
handleSell(player, material, category, qty);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleMaxButton(Player player, Material material, Category category) {
|
||||
PricingService pricing = plugin.getPricingService();
|
||||
ItemPrice price = pricing.getPrice(material, category);
|
||||
|
||||
int maxQty = 1;
|
||||
|
||||
// Compute max by balance (for buying) or by inventory (for selling)
|
||||
if (price.isBuyEnabled()) {
|
||||
double balance = plugin.getEconomyManager().getBalance(player);
|
||||
int maxBuy = (int) (balance / price.getBuyPrice());
|
||||
maxQty = Math.max(1, maxBuy);
|
||||
} else if (price.isSellEnabled()) {
|
||||
int inInv = ItemUtil.countInInventory(player, material);
|
||||
maxQty = Math.max(1, inInv);
|
||||
}
|
||||
|
||||
plugin.getItemDetailGui().open(player, material, category, maxQty);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Buy logic
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
private void handleBuy(Player player, Material material, Category category, int qty) {
|
||||
if (!plugin.getConfig().getBoolean("features.enable-buying", true)) return;
|
||||
if (!player.hasPermission("servershop.buy")) return;
|
||||
|
||||
LangManager lang = plugin.getLangManager();
|
||||
PricingService pricing = plugin.getPricingService();
|
||||
ItemPrice price = pricing.getPrice(material, category);
|
||||
|
||||
if (!price.isBuyEnabled()) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("buy-fail-disabled"));
|
||||
return;
|
||||
}
|
||||
if (qty < 1) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("buy-fail-invalid-qty"));
|
||||
return;
|
||||
}
|
||||
|
||||
double total = price.getBuyPrice() * qty;
|
||||
double balance = plugin.getEconomyManager().getBalance(player);
|
||||
|
||||
// Re-validate balance at click time (anti-exploit)
|
||||
if (balance < total) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("buy-fail-no-money",
|
||||
"total", plugin.getEconomyManager().format(total),
|
||||
"balance", plugin.getEconomyManager().format(balance)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check inventory space and give items
|
||||
boolean dropOnFull = plugin.getConfig()
|
||||
.getString("full-inventory-behavior", "DROP").equalsIgnoreCase("DROP");
|
||||
if (!dropOnFull) {
|
||||
// Verify sufficient space BEFORE charging (anti-exploit)
|
||||
if (!ItemUtil.canFit(player, material, qty)) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("buy-fail-inventory-full-cancelled"));
|
||||
return;
|
||||
}
|
||||
// Charge the player, then give items
|
||||
plugin.getEconomyManager().withdraw(player, total);
|
||||
ItemUtil.addItems(player, material, qty, false);
|
||||
} else {
|
||||
// Charge first, then give items (dropping overflow)
|
||||
plugin.getEconomyManager().withdraw(player, total);
|
||||
int leftover = ItemUtil.addItems(player, material, qty, true);
|
||||
if (leftover > 0) {
|
||||
player.sendMessage(lang.get("buy-drop-notice"));
|
||||
}
|
||||
}
|
||||
|
||||
// Log the transaction
|
||||
plugin.getTransactionLogger().log(player, "BUY", material.name(),
|
||||
qty, price.getBuyPrice(), total);
|
||||
|
||||
// Notify and refresh the GUI
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("buy-success",
|
||||
"qty", String.valueOf(qty),
|
||||
"item", material.name(),
|
||||
"total", plugin.getEconomyManager().format(total)));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Sell logic
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
private void handleSell(Player player, Material material, Category category, int qty) {
|
||||
if (!plugin.getConfig().getBoolean("features.enable-selling", true)) return;
|
||||
if (!player.hasPermission("servershop.sell")) return;
|
||||
|
||||
LangManager lang = plugin.getLangManager();
|
||||
PricingService pricing = plugin.getPricingService();
|
||||
ItemPrice price = pricing.getPrice(material, category);
|
||||
|
||||
if (!price.isSellEnabled()) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-fail-disabled"));
|
||||
return;
|
||||
}
|
||||
if (qty < 1) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-fail-invalid-qty"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-validate inventory at click time (anti-exploit)
|
||||
int inInventory = ItemUtil.countInInventory(player, material);
|
||||
if (inInventory < qty) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-fail-no-items", "item", material.name()));
|
||||
return;
|
||||
}
|
||||
|
||||
double unitSellPrice = price.getSellPrice();
|
||||
|
||||
// Apply sell tax if configured
|
||||
double taxPercent = plugin.getConfig().getDouble("pricing.sell-tax-percent", 0.0);
|
||||
if (taxPercent > 0) {
|
||||
unitSellPrice = unitSellPrice * (1.0 - taxPercent / 100.0);
|
||||
}
|
||||
|
||||
double total = unitSellPrice * qty;
|
||||
|
||||
// Remove items from inventory then deposit money
|
||||
ItemUtil.removeItems(player, material, qty);
|
||||
plugin.getEconomyManager().deposit(player, total);
|
||||
|
||||
// Log the transaction
|
||||
plugin.getTransactionLogger().log(player, "SELL", material.name(),
|
||||
qty, price.getSellPrice(), total);
|
||||
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-success",
|
||||
"qty", String.valueOf(qty),
|
||||
"item", material.name(),
|
||||
"total", plugin.getEconomyManager().format(total)));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Sell hand / sell inventory (from main menu)
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
private void handleSellHand(Player player) {
|
||||
if (!plugin.getConfig().getBoolean("features.enable-selling", true)) return;
|
||||
if (!player.hasPermission("servershop.sell")) return;
|
||||
|
||||
LangManager lang = plugin.getLangManager();
|
||||
var held = player.getInventory().getItemInMainHand();
|
||||
if (held.getType() == Material.AIR) {
|
||||
player.sendMessage(plugin.getLangManager().get("sell-all-nothing",
|
||||
"item", "air"));
|
||||
return;
|
||||
}
|
||||
|
||||
Material material = held.getType();
|
||||
Category category = plugin.getCategoryRegistry().getCategory(material);
|
||||
PricingService pricing = plugin.getPricingService();
|
||||
ItemPrice price = pricing.getPrice(material, category);
|
||||
|
||||
if (!price.isSellEnabled()) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-fail-disabled"));
|
||||
return;
|
||||
}
|
||||
|
||||
int qty = ItemUtil.countInInventory(player, material);
|
||||
if (qty == 0) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-all-nothing", "item", material.name()));
|
||||
return;
|
||||
}
|
||||
|
||||
double total = price.getSellPrice() * qty;
|
||||
ItemUtil.removeItems(player, material, qty);
|
||||
plugin.getEconomyManager().deposit(player, total);
|
||||
plugin.getTransactionLogger().log(player, "SELL", material.name(),
|
||||
qty, price.getSellPrice(), total);
|
||||
|
||||
player.closeInventory();
|
||||
player.sendMessage(lang.get("sell-all-success",
|
||||
"qty", String.valueOf(qty),
|
||||
"item", material.name(),
|
||||
"total", plugin.getEconomyManager().format(total)));
|
||||
}
|
||||
|
||||
private void handleSellInventory(Player player) {
|
||||
if (!plugin.getConfig().getBoolean("features.enable-selling", true)) return;
|
||||
if (!player.hasPermission("servershop.sell")) return;
|
||||
|
||||
// Show a sub-GUI for the item in hand, or a confirmation screen
|
||||
// For simplicity: sell ALL shoppable items in the player's inventory
|
||||
// that have a sell price configured.
|
||||
LangManager lang = plugin.getLangManager();
|
||||
double grandTotal = 0;
|
||||
int totalSold = 0;
|
||||
|
||||
for (Material mat : Material.values()) {
|
||||
if (!ItemUtil.isShoppable(mat)) continue;
|
||||
int count = ItemUtil.countInInventory(player, mat);
|
||||
if (count == 0) continue;
|
||||
|
||||
Category category = plugin.getCategoryRegistry().getCategory(mat);
|
||||
ItemPrice price = plugin.getPricingService().getPrice(mat, category);
|
||||
if (!price.isSellEnabled()) continue;
|
||||
|
||||
double itemTotal = price.getSellPrice() * count;
|
||||
ItemUtil.removeItems(player, mat, count);
|
||||
plugin.getEconomyManager().deposit(player, itemTotal);
|
||||
plugin.getTransactionLogger().log(player, "SELL", mat.name(),
|
||||
count, price.getSellPrice(), itemTotal);
|
||||
grandTotal += itemTotal;
|
||||
totalSold += count;
|
||||
}
|
||||
|
||||
player.closeInventory();
|
||||
if (totalSold == 0) {
|
||||
player.sendMessage(lang.get("sell-all-nothing", "item", "any items"));
|
||||
} else {
|
||||
player.sendMessage(lang.get("sell-all-success",
|
||||
"qty", String.valueOf(totalSold),
|
||||
"item", "items",
|
||||
"total", plugin.getEconomyManager().format(grandTotal)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package pt.henrique.servershop.i18n;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Loads and serves localised strings from the active language file
|
||||
* ({@code lang/<language>.yml}).
|
||||
*
|
||||
* <p>If a key is missing from the loaded file the default bundled language
|
||||
* file ({@code en_US}) is consulted as fallback.
|
||||
*/
|
||||
public final class LangManager {
|
||||
|
||||
private final ServerShop plugin;
|
||||
private FileConfiguration lang;
|
||||
private FileConfiguration fallback;
|
||||
|
||||
public LangManager(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the language file configured in {@code config.yml}.
|
||||
* Call this method on startup and on reload.
|
||||
*/
|
||||
public void load() {
|
||||
String language = plugin.getConfig().getString("language", "en_US");
|
||||
lang = loadLangFile(language);
|
||||
fallback = loadLangFile("en_US");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a translated string, substituting {@code %key% → value} placeholders.
|
||||
*
|
||||
* @param key the YAML path within the language file
|
||||
* @param replacements alternating key/value pairs, e.g. {@code "qty", "5"}
|
||||
* @return the translated, colour-decoded string
|
||||
*/
|
||||
public String get(String key, String... replacements) {
|
||||
String raw = lang.getString(key);
|
||||
if (raw == null) raw = fallback.getString(key);
|
||||
if (raw == null) return key; // last resort
|
||||
|
||||
raw = colour(raw);
|
||||
for (int i = 0; i + 1 < replacements.length; i += 2) {
|
||||
raw = raw.replace("%" + replacements[i] + "%", replacements[i + 1]);
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a translated string list (for lore entries etc.).
|
||||
*
|
||||
* @param key the YAML path
|
||||
* @param replacements alternating key/value pairs
|
||||
* @return colour-decoded list; empty list if key not found
|
||||
*/
|
||||
public List<String> getList(String key, String... replacements) {
|
||||
List<String> raw = lang.getStringList(key);
|
||||
if (raw.isEmpty()) raw = fallback.getStringList(key);
|
||||
return raw.stream()
|
||||
.map(s -> {
|
||||
s = colour(s);
|
||||
for (int i = 0; i + 1 < replacements.length; i += 2) {
|
||||
s = s.replace("%" + replacements[i] + "%", replacements[i + 1]);
|
||||
}
|
||||
return s;
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
// ---- helpers ----
|
||||
|
||||
/** Translates '&' colour codes into chat colour codes. */
|
||||
private String colour(String s) {
|
||||
return org.bukkit.ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a language file, first from the data folder then from the bundled
|
||||
* resources jar if it does not exist on disk.
|
||||
*/
|
||||
private FileConfiguration loadLangFile(String language) {
|
||||
File file = new File(plugin.getDataFolder(), "lang/" + language + ".yml");
|
||||
|
||||
// Save default resource if absent
|
||||
if (!file.exists()) {
|
||||
InputStream stream = plugin.getResource("lang/" + language + ".yml");
|
||||
if (stream != null) {
|
||||
plugin.saveResource("lang/" + language + ".yml", false);
|
||||
}
|
||||
}
|
||||
|
||||
if (file.exists()) {
|
||||
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
|
||||
// Merge defaults from bundled resource
|
||||
InputStream stream = plugin.getResource("lang/" + language + ".yml");
|
||||
if (stream != null) {
|
||||
YamlConfiguration defaults = YamlConfiguration.loadConfiguration(
|
||||
new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
cfg.setDefaults(defaults);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
// Nothing on disk and nothing in jar — return empty config
|
||||
plugin.getLogger().warning("Language file 'lang/" + language + ".yml' not found.");
|
||||
return new YamlConfiguration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package pt.henrique.servershop.pricing;
|
||||
|
||||
/**
|
||||
* Holds the buy price and sell price for a single item in the server shop.
|
||||
* A price of {@code -1} means that operation (buy or sell) is disabled.
|
||||
*/
|
||||
public final class ItemPrice {
|
||||
|
||||
/** Sentinel value indicating that buying or selling is disabled for this item. */
|
||||
public static final double DISABLED = -1.0;
|
||||
|
||||
private final double buyPrice;
|
||||
private final double sellPrice;
|
||||
|
||||
/**
|
||||
* @param buyPrice price server charges the player to buy 1 unit; use {@link #DISABLED} to disallow
|
||||
* @param sellPrice price server pays the player for 1 unit; use {@link #DISABLED} to disallow
|
||||
*/
|
||||
public ItemPrice(double buyPrice, double sellPrice) {
|
||||
this.buyPrice = buyPrice;
|
||||
this.sellPrice = sellPrice;
|
||||
}
|
||||
|
||||
/** @return price per unit when the player buys, or {@link #DISABLED} */
|
||||
public double getBuyPrice() { return buyPrice; }
|
||||
|
||||
/** @return price per unit when the player sells, or {@link #DISABLED} */
|
||||
public double getSellPrice() { return sellPrice; }
|
||||
|
||||
/** @return {@code true} if players can buy this item */
|
||||
public boolean isBuyEnabled() { return buyPrice > 0; }
|
||||
|
||||
/** @return {@code true} if players can sell this item */
|
||||
public boolean isSellEnabled() { return sellPrice > 0; }
|
||||
|
||||
/**
|
||||
* Calculates the spread percentage between buy and sell prices.
|
||||
* Spread = (buyPrice - sellPrice) / buyPrice * 100
|
||||
*
|
||||
* @return spread as a percentage, or 0 if buy is disabled
|
||||
*/
|
||||
public double getSpreadPercent() {
|
||||
if (!isBuyEnabled() || !isSellEnabled()) return 0;
|
||||
return ((buyPrice - sellPrice) / buyPrice) * 100.0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package pt.henrique.servershop.pricing;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
import pt.henrique.servershop.category.Category;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Resolves buy/sell prices for every material.
|
||||
*
|
||||
* <p>Resolution order (first match wins):
|
||||
* <ol>
|
||||
* <li>Per-item override in {@code prices.yml}</li>
|
||||
* <li>Category-level sell multiplier from {@code config.yml}</li>
|
||||
* <li>Global sell multiplier from {@code config.yml}</li>
|
||||
* </ol>
|
||||
*
|
||||
* <p>A sell price is derived from the buy price using
|
||||
* {@code sellPrice = buyPrice * sellMultiplier} unless an explicit
|
||||
* {@code sell-price} is specified in {@code prices.yml}.
|
||||
*/
|
||||
public final class PricingService {
|
||||
|
||||
private final ServerShop plugin;
|
||||
|
||||
/** Cache of resolved prices per material. */
|
||||
private final Map<Material, ItemPrice> priceCache = new EnumMap<>(Material.class);
|
||||
|
||||
public PricingService(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all prices from {@code prices.yml} into the cache.
|
||||
* Must be called (or re-called on reload) after {@link pt.henrique.servershop.category.CategoryRegistry#load()}.
|
||||
*/
|
||||
public void load() {
|
||||
priceCache.clear();
|
||||
|
||||
double globalSellMultiplier = plugin.getConfig()
|
||||
.getDouble("pricing.global-sell-multiplier", 0.25);
|
||||
|
||||
ConfigurationSection catSection = plugin.getPricesConfig()
|
||||
.getConfigurationSection("categories");
|
||||
if (catSection == null) return;
|
||||
|
||||
for (String catId : catSection.getKeys(false)) {
|
||||
ConfigurationSection cat = catSection.getConfigurationSection(catId);
|
||||
if (cat == null) continue;
|
||||
|
||||
boolean catBuyEnabled = cat.getBoolean("buy-enabled", true);
|
||||
boolean catSellEnabled = cat.getBoolean("sell-enabled", true);
|
||||
|
||||
// Per-category sell multiplier (falls back to global)
|
||||
double catSellMultiplier = plugin.getConfig()
|
||||
.getDouble("pricing.category-sell-multipliers." + catId, globalSellMultiplier);
|
||||
|
||||
ConfigurationSection items = cat.getConfigurationSection("items");
|
||||
if (items == null) continue;
|
||||
|
||||
for (String materialName : items.getKeys(false)) {
|
||||
Material mat = parseMaterial(materialName);
|
||||
if (mat == null) continue;
|
||||
|
||||
// Item may be a scalar (just buy-price) or a section
|
||||
double buyPrice;
|
||||
double sellPrice;
|
||||
boolean itemBuyEnabled = catBuyEnabled;
|
||||
boolean itemSellEnabled = catSellEnabled;
|
||||
|
||||
Object raw = items.get(materialName);
|
||||
if (raw instanceof ConfigurationSection itemSection) {
|
||||
buyPrice = itemSection.getDouble("buy-price", ItemPrice.DISABLED);
|
||||
// sell-price: explicit override or derived from multiplier
|
||||
if (itemSection.contains("sell-price")) {
|
||||
sellPrice = itemSection.getDouble("sell-price");
|
||||
} else if (buyPrice > 0) {
|
||||
sellPrice = buyPrice * catSellMultiplier;
|
||||
} else {
|
||||
sellPrice = ItemPrice.DISABLED;
|
||||
}
|
||||
// Per-item buy/sell enabled flags
|
||||
if (itemSection.contains("buy-enabled")) {
|
||||
itemBuyEnabled = itemSection.getBoolean("buy-enabled");
|
||||
}
|
||||
if (itemSection.contains("sell-enabled")) {
|
||||
itemSellEnabled = itemSection.getBoolean("sell-enabled");
|
||||
}
|
||||
} else {
|
||||
// scalar value — treat as buy-price
|
||||
buyPrice = items.getDouble(materialName, ItemPrice.DISABLED);
|
||||
sellPrice = buyPrice > 0 ? buyPrice * catSellMultiplier : ItemPrice.DISABLED;
|
||||
}
|
||||
|
||||
// Apply enabled flags: if disabled, force price to DISABLED
|
||||
if (!itemBuyEnabled) buyPrice = ItemPrice.DISABLED;
|
||||
if (!itemSellEnabled) sellPrice = ItemPrice.DISABLED;
|
||||
|
||||
priceCache.put(mat, new ItemPrice(buyPrice, sellPrice));
|
||||
}
|
||||
}
|
||||
|
||||
plugin.getLogger().info("Loaded prices for " + priceCache.size() + " materials.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link ItemPrice} for a material.
|
||||
* If the material has no configured price a default is synthesised using the
|
||||
* global multiplier with a nominal base buy price of {@code 10.0}, so that
|
||||
* newly-added items never cause a NullPointerException.
|
||||
*
|
||||
* @param material the material to price
|
||||
* @return a non-null {@link ItemPrice}
|
||||
*/
|
||||
public ItemPrice getPrice(Material material) {
|
||||
ItemPrice cached = priceCache.get(material);
|
||||
if (cached != null) return cached;
|
||||
|
||||
// Unknown / unconfigured material: use nominal default
|
||||
double base = 10.0;
|
||||
double multiplier = plugin.getConfig()
|
||||
.getDouble("pricing.global-sell-multiplier", 0.25);
|
||||
return new ItemPrice(base, base * multiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the price for a material within a specific category context,
|
||||
* respecting the category-level buy/sell enabled flags.
|
||||
*
|
||||
* @param material the material
|
||||
* @param category the category (used for enabled checks)
|
||||
* @return resolved price
|
||||
*/
|
||||
public ItemPrice getPrice(Material material, Category category) {
|
||||
ItemPrice base = getPrice(material);
|
||||
|
||||
// If the category disables buying or selling, override those fields
|
||||
double buy = category.isBuyEnabled() ? base.getBuyPrice() : ItemPrice.DISABLED;
|
||||
double sell = category.isSellEnabled() ? base.getSellPrice() : ItemPrice.DISABLED;
|
||||
|
||||
if (buy == base.getBuyPrice() && sell == base.getSellPrice()) return base;
|
||||
return new ItemPrice(buy, sell);
|
||||
}
|
||||
|
||||
// ---- helpers ----
|
||||
|
||||
private Material parseMaterial(String name) {
|
||||
try {
|
||||
return Material.valueOf(name.toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package pt.henrique.servershop.storage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import pt.henrique.servershop.ServerShop;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Optional SQLite logger for buy/sell transactions.
|
||||
* All database writes are performed on the Bukkit async scheduler thread.
|
||||
*
|
||||
* <p>Schema:
|
||||
* <pre>
|
||||
* transactions (
|
||||
* id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
* uuid TEXT NOT NULL,
|
||||
* player TEXT NOT NULL,
|
||||
* type TEXT NOT NULL, -- 'BUY' or 'SELL'
|
||||
* material TEXT NOT NULL,
|
||||
* amount INTEGER NOT NULL,
|
||||
* unit_price REAL NOT NULL,
|
||||
* total REAL NOT NULL,
|
||||
* timestamp INTEGER NOT NULL -- Unix epoch seconds
|
||||
* )
|
||||
* </pre>
|
||||
*/
|
||||
public final class TransactionLogger {
|
||||
|
||||
private final ServerShop plugin;
|
||||
private Connection connection;
|
||||
private volatile boolean enabled;
|
||||
|
||||
public TransactionLogger(ServerShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens (or creates) the SQLite database and sets up the schema.
|
||||
* Call this on startup; it is safe to call from the main thread as
|
||||
* it only runs at plugin enable time.
|
||||
*
|
||||
* @return {@code true} if the logger was successfully initialised
|
||||
*/
|
||||
public boolean initialize() {
|
||||
enabled = plugin.getConfig().getBoolean("logging.enabled", true);
|
||||
if (!enabled) {
|
||||
plugin.getLogger().info("Transaction logging is disabled.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String fileName = plugin.getConfig().getString("logging.file", "transactions.db");
|
||||
File dbFile = new File(plugin.getDataFolder(), fileName);
|
||||
plugin.getDataFolder().mkdirs();
|
||||
|
||||
try {
|
||||
// Use the bundled (shaded) sqlite-jdbc driver
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + dbFile.getAbsolutePath());
|
||||
createTable();
|
||||
plugin.getLogger().info("Transaction database initialised.");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Failed to initialise transaction database", e);
|
||||
enabled = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a transaction asynchronously.
|
||||
*
|
||||
* @param player the player involved
|
||||
* @param type "BUY" or "SELL"
|
||||
* @param material the material name
|
||||
* @param amount the quantity
|
||||
* @param unitPrice the per-unit price
|
||||
* @param total the total transaction value
|
||||
*/
|
||||
public void log(Player player, String type, String material, int amount,
|
||||
double unitPrice, double total) {
|
||||
if (!enabled || connection == null) return;
|
||||
|
||||
final String uuid = player.getUniqueId().toString();
|
||||
final String name = player.getName();
|
||||
final long ts = System.currentTimeMillis() / 1000L;
|
||||
|
||||
// Fire and forget on async thread
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
String sql = "INSERT INTO transactions (uuid, player, type, material, amount, "
|
||||
+ "unit_price, total, timestamp) VALUES (?,?,?,?,?,?,?,?)";
|
||||
try (PreparedStatement ps = connection.prepareStatement(sql)) {
|
||||
ps.setString(1, uuid);
|
||||
ps.setString(2, name);
|
||||
ps.setString(3, type);
|
||||
ps.setString(4, material);
|
||||
ps.setInt(5, amount);
|
||||
ps.setDouble(6, unitPrice);
|
||||
ps.setDouble(7, total);
|
||||
ps.setLong(8, ts);
|
||||
ps.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to log transaction", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Closes the database connection gracefully. */
|
||||
public void shutdown() {
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
plugin.getLogger().log(Level.WARNING, "Error closing transaction database", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- private helpers ----
|
||||
|
||||
private void createTable() throws SQLException {
|
||||
String sql = """
|
||||
CREATE TABLE IF NOT EXISTS transactions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
uuid TEXT NOT NULL,
|
||||
player TEXT NOT NULL,
|
||||
type TEXT NOT NULL,
|
||||
material TEXT NOT NULL,
|
||||
amount INTEGER NOT NULL,
|
||||
unit_price REAL NOT NULL,
|
||||
total REAL NOT NULL,
|
||||
timestamp INTEGER NOT NULL
|
||||
)
|
||||
""";
|
||||
try (Statement stmt = connection.createStatement()) {
|
||||
stmt.execute(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package pt.henrique.servershop.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Inventory and item helper utilities.
|
||||
*/
|
||||
public final class ItemUtil {
|
||||
|
||||
private ItemUtil() {}
|
||||
|
||||
/**
|
||||
* Counts how many of a given material the player has in their inventory
|
||||
* (including off-hand and hotbar).
|
||||
*
|
||||
* @param player the player
|
||||
* @param material the material to count
|
||||
* @return total count across all inventory slots
|
||||
*/
|
||||
public static int countInInventory(Player player, Material material) {
|
||||
int count = 0;
|
||||
for (ItemStack item : player.getInventory().getContents()) {
|
||||
if (item != null && item.getType() == material) {
|
||||
count += item.getAmount();
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes exactly {@code amount} of the given material from the player's inventory.
|
||||
* Does NOT check whether the player actually has enough — call {@link #countInInventory}
|
||||
* first to validate.
|
||||
*
|
||||
* @param player the player
|
||||
* @param material the material to remove
|
||||
* @param amount amount to remove
|
||||
*/
|
||||
public static void removeItems(Player player, Material material, int amount) {
|
||||
ItemStack[] contents = player.getInventory().getContents();
|
||||
int remaining = amount;
|
||||
for (int i = 0; i < contents.length && remaining > 0; i++) {
|
||||
ItemStack stack = contents[i];
|
||||
if (stack == null || stack.getType() != material) continue;
|
||||
|
||||
if (stack.getAmount() <= remaining) {
|
||||
remaining -= stack.getAmount();
|
||||
contents[i] = null;
|
||||
} else {
|
||||
stack.setAmount(stack.getAmount() - remaining);
|
||||
remaining = 0;
|
||||
}
|
||||
}
|
||||
player.getInventory().setContents(contents);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds {@code amount} of a material to the player's inventory,
|
||||
* dropping overflow at the player's feet.
|
||||
*
|
||||
* @param player the player
|
||||
* @param material the material to give
|
||||
* @param amount total amount to give
|
||||
* @param drop if {@code true} overflow items are dropped; if {@code false} the method
|
||||
* returns the number that could NOT be added (caller decides what to do)
|
||||
* @return number of items that could not fit in the inventory
|
||||
* (always 0 when {@code drop} is {@code true})
|
||||
*/
|
||||
public static int addItems(Player player, Material material, int amount, boolean drop) {
|
||||
int maxStack = new ItemStack(material).getMaxStackSize();
|
||||
int remaining = amount;
|
||||
|
||||
while (remaining > 0) {
|
||||
int batch = Math.min(remaining, maxStack);
|
||||
ItemStack stack = new ItemStack(material, batch);
|
||||
Map<Integer, ItemStack> leftover = player.getInventory().addItem(stack);
|
||||
|
||||
int leftoverTotal = leftover.values().stream()
|
||||
.mapToInt(ItemStack::getAmount).sum();
|
||||
|
||||
if (leftoverTotal > 0) {
|
||||
if (drop) {
|
||||
// Drop at player's feet
|
||||
player.getWorld().dropItem(player.getLocation(), new ItemStack(material, leftoverTotal));
|
||||
remaining = 0;
|
||||
} else {
|
||||
return remaining - (batch - leftoverTotal);
|
||||
}
|
||||
} else {
|
||||
remaining -= batch;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the player's inventory can fit {@code amount} additional
|
||||
* units of {@code material} without any overflow.
|
||||
*
|
||||
* @param player the player
|
||||
* @param material the material to check
|
||||
* @param amount amount to fit
|
||||
* @return {@code true} if all {@code amount} units would fit
|
||||
*/
|
||||
public static boolean canFit(Player player, Material material, int amount) {
|
||||
int maxStack = new ItemStack(material).getMaxStackSize();
|
||||
int space = 0;
|
||||
|
||||
for (ItemStack slot : player.getInventory().getStorageContents()) {
|
||||
if (slot == null || slot.getType() == Material.AIR) {
|
||||
space += maxStack;
|
||||
} else if (slot.getType() == material && slot.getAmount() < maxStack) {
|
||||
space += maxStack - slot.getAmount();
|
||||
}
|
||||
if (space >= amount) return true;
|
||||
}
|
||||
return space >= amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a material is purchasable by the server shop
|
||||
* (not air, not legacy, not a technical/non-obtainable block).
|
||||
*
|
||||
* @param material the material to test
|
||||
* @return {@code true} if the material can appear in the shop
|
||||
*/
|
||||
public static boolean isShoppable(Material material) {
|
||||
if (material == Material.AIR) return false;
|
||||
if (!material.isItem()) return false;
|
||||
// Exclude cave air / void air variants
|
||||
if (material.name().contains("AIR")) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package pt.henrique.servershop.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Text / formatting helpers used throughout the plugin.
|
||||
*/
|
||||
public final class TextUtil {
|
||||
|
||||
private TextUtil() {}
|
||||
|
||||
/**
|
||||
* Converts a {@link Material} name into a human-readable title-case string.
|
||||
* E.g. {@code DIAMOND_PICKAXE} → {@code "Diamond Pickaxe"}.
|
||||
*
|
||||
* @param material the material
|
||||
* @return formatted display name
|
||||
*/
|
||||
public static String formatMaterialName(Material material) {
|
||||
String[] parts = material.name().split("_");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String part : parts) {
|
||||
if (!sb.isEmpty()) sb.append(' ');
|
||||
sb.append(part.charAt(0)).append(part.substring(1).toLowerCase(Locale.ROOT));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates '&' colour codes and strips trailing whitespace.
|
||||
*
|
||||
* @param s the string to colour
|
||||
* @return colour-translated string
|
||||
*/
|
||||
public static String colour(String s) {
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips all colour codes from a string.
|
||||
*
|
||||
* @param s the string
|
||||
* @return plain text
|
||||
*/
|
||||
public static String stripColour(String s) {
|
||||
return ChatColor.stripColor(colour(s));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
# ============================================================
|
||||
# ServerShop Configuration
|
||||
# Server-run global market — designed to work alongside
|
||||
# CommunityMarket with a large buy/sell spread.
|
||||
# ============================================================
|
||||
|
||||
# Language (available: en_US, pt_PT)
|
||||
language: en_US
|
||||
|
||||
# Economy Settings
|
||||
economy:
|
||||
# Java DecimalFormat pattern for currency display
|
||||
currency-format: "$#,##0.00"
|
||||
currency-symbol: "$"
|
||||
|
||||
# Pricing Settings
|
||||
pricing:
|
||||
# Global multiplier applied to base buy price to derive sell price.
|
||||
# 0.25 means the server pays players only 25% of the buy price (large spread).
|
||||
# This keeps CommunityMarket attractive for player-to-player trades.
|
||||
global-sell-multiplier: 0.25
|
||||
|
||||
# Optional tax deducted from sell proceeds (0.0 = disabled)
|
||||
sell-tax-percent: 0.0
|
||||
|
||||
# Per-category overrides for sell multiplier (overrides global-sell-multiplier)
|
||||
category-sell-multipliers:
|
||||
BLOCKS: 0.20
|
||||
ORES: 0.20
|
||||
FARMING: 0.25
|
||||
FOOD: 0.25
|
||||
MOB_DROPS: 0.20
|
||||
REDSTONE: 0.25
|
||||
DECORATION: 0.20
|
||||
TOOLS: 0.15
|
||||
COMBAT: 0.15
|
||||
BREWING: 0.25
|
||||
MISC: 0.20
|
||||
|
||||
# Inventory behavior when player's inventory is full
|
||||
# Options: DROP (drop items at player feet) | CANCEL (refuse the purchase)
|
||||
full-inventory-behavior: DROP
|
||||
|
||||
# GUI Settings
|
||||
gui:
|
||||
# Title of the main category selection GUI
|
||||
main-title: "&6&lServer Shop"
|
||||
# Title pattern for category GUIs (%category% is replaced)
|
||||
category-title: "&6&lShop &8» &e%category%"
|
||||
# Title for item detail GUI (%item% is replaced)
|
||||
detail-title: "&6&lShop &8» &e%item%"
|
||||
# Material used for filler/border panes
|
||||
filler-material: GRAY_STAINED_GLASS_PANE
|
||||
# Material for navigation buttons
|
||||
nav-material: ARROW
|
||||
|
||||
# Feature toggles
|
||||
features:
|
||||
# Allow players to buy items
|
||||
enable-buying: true
|
||||
# Allow players to sell items
|
||||
enable-selling: true
|
||||
# Show "Sell Hand" button in the main GUI
|
||||
sell-hand-button: true
|
||||
# Show "Sell Inventory" button in the main GUI (sells all matching items)
|
||||
sell-inventory-button: true
|
||||
# Include special-meta items (potions, enchanted books) at base price
|
||||
include-special-meta-items: false
|
||||
|
||||
# Transaction Logging (SQLite)
|
||||
logging:
|
||||
enabled: true
|
||||
# Database file name (placed in plugin data folder)
|
||||
file: transactions.db
|
||||
@@ -0,0 +1,97 @@
|
||||
# ============================================================
|
||||
# ServerShop — English (en_US) Language File
|
||||
# ============================================================
|
||||
|
||||
# General
|
||||
prefix: "&8[&6ServerShop&8] &r"
|
||||
no-permission: "&cYou don't have permission to do that."
|
||||
player-only: "&cThis command can only be used by players."
|
||||
reload-success: "&aServerShop configuration reloaded."
|
||||
|
||||
# Economy errors
|
||||
no-vault: "&cVault economy is not available. ServerShop is disabled."
|
||||
|
||||
# Shop GUI
|
||||
gui:
|
||||
main-title: "&6&lServer Shop"
|
||||
category-title: "&6&lShop &8» &e%category%"
|
||||
detail-title: "&6&lShop &8» &e%item%"
|
||||
|
||||
# Category selection screen
|
||||
search-button: "&e&lSearch"
|
||||
search-lore:
|
||||
- "&7Click to search for an item"
|
||||
sell-hand-button: "&c&lSell Hand"
|
||||
sell-hand-lore:
|
||||
- "&7Sell the item you are holding"
|
||||
- "&7to the server shop"
|
||||
sell-inventory-button: "&c&lSell Inventory"
|
||||
sell-inventory-lore:
|
||||
- "&7Sell ALL matching items in"
|
||||
- "&7your inventory to the server shop"
|
||||
|
||||
# Category item lore
|
||||
category-lore:
|
||||
- "&7Click to browse %count% items"
|
||||
|
||||
# Item display in category grid
|
||||
item-buy-price: "&7Buy: &a%price%"
|
||||
item-sell-price: "&7Sell: &c%price%"
|
||||
item-spread: "&7Spread: &e%spread%%"
|
||||
item-buy-disabled: "&7Buy: &cNot available"
|
||||
item-sell-disabled: "&7Sell: &cNot available"
|
||||
|
||||
# Item detail GUI
|
||||
quantity-display: "&fQuantity: &e%qty%"
|
||||
quantity-lore:
|
||||
- "&7Left-click buttons to change quantity"
|
||||
buy-button: "&a&lBUY x%qty%"
|
||||
buy-button-lore:
|
||||
- "&7Total: &a%total%"
|
||||
- "&7Your balance: &e%balance%"
|
||||
sell-button: "&c&lSELL x%qty%"
|
||||
sell-button-lore:
|
||||
- "&7Total: &c%total%"
|
||||
- "&7Your balance: &e%balance%"
|
||||
- "&7In inventory: &f%have%"
|
||||
min-button: "&f&lMIN &7(x1)"
|
||||
max-button-buy: "&f&lMAX &7(by balance)"
|
||||
max-button-sell: "&f&lMAX &7(by inventory)"
|
||||
back-button: "&7« Back"
|
||||
close-button: "&c✖ Close"
|
||||
wallet-display: "&eBalance: &a%balance%"
|
||||
|
||||
# Pagination
|
||||
prev-page: "&7« Previous Page"
|
||||
next-page: "&7Next Page »"
|
||||
page-info: "&7Page %page% of %total%"
|
||||
no-items: "&cNo items in this category."
|
||||
|
||||
# Search
|
||||
search-title: "Search items..."
|
||||
search-prompt: "&7Type the item name in the anvil above"
|
||||
no-results: "&cNo results for \"%query%\""
|
||||
|
||||
# Confirmation for sell-inventory
|
||||
sell-inventory-confirm-title: "&4Confirm — Sell All?"
|
||||
sell-inventory-confirm-lore:
|
||||
- "&7Sell ALL %count%x %item%?"
|
||||
- "&7You will receive: &a%total%"
|
||||
- ""
|
||||
- "&aLeft-click &7to confirm"
|
||||
- "&cRight-click &7to cancel"
|
||||
|
||||
# Transaction messages
|
||||
buy-success: "&aYou bought &e%qty%x %item% &afor &e%total%&a."
|
||||
buy-fail-no-money: "&cYou don't have enough money. Need: &e%total%&c, have: &e%balance%&c."
|
||||
buy-fail-disabled: "&cBuying this item is currently disabled."
|
||||
buy-fail-invalid-qty: "&cInvalid quantity."
|
||||
buy-fail-inventory-full-cancelled: "&cYour inventory is full! Purchase cancelled."
|
||||
buy-drop-notice: "&eYour inventory was full — some items were dropped at your feet."
|
||||
|
||||
sell-success: "&aYou sold &e%qty%x %item% &afor &e%total%&a."
|
||||
sell-fail-no-items: "&cYou don't have enough &e%item%&c in your inventory."
|
||||
sell-fail-disabled: "&cSelling this item is currently disabled."
|
||||
sell-fail-invalid-qty: "&cInvalid quantity."
|
||||
sell-all-success: "&aYou sold &e%qty%x %item% &afor &e%total%&a."
|
||||
sell-all-nothing: "&cYou don't have any &e%item% &cto sell."
|
||||
@@ -0,0 +1,90 @@
|
||||
# ============================================================
|
||||
# ServerShop — Português (pt_PT) Language File
|
||||
# ============================================================
|
||||
|
||||
# Geral
|
||||
prefix: "&8[&6ServerShop&8] &r"
|
||||
no-permission: "&cNão tens permissão para fazer isso."
|
||||
player-only: "&cEste comando só pode ser usado por jogadores."
|
||||
reload-success: "&aConfiguração do ServerShop recarregada."
|
||||
|
||||
# Erros de economia
|
||||
no-vault: "&cVault economy não está disponível. ServerShop está desativado."
|
||||
|
||||
# GUI da loja
|
||||
gui:
|
||||
main-title: "&6&lLoja do Servidor"
|
||||
category-title: "&6&lLoja &8» &e%category%"
|
||||
detail-title: "&6&lLoja &8» &e%item%"
|
||||
|
||||
search-button: "&e&lPesquisar"
|
||||
search-lore:
|
||||
- "&7Clica para procurar um item"
|
||||
sell-hand-button: "&c&lVender na Mão"
|
||||
sell-hand-lore:
|
||||
- "&7Vende o item que tens na mão"
|
||||
- "&7à loja do servidor"
|
||||
sell-inventory-button: "&c&lVender Inventário"
|
||||
sell-inventory-lore:
|
||||
- "&7Vende TODOS os itens iguais"
|
||||
- "&7no teu inventário à loja"
|
||||
|
||||
category-lore:
|
||||
- "&7Clica para ver %count% itens"
|
||||
|
||||
item-buy-price: "&7Comprar: &a%price%"
|
||||
item-sell-price: "&7Vender: &c%price%"
|
||||
item-spread: "&7Spread: &e%spread%%"
|
||||
item-buy-disabled: "&7Comprar: &cNão disponível"
|
||||
item-sell-disabled: "&7Vender: &cNão disponível"
|
||||
|
||||
quantity-display: "&fQuantidade: &e%qty%"
|
||||
quantity-lore:
|
||||
- "&7Usa os botões para alterar a quantidade"
|
||||
buy-button: "&a&lCOMPRAR x%qty%"
|
||||
buy-button-lore:
|
||||
- "&7Total: &a%total%"
|
||||
- "&7Saldo: &e%balance%"
|
||||
sell-button: "&c&lVENDER x%qty%"
|
||||
sell-button-lore:
|
||||
- "&7Total: &c%total%"
|
||||
- "&7Saldo: &e%balance%"
|
||||
- "&7No inventário: &f%have%"
|
||||
min-button: "&f&lMÍN &7(x1)"
|
||||
max-button-buy: "&f&lMÁX &7(pelo saldo)"
|
||||
max-button-sell: "&f&lMÁX &7(pelo inventário)"
|
||||
back-button: "&7« Voltar"
|
||||
close-button: "&c✖ Fechar"
|
||||
wallet-display: "&eSaldo: &a%balance%"
|
||||
|
||||
prev-page: "&7« Página Anterior"
|
||||
next-page: "&7Próxima Página »"
|
||||
page-info: "&7Página %page% de %total%"
|
||||
no-items: "&cNenhum item nesta categoria."
|
||||
|
||||
search-title: "Pesquisar itens..."
|
||||
search-prompt: "&7Escreve o nome do item na bigorna"
|
||||
no-results: "&cSem resultados para \"%query%\""
|
||||
|
||||
sell-inventory-confirm-title: "&4Confirmar — Vender Tudo?"
|
||||
sell-inventory-confirm-lore:
|
||||
- "&7Vender TODOS %count%x %item%?"
|
||||
- "&7Receberás: &a%total%"
|
||||
- ""
|
||||
- "&aClique esquerdo &7para confirmar"
|
||||
- "&cClique direito &7para cancelar"
|
||||
|
||||
# Mensagens de transação
|
||||
buy-success: "&aCompraste &e%qty%x %item% &apor &e%total%&a."
|
||||
buy-fail-no-money: "&cNão tens dinheiro suficiente. Precisas: &e%total%&c, tens: &e%balance%&c."
|
||||
buy-fail-disabled: "&cA compra deste item está desativada."
|
||||
buy-fail-invalid-qty: "&cQuantidade inválida."
|
||||
buy-fail-inventory-full-cancelled: "&cO teu inventário está cheio! Compra cancelada."
|
||||
buy-drop-notice: "&eO teu inventário estava cheio — alguns itens foram largados aos teus pés."
|
||||
|
||||
sell-success: "&aVendeste &e%qty%x %item% &apor &e%total%&a."
|
||||
sell-fail-no-items: "&cNão tens &e%item% &csuficiente no inventário."
|
||||
sell-fail-disabled: "&cA venda deste item está desativada."
|
||||
sell-fail-invalid-qty: "&cQuantidade inválida."
|
||||
sell-all-success: "&aVendeste &e%qty%x %item% &apor &e%total%&a."
|
||||
sell-all-nothing: "&cNão tens &e%item% &cpara vender."
|
||||
@@ -0,0 +1,51 @@
|
||||
name: ServerShop
|
||||
version: '${project.version}'
|
||||
main: pt.henrique.servershop.ServerShop
|
||||
api-version: '1.21'
|
||||
description: A server-run global market with configurable pricing spread — complements CommunityMarket
|
||||
author: Henrique
|
||||
website: https://github.com/henrique/CommunityMarket
|
||||
|
||||
depend:
|
||||
- Vault
|
||||
|
||||
load: POSTWORLD
|
||||
|
||||
commands:
|
||||
shop:
|
||||
description: Opens the Server Shop main GUI
|
||||
usage: /<command>
|
||||
aliases: [servershop, sshop]
|
||||
permission: servershop.use
|
||||
|
||||
permissions:
|
||||
servershop.*:
|
||||
description: Grants all ServerShop permissions
|
||||
default: op
|
||||
children:
|
||||
servershop.use: true
|
||||
servershop.buy: true
|
||||
servershop.sell: true
|
||||
servershop.admin: true
|
||||
|
||||
servershop.use:
|
||||
description: Allows opening the Server Shop
|
||||
default: true
|
||||
|
||||
servershop.buy:
|
||||
description: Allows buying items from the Server Shop
|
||||
default: true
|
||||
|
||||
servershop.sell:
|
||||
description: Allows selling items to the Server Shop
|
||||
default: true
|
||||
|
||||
servershop.admin:
|
||||
description: Allows admin commands (reload)
|
||||
default: op
|
||||
children:
|
||||
servershop.admin.reload: true
|
||||
|
||||
servershop.admin.reload:
|
||||
description: Allows reloading the Server Shop configuration
|
||||
default: op
|
||||
@@ -0,0 +1,499 @@
|
||||
# ============================================================
|
||||
# ServerShop — Prices & Categories
|
||||
# ============================================================
|
||||
# Structure:
|
||||
# categories:
|
||||
# <CATEGORY_NAME>:
|
||||
# display-name: "Human readable name"
|
||||
# icon: MATERIAL_NAME
|
||||
# buy-enabled: true/false # can players buy from this category?
|
||||
# sell-enabled: true/false # can players sell to this category?
|
||||
# items:
|
||||
# MATERIAL_NAME:
|
||||
# buy-price: 10.00 # price server charges player to buy 1x
|
||||
# sell-price: 2.50 # price server pays player for 1x
|
||||
# # (if omitted, sell-price = buy-price * category/global multiplier)
|
||||
# buy-enabled: true # override per item
|
||||
# sell-enabled: true # override per item
|
||||
#
|
||||
# Items not listed under any category fall into MISC automatically.
|
||||
# Set buy-price to -1 to disable buying for that item.
|
||||
# Set sell-price to -1 to disable selling for that item.
|
||||
# ============================================================
|
||||
|
||||
categories:
|
||||
|
||||
BLOCKS:
|
||||
display-name: "&7Blocks"
|
||||
icon: STONE
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
STONE: { buy-price: 1.00 }
|
||||
COBBLESTONE: { buy-price: 0.50 }
|
||||
DIRT: { buy-price: 0.20 }
|
||||
GRASS_BLOCK: { buy-price: 0.30 }
|
||||
SAND: { buy-price: 0.50 }
|
||||
GRAVEL: { buy-price: 0.50 }
|
||||
CLAY: { buy-price: 1.00 }
|
||||
NETHERRACK: { buy-price: 0.20 }
|
||||
SOUL_SAND: { buy-price: 1.50 }
|
||||
SOUL_SOIL: { buy-price: 1.50 }
|
||||
BASALT: { buy-price: 0.50 }
|
||||
BLACKSTONE: { buy-price: 0.50 }
|
||||
OBSIDIAN: { buy-price: 8.00 }
|
||||
CRYING_OBSIDIAN: { buy-price: 10.00 }
|
||||
OAK_LOG: { buy-price: 1.50 }
|
||||
SPRUCE_LOG: { buy-price: 1.50 }
|
||||
BIRCH_LOG: { buy-price: 1.50 }
|
||||
JUNGLE_LOG: { buy-price: 1.50 }
|
||||
ACACIA_LOG: { buy-price: 1.50 }
|
||||
DARK_OAK_LOG: { buy-price: 1.50 }
|
||||
MANGROVE_LOG: { buy-price: 1.50 }
|
||||
CHERRY_LOG: { buy-price: 1.50 }
|
||||
BAMBOO_BLOCK: { buy-price: 0.50 }
|
||||
OAK_PLANKS: { buy-price: 0.75 }
|
||||
SPRUCE_PLANKS: { buy-price: 0.75 }
|
||||
BIRCH_PLANKS: { buy-price: 0.75 }
|
||||
JUNGLE_PLANKS: { buy-price: 0.75 }
|
||||
ACACIA_PLANKS: { buy-price: 0.75 }
|
||||
DARK_OAK_PLANKS: { buy-price: 0.75 }
|
||||
MANGROVE_PLANKS: { buy-price: 0.75 }
|
||||
CHERRY_PLANKS: { buy-price: 0.75 }
|
||||
GRANITE: { buy-price: 0.80 }
|
||||
DIORITE: { buy-price: 0.80 }
|
||||
ANDESITE: { buy-price: 0.80 }
|
||||
CALCITE: { buy-price: 0.80 }
|
||||
TUFF: { buy-price: 0.80 }
|
||||
DEEPSLATE: { buy-price: 1.00 }
|
||||
MUD: { buy-price: 0.30 }
|
||||
PACKED_MUD: { buy-price: 0.60 }
|
||||
MUDDY_MANGROVE_ROOTS: { buy-price: 0.50 }
|
||||
ICE: { buy-price: 1.00 }
|
||||
PACKED_ICE: { buy-price: 2.00 }
|
||||
BLUE_ICE: { buy-price: 4.00 }
|
||||
SNOW_BLOCK: { buy-price: 0.50 }
|
||||
SANDSTONE: { buy-price: 1.00 }
|
||||
RED_SANDSTONE: { buy-price: 1.00 }
|
||||
PRISMARINE: { buy-price: 3.00 }
|
||||
PRISMARINE_BRICKS: { buy-price: 4.00 }
|
||||
DARK_PRISMARINE: { buy-price: 4.00 }
|
||||
SEA_LANTERN: { buy-price: 6.00 }
|
||||
PURPUR_BLOCK: { buy-price: 5.00 }
|
||||
END_STONE: { buy-price: 3.00 }
|
||||
END_STONE_BRICKS: { buy-price: 4.00 }
|
||||
|
||||
ORES:
|
||||
display-name: "&bOres & Minerals"
|
||||
icon: DIAMOND_ORE
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
COAL: { buy-price: 2.00 }
|
||||
CHARCOAL: { buy-price: 1.50 }
|
||||
IRON_INGOT: { buy-price: 5.00 }
|
||||
IRON_NUGGET: { buy-price: 0.60 }
|
||||
GOLD_INGOT: { buy-price: 8.00 }
|
||||
GOLD_NUGGET: { buy-price: 1.00 }
|
||||
COPPER_INGOT: { buy-price: 3.00 }
|
||||
RAW_IRON: { buy-price: 4.00 }
|
||||
RAW_GOLD: { buy-price: 7.00 }
|
||||
RAW_COPPER: { buy-price: 2.50 }
|
||||
DIAMOND: { buy-price: 50.00 }
|
||||
EMERALD: { buy-price: 40.00 }
|
||||
LAPIS_LAZULI: { buy-price: 5.00 }
|
||||
REDSTONE: { buy-price: 2.00 }
|
||||
QUARTZ: { buy-price: 2.00 }
|
||||
NETHERITE_INGOT: { buy-price: 500.00 }
|
||||
NETHERITE_SCRAP: { buy-price: 100.00 }
|
||||
AMETHYST_SHARD: { buy-price: 4.00 }
|
||||
ECHO_SHARD: { buy-price: 30.00 }
|
||||
COAL_ORE: { buy-price: 3.00 }
|
||||
DEEPSLATE_COAL_ORE: { buy-price: 4.00 }
|
||||
IRON_ORE: { buy-price: 6.00 }
|
||||
DEEPSLATE_IRON_ORE: { buy-price: 7.00 }
|
||||
GOLD_ORE: { buy-price: 10.00 }
|
||||
DEEPSLATE_GOLD_ORE: { buy-price: 11.00 }
|
||||
COPPER_ORE: { buy-price: 4.00 }
|
||||
DEEPSLATE_COPPER_ORE: { buy-price: 5.00 }
|
||||
DIAMOND_ORE: { buy-price: 60.00 }
|
||||
DEEPSLATE_DIAMOND_ORE: { buy-price: 70.00 }
|
||||
EMERALD_ORE: { buy-price: 50.00 }
|
||||
DEEPSLATE_EMERALD_ORE: { buy-price: 60.00 }
|
||||
LAPIS_ORE: { buy-price: 8.00 }
|
||||
DEEPSLATE_LAPIS_ORE: { buy-price: 10.00 }
|
||||
REDSTONE_ORE: { buy-price: 5.00 }
|
||||
DEEPSLATE_REDSTONE_ORE: { buy-price: 6.00 }
|
||||
NETHER_QUARTZ_ORE: { buy-price: 3.00 }
|
||||
NETHER_GOLD_ORE: { buy-price: 9.00 }
|
||||
ANCIENT_DEBRIS: { buy-price: 200.00 }
|
||||
|
||||
FARMING:
|
||||
display-name: "&aFarming"
|
||||
icon: WHEAT
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
WHEAT: { buy-price: 1.00 }
|
||||
WHEAT_SEEDS: { buy-price: 0.30 }
|
||||
CARROT: { buy-price: 0.80 }
|
||||
POTATO: { buy-price: 0.80 }
|
||||
BEETROOT: { buy-price: 0.80 }
|
||||
BEETROOT_SEEDS: { buy-price: 0.30 }
|
||||
PUMPKIN: { buy-price: 2.00 }
|
||||
PUMPKIN_SEEDS: { buy-price: 0.50 }
|
||||
MELON: { buy-price: 0.50 }
|
||||
MELON_SEEDS: { buy-price: 0.50 }
|
||||
SUGAR_CANE: { buy-price: 0.50 }
|
||||
CACTUS: { buy-price: 0.50 }
|
||||
BAMBOO: { buy-price: 0.20 }
|
||||
COCOA_BEANS: { buy-price: 1.00 }
|
||||
NETHER_WART: { buy-price: 2.00 }
|
||||
CHORUS_FRUIT: { buy-price: 3.00 }
|
||||
CHORUS_FLOWER: { buy-price: 5.00 }
|
||||
KELP: { buy-price: 0.30 }
|
||||
DRIED_KELP_BLOCK: { buy-price: 1.00 }
|
||||
SEA_PICKLE: { buy-price: 1.00 }
|
||||
LILY_PAD: { buy-price: 0.50 }
|
||||
VINE: { buy-price: 0.30 }
|
||||
GLOW_BERRIES: { buy-price: 1.00 }
|
||||
SWEET_BERRIES: { buy-price: 0.80 }
|
||||
TORCHFLOWER_SEEDS: { buy-price: 5.00 }
|
||||
PITCHER_POD: { buy-price: 5.00 }
|
||||
SNIFFER_EGG: { buy-price: 20.00 }
|
||||
|
||||
FOOD:
|
||||
display-name: "&eFood"
|
||||
icon: COOKED_BEEF
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
BREAD: { buy-price: 2.00 }
|
||||
APPLE: { buy-price: 1.50 }
|
||||
GOLDEN_APPLE: { buy-price: 20.00 }
|
||||
ENCHANTED_GOLDEN_APPLE: { buy-price: 200.00, sell-enabled: false }
|
||||
COOKED_BEEF: { buy-price: 3.00 }
|
||||
BEEF: { buy-price: 1.50 }
|
||||
COOKED_PORKCHOP: { buy-price: 3.00 }
|
||||
PORKCHOP: { buy-price: 1.50 }
|
||||
COOKED_CHICKEN: { buy-price: 2.50 }
|
||||
CHICKEN: { buy-price: 1.00 }
|
||||
COOKED_MUTTON: { buy-price: 3.00 }
|
||||
MUTTON: { buy-price: 1.50 }
|
||||
COOKED_RABBIT: { buy-price: 3.00 }
|
||||
RABBIT: { buy-price: 1.50 }
|
||||
COOKED_COD: { buy-price: 2.50 }
|
||||
COD: { buy-price: 1.00 }
|
||||
COOKED_SALMON: { buy-price: 2.50 }
|
||||
SALMON: { buy-price: 1.00 }
|
||||
TROPICAL_FISH: { buy-price: 0.50 }
|
||||
PUFFERFISH: { buy-price: 1.50 }
|
||||
CAKE: { buy-price: 5.00 }
|
||||
COOKIE: { buy-price: 1.00 }
|
||||
PUMPKIN_PIE: { buy-price: 2.00 }
|
||||
MUSHROOM_STEW: { buy-price: 3.00 }
|
||||
RABBIT_STEW: { buy-price: 5.00 }
|
||||
BEETROOT_SOUP: { buy-price: 3.00 }
|
||||
SUSPICIOUS_STEW: { buy-price: 4.00 }
|
||||
HONEY_BOTTLE: { buy-price: 5.00 }
|
||||
|
||||
MOB_DROPS:
|
||||
display-name: "&cMob Drops"
|
||||
icon: BONE
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
BONE: { buy-price: 1.50 }
|
||||
BONE_MEAL: { buy-price: 0.50 }
|
||||
STRING: { buy-price: 1.00 }
|
||||
SPIDER_EYE: { buy-price: 2.00 }
|
||||
ROTTEN_FLESH: { buy-price: 0.20 }
|
||||
ENDER_PEARL: { buy-price: 8.00 }
|
||||
BLAZE_ROD: { buy-price: 6.00 }
|
||||
BLAZE_POWDER: { buy-price: 3.00 }
|
||||
GHAST_TEAR: { buy-price: 10.00 }
|
||||
MAGMA_CREAM: { buy-price: 4.00 }
|
||||
SLIME_BALL: { buy-price: 4.00 }
|
||||
GUNPOWDER: { buy-price: 3.00 }
|
||||
FEATHER: { buy-price: 1.00 }
|
||||
LEATHER: { buy-price: 3.00 }
|
||||
RABBIT_HIDE: { buy-price: 1.50 }
|
||||
RABBIT_FOOT: { buy-price: 6.00 }
|
||||
INK_SAC: { buy-price: 1.50 }
|
||||
GLOW_INK_SAC: { buy-price: 5.00 }
|
||||
PRISMARINE_SHARD: { buy-price: 2.50 }
|
||||
PRISMARINE_CRYSTALS: { buy-price: 2.50 }
|
||||
SHULKER_SHELL: { buy-price: 20.00 }
|
||||
TOTEM_OF_UNDYING: { buy-price: 100.00, sell-price: 30.00 }
|
||||
NETHER_STAR: { buy-price: 200.00, sell-price: 50.00 }
|
||||
DRAGON_BREATH: { buy-price: 20.00 }
|
||||
ELYTRA: { buy-price: 300.00, sell-enabled: false }
|
||||
TURTLE_SCUTE: { buy-price: 8.00 }
|
||||
ARMADILLO_SCUTE: { buy-price: 5.00 }
|
||||
BREEZE_ROD: { buy-price: 15.00 }
|
||||
WIND_CHARGE: { buy-price: 8.00 }
|
||||
OMINOUS_TRIAL_KEY: { buy-price: 30.00 }
|
||||
TRIAL_KEY: { buy-price: 15.00 }
|
||||
|
||||
REDSTONE:
|
||||
display-name: "&cRedstone"
|
||||
icon: REDSTONE
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
REDSTONE: { buy-price: 2.00 }
|
||||
REDSTONE_BLOCK: { buy-price: 18.00 }
|
||||
REDSTONE_TORCH: { buy-price: 1.00 }
|
||||
REPEATER: { buy-price: 3.00 }
|
||||
COMPARATOR: { buy-price: 5.00 }
|
||||
OBSERVER: { buy-price: 4.00 }
|
||||
PISTON: { buy-price: 4.00 }
|
||||
STICKY_PISTON: { buy-price: 6.00 }
|
||||
DROPPER: { buy-price: 3.00 }
|
||||
DISPENSER: { buy-price: 5.00 }
|
||||
HOPPER: { buy-price: 8.00 }
|
||||
LEVER: { buy-price: 0.50 }
|
||||
STONE_BUTTON: { buy-price: 0.50 }
|
||||
OAK_BUTTON: { buy-price: 0.50 }
|
||||
STONE_PRESSURE_PLATE: { buy-price: 1.00 }
|
||||
OAK_PRESSURE_PLATE: { buy-price: 1.00 }
|
||||
TRIPWIRE_HOOK: { buy-price: 2.00 }
|
||||
TNT: { buy-price: 5.00 }
|
||||
DAYLIGHT_DETECTOR: { buy-price: 6.00 }
|
||||
TRAPPED_CHEST: { buy-price: 4.00 }
|
||||
TARGET: { buy-price: 3.00 }
|
||||
SCULK_SENSOR: { buy-price: 10.00 }
|
||||
CALIBRATED_SCULK_SENSOR: { buy-price: 20.00 }
|
||||
COPPER_BULB: { buy-price: 5.00 }
|
||||
|
||||
DECORATION:
|
||||
display-name: "&dDecoration"
|
||||
icon: FLOWER_POT
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
TORCH: { buy-price: 0.10 }
|
||||
LANTERN: { buy-price: 2.00 }
|
||||
SOUL_LANTERN: { buy-price: 2.50 }
|
||||
CANDLE: { buy-price: 1.50 }
|
||||
FLOWER_POT: { buy-price: 0.50 }
|
||||
ITEM_FRAME: { buy-price: 1.00 }
|
||||
GLOW_ITEM_FRAME: { buy-price: 5.00 }
|
||||
PAINTING: { buy-price: 1.50 }
|
||||
ARMOR_STAND: { buy-price: 3.00 }
|
||||
BANNER: { buy-price: 3.00 }
|
||||
OAK_SIGN: { buy-price: 1.00 }
|
||||
HANGING_SIGN: { buy-price: 2.00 }
|
||||
CHAIN: { buy-price: 1.50 }
|
||||
BELL: { buy-price: 15.00 }
|
||||
CONDUIT: { buy-price: 40.00 }
|
||||
BEACON: { buy-price: 250.00, sell-enabled: false }
|
||||
BOOKSHELF: { buy-price: 4.00 }
|
||||
CHISELED_BOOKSHELF: { buy-price: 5.00 }
|
||||
LECTERN: { buy-price: 6.00 }
|
||||
JUKEBOX: { buy-price: 10.00 }
|
||||
NOTE_BLOCK: { buy-price: 3.00 }
|
||||
GLASS: { buy-price: 1.50 }
|
||||
GLASS_PANE: { buy-price: 0.50 }
|
||||
STAINED_GLASS: { buy-price: 2.00 }
|
||||
STAINED_GLASS_PANE: { buy-price: 0.80 }
|
||||
TERRACOTTA: { buy-price: 1.50 }
|
||||
GLAZED_TERRACOTTA: { buy-price: 2.50 }
|
||||
CONCRETE: { buy-price: 2.00 }
|
||||
CONCRETE_POWDER: { buy-price: 1.50 }
|
||||
WOOL: { buy-price: 2.00 }
|
||||
CARPET: { buy-price: 1.50 }
|
||||
DANDELION: { buy-price: 0.30 }
|
||||
POPPY: { buy-price: 0.30 }
|
||||
BLUE_ORCHID: { buy-price: 0.50 }
|
||||
ALLIUM: { buy-price: 0.50 }
|
||||
SUNFLOWER: { buy-price: 0.50 }
|
||||
ROSE_BUSH: { buy-price: 0.50 }
|
||||
PEONY: { buy-price: 0.50 }
|
||||
WITHER_ROSE: { buy-price: 5.00 }
|
||||
CHERRY_LEAVES: { buy-price: 0.20 }
|
||||
PINK_PETALS: { buy-price: 0.50 }
|
||||
TORCHFLOWER: { buy-price: 4.00 }
|
||||
PITCHER_PLANT: { buy-price: 4.00 }
|
||||
|
||||
TOOLS:
|
||||
display-name: "&7Tools"
|
||||
icon: IRON_PICKAXE
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
WOODEN_PICKAXE: { buy-price: 5.00, sell-price: 1.00 }
|
||||
STONE_PICKAXE: { buy-price: 10.00, sell-price: 2.00 }
|
||||
IRON_PICKAXE: { buy-price: 20.00, sell-price: 4.00 }
|
||||
GOLDEN_PICKAXE: { buy-price: 12.00, sell-price: 2.00 }
|
||||
DIAMOND_PICKAXE: { buy-price: 80.00, sell-price: 15.00 }
|
||||
NETHERITE_PICKAXE: { buy-price: 600.00, sell-price: 100.00 }
|
||||
WOODEN_AXE: { buy-price: 5.00, sell-price: 1.00 }
|
||||
STONE_AXE: { buy-price: 10.00, sell-price: 2.00 }
|
||||
IRON_AXE: { buy-price: 20.00, sell-price: 4.00 }
|
||||
DIAMOND_AXE: { buy-price: 80.00, sell-price: 15.00 }
|
||||
NETHERITE_AXE: { buy-price: 600.00, sell-price: 100.00 }
|
||||
WOODEN_SHOVEL: { buy-price: 4.00, sell-price: 0.80 }
|
||||
STONE_SHOVEL: { buy-price: 8.00, sell-price: 1.50 }
|
||||
IRON_SHOVEL: { buy-price: 15.00, sell-price: 3.00 }
|
||||
DIAMOND_SHOVEL: { buy-price: 60.00, sell-price: 10.00 }
|
||||
NETHERITE_SHOVEL: { buy-price: 550.00, sell-price: 90.00 }
|
||||
WOODEN_HOE: { buy-price: 4.00, sell-price: 0.80 }
|
||||
STONE_HOE: { buy-price: 8.00, sell-price: 1.50 }
|
||||
IRON_HOE: { buy-price: 15.00, sell-price: 3.00 }
|
||||
DIAMOND_HOE: { buy-price: 60.00, sell-price: 10.00 }
|
||||
NETHERITE_HOE: { buy-price: 550.00, sell-price: 90.00 }
|
||||
SHEARS: { buy-price: 8.00, sell-price: 1.50 }
|
||||
FLINT_AND_STEEL: { buy-price: 6.00, sell-price: 1.00 }
|
||||
FISHING_ROD: { buy-price: 5.00, sell-price: 1.00 }
|
||||
COMPASS: { buy-price: 5.00 }
|
||||
CLOCK: { buy-price: 8.00 }
|
||||
SPYGLASS: { buy-price: 12.00 }
|
||||
BRUSH: { buy-price: 5.00 }
|
||||
BUCKET: { buy-price: 8.00 }
|
||||
WATER_BUCKET: { buy-price: 9.00 }
|
||||
LAVA_BUCKET: { buy-price: 12.00 }
|
||||
MILK_BUCKET: { buy-price: 5.00 }
|
||||
POWDER_SNOW_BUCKET: { buy-price: 5.00 }
|
||||
|
||||
COMBAT:
|
||||
display-name: "&4Combat"
|
||||
icon: IRON_SWORD
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
WOODEN_SWORD: { buy-price: 5.00, sell-price: 1.00 }
|
||||
STONE_SWORD: { buy-price: 10.00, sell-price: 2.00 }
|
||||
IRON_SWORD: { buy-price: 20.00, sell-price: 4.00 }
|
||||
GOLDEN_SWORD: { buy-price: 12.00, sell-price: 2.00 }
|
||||
DIAMOND_SWORD: { buy-price: 80.00, sell-price: 15.00 }
|
||||
NETHERITE_SWORD: { buy-price: 600.00, sell-price: 100.00 }
|
||||
BOW: { buy-price: 10.00, sell-price: 2.00 }
|
||||
CROSSBOW: { buy-price: 15.00, sell-price: 3.00 }
|
||||
TRIDENT: { buy-price: 80.00, sell-price: 15.00 }
|
||||
ARROW: { buy-price: 0.50 }
|
||||
SPECTRAL_ARROW: { buy-price: 1.00 }
|
||||
TIPPED_ARROW: { buy-price: 2.00, sell-enabled: false }
|
||||
SHIELD: { buy-price: 15.00, sell-price: 3.00 }
|
||||
IRON_HELMET: { buy-price: 25.00, sell-price: 5.00 }
|
||||
IRON_CHESTPLATE: { buy-price: 40.00, sell-price: 8.00 }
|
||||
IRON_LEGGINGS: { buy-price: 35.00, sell-price: 7.00 }
|
||||
IRON_BOOTS: { buy-price: 20.00, sell-price: 4.00 }
|
||||
DIAMOND_HELMET: { buy-price: 100.00, sell-price: 20.00 }
|
||||
DIAMOND_CHESTPLATE: { buy-price: 160.00, sell-price: 30.00 }
|
||||
DIAMOND_LEGGINGS: { buy-price: 140.00, sell-price: 25.00 }
|
||||
DIAMOND_BOOTS: { buy-price: 80.00, sell-price: 15.00 }
|
||||
NETHERITE_HELMET: { buy-price: 700.00, sell-price: 120.00 }
|
||||
NETHERITE_CHESTPLATE: { buy-price: 900.00, sell-price: 150.00 }
|
||||
NETHERITE_LEGGINGS: { buy-price: 850.00, sell-price: 140.00 }
|
||||
NETHERITE_BOOTS: { buy-price: 750.00, sell-price: 130.00 }
|
||||
GOLDEN_HELMET: { buy-price: 20.00, sell-price: 3.00 }
|
||||
GOLDEN_CHESTPLATE: { buy-price: 35.00, sell-price: 5.00 }
|
||||
GOLDEN_LEGGINGS: { buy-price: 30.00, sell-price: 4.50 }
|
||||
GOLDEN_BOOTS: { buy-price: 20.00, sell-price: 3.00 }
|
||||
|
||||
BREWING:
|
||||
display-name: "&5Brewing"
|
||||
icon: BREWING_STAND
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
BREWING_STAND: { buy-price: 8.00 }
|
||||
CAULDRON: { buy-price: 10.00 }
|
||||
GLASS_BOTTLE: { buy-price: 0.50 }
|
||||
WATER_BOTTLE: { buy-price: 1.00 }
|
||||
FERMENTED_SPIDER_EYE: { buy-price: 5.00 }
|
||||
SUGAR: { buy-price: 0.50 }
|
||||
GLISTERING_MELON_SLICE: { buy-price: 10.00 }
|
||||
GOLDEN_CARROT: { buy-price: 8.00 }
|
||||
PUFFERFISH: { buy-price: 4.00 }
|
||||
MAGMA_CREAM: { buy-price: 4.00 }
|
||||
PHANTOM_MEMBRANE: { buy-price: 8.00 }
|
||||
RABBIT_FOOT: { buy-price: 6.00 }
|
||||
TURTLE_HELMET: { buy-price: 50.00, sell-price: 8.00 }
|
||||
DRAGON_BREATH: { buy-price: 20.00 }
|
||||
|
||||
MISC:
|
||||
display-name: "&8Miscellaneous"
|
||||
icon: CHEST
|
||||
buy-enabled: true
|
||||
sell-enabled: true
|
||||
items:
|
||||
CHEST: { buy-price: 3.00 }
|
||||
TRAPPED_CHEST: { buy-price: 4.00 }
|
||||
BARREL: { buy-price: 4.00 }
|
||||
SHULKER_BOX: { buy-price: 40.00 }
|
||||
ENDER_CHEST: { buy-price: 30.00 }
|
||||
CRAFTING_TABLE: { buy-price: 2.00 }
|
||||
FURNACE: { buy-price: 3.00 }
|
||||
BLAST_FURNACE: { buy-price: 8.00 }
|
||||
SMOKER: { buy-price: 6.00 }
|
||||
ANVIL: { buy-price: 15.00 }
|
||||
GRINDSTONE: { buy-price: 8.00 }
|
||||
STONECUTTER: { buy-price: 6.00 }
|
||||
SMITHING_TABLE: { buy-price: 8.00 }
|
||||
LOOM: { buy-price: 5.00 }
|
||||
CARTOGRAPHY_TABLE: { buy-price: 5.00 }
|
||||
FLETCHING_TABLE: { buy-price: 5.00 }
|
||||
ENCHANTING_TABLE: { buy-price: 50.00 }
|
||||
EXPERIENCE_BOTTLE: { buy-price: 5.00 }
|
||||
NAME_TAG: { buy-price: 20.00 }
|
||||
SADDLE: { buy-price: 15.00, sell-price: 3.00 }
|
||||
LEAD: { buy-price: 5.00 }
|
||||
BOOK: { buy-price: 2.00 }
|
||||
BOOKSHELF: { buy-price: 4.00 }
|
||||
PAPER: { buy-price: 0.30 }
|
||||
MAP: { buy-price: 2.00 }
|
||||
CLOCK: { buy-price: 8.00 }
|
||||
COMPASS: { buy-price: 5.00 }
|
||||
TORCH: { buy-price: 0.10 }
|
||||
FLINT: { buy-price: 0.50 }
|
||||
STICK: { buy-price: 0.10 }
|
||||
BOWL: { buy-price: 0.20 }
|
||||
BRICK: { buy-price: 1.00 }
|
||||
NETHER_BRICK: { buy-price: 1.00 }
|
||||
CLAY_BALL: { buy-price: 0.30 }
|
||||
SNOWBALL: { buy-price: 0.10 }
|
||||
EGG: { buy-price: 0.20 }
|
||||
TURTLE_EGG: { buy-price: 3.00 }
|
||||
DRAGON_EGG: { buy-price: 1000.00, sell-enabled: false }
|
||||
HEART_OF_THE_SEA: { buy-price: 80.00 }
|
||||
NAUTILUS_SHELL: { buy-price: 10.00 }
|
||||
TRIDENT: { buy-price: 80.00, sell-price: 15.00 }
|
||||
MUSIC_DISC_13: { buy-price: 15.00 }
|
||||
MUSIC_DISC_CAT: { buy-price: 15.00 }
|
||||
MUSIC_DISC_BLOCKS: { buy-price: 15.00 }
|
||||
MUSIC_DISC_CHIRP: { buy-price: 15.00 }
|
||||
MUSIC_DISC_FAR: { buy-price: 15.00 }
|
||||
MUSIC_DISC_MALL: { buy-price: 15.00 }
|
||||
MUSIC_DISC_MELLOHI: { buy-price: 15.00 }
|
||||
MUSIC_DISC_STAL: { buy-price: 15.00 }
|
||||
MUSIC_DISC_STRAD: { buy-price: 15.00 }
|
||||
MUSIC_DISC_WARD: { buy-price: 15.00 }
|
||||
MUSIC_DISC_11: { buy-price: 15.00 }
|
||||
MUSIC_DISC_WAIT: { buy-price: 15.00 }
|
||||
MUSIC_DISC_OTHERSIDE: { buy-price: 20.00 }
|
||||
MUSIC_DISC_5: { buy-price: 20.00 }
|
||||
MUSIC_DISC_PIGSTEP: { buy-price: 20.00 }
|
||||
MUSIC_DISC_RELIC: { buy-price: 20.00 }
|
||||
DISC_FRAGMENT_5: { buy-price: 3.00 }
|
||||
POTTERY_SHARD_ARMS_UP: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_BLADE: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_BREWER: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_BURN: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_DANGER: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_EXPLORER: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_FRIEND: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_HEART: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_HEARTBREAK: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_HOWL: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_MINER: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_MOURNER: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_PLENTY: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_PRIZE: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_SHEAF: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_SHELTER: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_SKULL: { buy-price: 5.00 }
|
||||
POTTERY_SHARD_SNORT: { buy-price: 5.00 }
|
||||
DECORATED_POT: { buy-price: 8.00 }
|
||||
BUNDLE: { buy-price: 5.00 }
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -124,11 +124,8 @@ public class ConfigManager {
|
||||
// Economy settings
|
||||
currencyFormat = config.getString("economy.currency-format", "$#,##0.00");
|
||||
currencySymbol = config.getString("economy.currency-symbol", "$");
|
||||
// Clamp taxes to [0, 100]. A tax > 100 would make seller earnings negative
|
||||
// (price * (1 - tax/100)) which the deposit path would then mint/refuse - a config
|
||||
// mistake must never be able to create or destroy money.
|
||||
marketTax = clampPercent(config.getDouble("economy.taxes.market-tax", 5.0));
|
||||
auctionTax = clampPercent(config.getDouble("economy.taxes.auction-tax", 7.5));
|
||||
marketTax = config.getDouble("economy.taxes.market-tax", 5.0);
|
||||
auctionTax = config.getDouble("economy.taxes.auction-tax", 7.5);
|
||||
|
||||
// Market settings
|
||||
maxListingsPerPlayer = config.getInt("market.max-listings-per-player", 20);
|
||||
@@ -275,23 +272,6 @@ public class ConfigManager {
|
||||
return blacklistedMaterials.contains(material);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps a percentage value to the valid [0, 100] range.
|
||||
* Non-finite values (NaN/Infinity from a malformed config) fall back to 0.
|
||||
*/
|
||||
private double clampPercent(double value) {
|
||||
if (Double.isNaN(value) || Double.isInfinite(value)) {
|
||||
plugin.getLogger().warning("Invalid tax percentage in config; defaulting to 0.");
|
||||
return 0.0;
|
||||
}
|
||||
if (value < 0.0) return 0.0;
|
||||
if (value > 100.0) {
|
||||
plugin.getLogger().warning("Tax percentage " + value + " exceeds 100; clamping to 100.");
|
||||
return 100.0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if text contains blacklisted keywords
|
||||
*/
|
||||
|
||||
@@ -36,8 +36,8 @@ public class MessageManager {
|
||||
public void reload() {
|
||||
messageCache.clear();
|
||||
|
||||
// Get language from config (default pt_PT; en_US remains bundled as a fallback)
|
||||
currentLanguage = plugin.getConfig().getString("language", "pt_PT");
|
||||
// Get language from config
|
||||
currentLanguage = plugin.getConfig().getString("language", "en_US");
|
||||
|
||||
// Save default language files
|
||||
saveDefaultLanguageFiles();
|
||||
|
||||
@@ -394,30 +394,6 @@ public class DatabaseManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically transitions a listing to a new status ONLY if it is still ACTIVE.
|
||||
* Returns true only for the caller that actually changed the row, so it can be
|
||||
* used as a compare-and-swap guard to prevent double-processing races such as
|
||||
* cancel-vs-purchase or expire-vs-purchase (which would otherwise duplicate the item).
|
||||
*/
|
||||
public CompletableFuture<Boolean> updateListingStatusIfActive(int listingId, Listing.ListingStatus status) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
String sql = "UPDATE listings SET status = ? WHERE id = ? AND status = 'ACTIVE'";
|
||||
|
||||
try (Connection conn = getConnection();
|
||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
|
||||
stmt.setString(1, status.name());
|
||||
stmt.setInt(2, listingId);
|
||||
|
||||
return stmt.executeUpdate() > 0;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to update listing status (conditional)", e);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets expired active listings.
|
||||
*/
|
||||
@@ -690,31 +666,6 @@ public class DatabaseManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically transitions an auction to a new status ONLY if it is still ACTIVE.
|
||||
* Returns true only for the caller that actually changed the row. Used as a
|
||||
* compare-and-swap guard so that ending, buying-out or cancelling an auction can
|
||||
* never be processed twice (which would otherwise duplicate seller earnings and
|
||||
* the item delivered to the winner/seller).
|
||||
*/
|
||||
public CompletableFuture<Boolean> updateAuctionStatusIfActive(int auctionId, Auction.AuctionStatus status) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
String sql = "UPDATE auctions SET status = ? WHERE id = ? AND status = 'ACTIVE'";
|
||||
|
||||
try (Connection conn = getConnection();
|
||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
||||
|
||||
stmt.setString(1, status.name());
|
||||
stmt.setInt(2, auctionId);
|
||||
|
||||
return stmt.executeUpdate() > 0;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().log(Level.WARNING, "Failed to update auction status (conditional)", e);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets auctions that have ended but are still active.
|
||||
*/
|
||||
|
||||
@@ -45,10 +45,6 @@ public class CreateAuctionGui implements MarketGui {
|
||||
private Double buyoutPrice = null;
|
||||
private int durationHours;
|
||||
|
||||
// Prevents double-submission (e.g. rapid double-click on confirm) which would
|
||||
// otherwise create two auctions while only one set of items is removed = item/money dupe.
|
||||
private boolean processing = false;
|
||||
|
||||
// ==================== LAYOUT CONSTANTS ====================
|
||||
private static final int INFO_SLOT = 4; // Top center
|
||||
private static final int ITEM_DISPLAY_SLOT = 13; // Center
|
||||
@@ -318,11 +314,6 @@ public class CreateAuctionGui implements MarketGui {
|
||||
}
|
||||
|
||||
private void confirmAuction(Player player) {
|
||||
// Guard against double-submission: a confirm is already being processed.
|
||||
if (processing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var msgManager = plugin.getMessageManager();
|
||||
|
||||
// Verify item still exists in player's inventory with sufficient quantity
|
||||
@@ -349,45 +340,21 @@ public class CreateAuctionGui implements MarketGui {
|
||||
|
||||
// Create the auction
|
||||
ItemStack auctionItem = selectedItem.clone();
|
||||
int amount = auctionItem.getAmount();
|
||||
|
||||
// From here an async creation is in flight; block further confirms until it finishes.
|
||||
processing = true;
|
||||
|
||||
// Reserve the items NOW, atomically on the main thread, BEFORE the async DB write.
|
||||
// Removing after the async round-trip is a dupe window: during the round-trip the
|
||||
// player could drop/stash/hand off the items (the auction is built from a clone and
|
||||
// does not need the live items), leaving them with both the items AND an auction that
|
||||
// delivers the item to the winner. Remove-first + refund-on-failure closes that window.
|
||||
if (!InventoryUtil.removeItem(player, auctionItem, amount)) {
|
||||
processing = false;
|
||||
player.sendMessage(msgManager.getPrefixed("messages.item-no-longer-available"));
|
||||
SoundUtil.playSound(player, plugin.getConfigManager().getErrorSound());
|
||||
new ItemSelectionGui(plugin, guiManager, ItemSelectionGui.SelectionMode.AUCTION).open(player);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getTransactionService().createAuctionTransaction(
|
||||
player, auctionItem, startPrice, buyoutPrice, durationHours
|
||||
).thenAccept(result -> {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
processing = false;
|
||||
if (result.isSuccess()) {
|
||||
// Remove items from inventory AFTER successful creation
|
||||
InventoryUtil.removeItem(player, auctionItem, auctionItem.getAmount());
|
||||
|
||||
player.sendMessage(msgManager.getPrefixed("messages.auction-created",
|
||||
"id", String.valueOf(result.getId())));
|
||||
SoundUtil.playSound(player, plugin.getConfigManager().getSuccessSound());
|
||||
player.closeInventory();
|
||||
guiManager.openMainMenu(player);
|
||||
} else {
|
||||
// Creation failed AFTER we removed the items - give them back so nothing is lost.
|
||||
ItemStack refund = auctionItem.clone();
|
||||
refund.setAmount(amount);
|
||||
ItemStack leftover = InventoryUtil.giveItem(player, refund);
|
||||
if (leftover != null) {
|
||||
plugin.getClaimService().addClaimItem(player.getUniqueId(), leftover,
|
||||
pt.henrique.communityMarket.model.ClaimItem.ClaimReason.ADMIN_RETURN,
|
||||
"Auction creation failed");
|
||||
}
|
||||
player.sendMessage(msgManager.getPrefixed("messages." + result.getErrorKey()));
|
||||
SoundUtil.playSound(player, plugin.getConfigManager().getErrorSound());
|
||||
}
|
||||
|
||||
@@ -44,10 +44,6 @@ public class CreateListingGui implements MarketGui {
|
||||
private double price;
|
||||
private int durationHours;
|
||||
|
||||
// Prevents double-submission (e.g. rapid double-click on confirm) which would
|
||||
// otherwise create two listings while only one set of items is removed = item/money dupe.
|
||||
private boolean processing = false;
|
||||
|
||||
// ==================== LAYOUT CONSTANTS ====================
|
||||
private static final int INFO_SLOT = 4; // Top center
|
||||
private static final int ITEM_DISPLAY_SLOT = 13; // Center row 1
|
||||
@@ -262,11 +258,6 @@ public class CreateListingGui implements MarketGui {
|
||||
}
|
||||
|
||||
private void confirmListing(Player player) {
|
||||
// Guard against double-submission: a confirm is already being processed.
|
||||
if (processing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var msgManager = plugin.getMessageManager();
|
||||
|
||||
// Verify item still exists in player's inventory with sufficient quantity
|
||||
@@ -295,44 +286,20 @@ public class CreateListingGui implements MarketGui {
|
||||
int amount = selectedItem.getAmount();
|
||||
ItemStack listItem = selectedItem.clone();
|
||||
|
||||
// From here an async creation is in flight; block further confirms until it finishes.
|
||||
processing = true;
|
||||
|
||||
// Reserve the items NOW, atomically on the main thread, BEFORE the async DB write.
|
||||
// Removing after the async round-trip is a dupe window: during the round-trip the
|
||||
// player could drop/stash/hand off the items (the listing is built from a clone and
|
||||
// does not need the live items), leaving them with both the items AND a listing that
|
||||
// pays out. Remove-first + refund-on-failure closes that window.
|
||||
if (!InventoryUtil.removeItem(player, listItem, amount)) {
|
||||
// Couldn't take the full amount (item moved between the check and here) - abort.
|
||||
processing = false;
|
||||
player.sendMessage(msgManager.getPrefixed("messages.item-no-longer-available"));
|
||||
SoundUtil.playSound(player, plugin.getConfigManager().getErrorSound());
|
||||
new ItemSelectionGui(plugin, guiManager, ItemSelectionGui.SelectionMode.LISTING).open(player);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getTransactionService().createListingTransaction(
|
||||
player, listItem, amount, price, durationHours
|
||||
).thenAccept(result -> {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
processing = false;
|
||||
if (result.isSuccess()) {
|
||||
// Remove items from inventory AFTER successful creation
|
||||
InventoryUtil.removeItem(player, listItem, amount);
|
||||
|
||||
player.sendMessage(msgManager.getPrefixed("messages.listing-created",
|
||||
"id", String.valueOf(result.getId())));
|
||||
SoundUtil.playSound(player, plugin.getConfigManager().getSuccessSound());
|
||||
player.closeInventory();
|
||||
guiManager.openMainMenu(player);
|
||||
} else {
|
||||
// Creation failed AFTER we removed the items - give them back so nothing is lost.
|
||||
ItemStack refund = listItem.clone();
|
||||
refund.setAmount(amount);
|
||||
ItemStack leftover = InventoryUtil.giveItem(player, refund);
|
||||
if (leftover != null) {
|
||||
plugin.getClaimService().addClaimItem(player.getUniqueId(), leftover,
|
||||
pt.henrique.communityMarket.model.ClaimItem.ClaimReason.ADMIN_RETURN,
|
||||
"Listing creation failed");
|
||||
}
|
||||
player.sendMessage(msgManager.getPrefixed("messages." + result.getErrorKey()));
|
||||
SoundUtil.playSound(player, plugin.getConfigManager().getErrorSound());
|
||||
}
|
||||
|
||||
@@ -48,24 +48,111 @@ public class HelpGui implements MarketGui {
|
||||
inventory.setItem(i, filler);
|
||||
}
|
||||
|
||||
// Help content (localized). Rendered as the book's lore so the Help screen
|
||||
// respects the configured language instead of showing hardcoded English.
|
||||
// Help content
|
||||
List<String> helpContent = msgManager.getList("help.content");
|
||||
|
||||
// Main help book with the localized explanation of every feature
|
||||
inventory.setItem(22, new ItemBuilder(Material.WRITTEN_BOOK)
|
||||
// Main help book
|
||||
inventory.setItem(4, new ItemBuilder(Material.WRITTEN_BOOK)
|
||||
.name(msgManager.getRaw("help.title"))
|
||||
.lore(helpContent)
|
||||
.build());
|
||||
|
||||
// Tax info (values are dynamic; labels come from the language file)
|
||||
inventory.setItem(40, new ItemBuilder(Material.GOLD_NUGGET)
|
||||
.name(msgManager.getRaw("help.tax-title"))
|
||||
// Feature explanations
|
||||
inventory.setItem(19, new ItemBuilder(Material.CHEST)
|
||||
.name("&aBrowse Market")
|
||||
.lore(
|
||||
msgManager.getRaw("help.tax-market").replace("{tax}", String.valueOf(plugin.getConfigManager().getMarketTax())),
|
||||
msgManager.getRaw("help.tax-auction").replace("{tax}", String.valueOf(plugin.getConfigManager().getAuctionTax())),
|
||||
"&7View all fixed-price listings",
|
||||
"&7from other players.",
|
||||
"",
|
||||
msgManager.getRaw("help.tax-note")
|
||||
"&7Click on items to purchase them."
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(20, new ItemBuilder(Material.GOLD_INGOT)
|
||||
.name("&6Browse Auctions")
|
||||
.lore(
|
||||
"&7View all active auctions.",
|
||||
"",
|
||||
"&eLeft-click &7to place a bid",
|
||||
"&eRight-click &7to buyout (if available)"
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(21, new ItemBuilder(Material.WRITABLE_BOOK)
|
||||
.name("&eCreate Listing")
|
||||
.lore(
|
||||
"&7Sell items at a fixed price.",
|
||||
"",
|
||||
"&71. Place your item in the slot",
|
||||
"&72. Set the price",
|
||||
"&73. Choose duration",
|
||||
"&74. Click confirm"
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(22, new ItemBuilder(Material.GOLDEN_HELMET)
|
||||
.name("&eCreate Auction")
|
||||
.lore(
|
||||
"&7Auction items to the highest bidder.",
|
||||
"",
|
||||
"&71. Place your item in the slot",
|
||||
"&72. Set starting price",
|
||||
"&73. Optionally set buyout",
|
||||
"&74. Choose duration",
|
||||
"&75. Click confirm"
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(23, new ItemBuilder(Material.BOOK)
|
||||
.name("&bMy Listings")
|
||||
.lore(
|
||||
"&7View your active listings.",
|
||||
"",
|
||||
"&7Click on a listing to cancel it.",
|
||||
"&7Cancelled items go to claim storage."
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(24, new ItemBuilder(Material.CLOCK)
|
||||
.name("&bMy Auctions")
|
||||
.lore(
|
||||
"&7View your active auctions.",
|
||||
"",
|
||||
"&7You can only cancel auctions",
|
||||
"&7that have no bids yet."
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(25, new ItemBuilder(Material.ENDER_CHEST)
|
||||
.name("&dClaim Items")
|
||||
.lore(
|
||||
"&7Collect items waiting for you:",
|
||||
"",
|
||||
"&7- Expired listings",
|
||||
"&7- Cancelled listings",
|
||||
"&7- Won auctions",
|
||||
"&7- Auction refunds"
|
||||
)
|
||||
.build());
|
||||
|
||||
inventory.setItem(31, new ItemBuilder(Material.EMERALD)
|
||||
.name("&aEarnings")
|
||||
.lore(
|
||||
"&7Withdraw money from sales.",
|
||||
"",
|
||||
"&7When you sell something, the money",
|
||||
"&7goes to pending earnings first.",
|
||||
"&7Withdraw it here."
|
||||
)
|
||||
.build());
|
||||
|
||||
// Tax info
|
||||
inventory.setItem(40, new ItemBuilder(Material.GOLD_NUGGET)
|
||||
.name("&6Tax Information")
|
||||
.lore(
|
||||
"&7Market Tax: &f" + plugin.getConfigManager().getMarketTax() + "%",
|
||||
"&7Auction Tax: &f" + plugin.getConfigManager().getAuctionTax() + "%",
|
||||
"",
|
||||
"&7Taxes are deducted from seller earnings."
|
||||
)
|
||||
.build());
|
||||
|
||||
|
||||
@@ -229,9 +229,9 @@ public class ItemSelectionGui implements MarketGui {
|
||||
itemWithQuantity.setAmount(quantity);
|
||||
|
||||
if (mode == SelectionMode.LISTING) {
|
||||
new CreateListingGui(plugin, guiManager).openWithItem(player, playerInvSlot, itemWithQuantity);
|
||||
guiManager.getCreateListingGui().openWithItem(player, playerInvSlot, itemWithQuantity);
|
||||
} else {
|
||||
new CreateAuctionGui(plugin, guiManager).openWithItem(player, playerInvSlot, itemWithQuantity);
|
||||
guiManager.getCreateAuctionGui().openWithItem(player, playerInvSlot, itemWithQuantity);
|
||||
}
|
||||
} else {
|
||||
// User cancelled - go back to item selection
|
||||
@@ -244,9 +244,9 @@ public class ItemSelectionGui implements MarketGui {
|
||||
singleItem.setAmount(1);
|
||||
|
||||
if (mode == SelectionMode.LISTING) {
|
||||
new CreateListingGui(plugin, guiManager).openWithItem(player, playerInvSlot, singleItem);
|
||||
guiManager.getCreateListingGui().openWithItem(player, playerInvSlot, singleItem);
|
||||
} else {
|
||||
new CreateAuctionGui(plugin, guiManager).openWithItem(player, playerInvSlot, singleItem);
|
||||
guiManager.getCreateAuctionGui().openWithItem(player, playerInvSlot, singleItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,21 +305,15 @@ public class AuctionService {
|
||||
return CompletableFuture.completedFuture(CancelResult.HAS_BIDS);
|
||||
}
|
||||
|
||||
// Atomically flip to CANCELLED only if still ACTIVE. This guarantees the
|
||||
// refund + item return below run exactly once and never race with the
|
||||
// periodic end-processing task (which would otherwise duplicate the item
|
||||
// or hand the highest bidder both the item and a refund).
|
||||
return plugin.getDatabaseManager().updateAuctionStatusIfActive(auctionId, Auction.AuctionStatus.CANCELLED)
|
||||
.thenApply(success -> {
|
||||
if (!success) {
|
||||
return CancelResult.FAILED;
|
||||
}
|
||||
|
||||
// If admin cancelling with bids, refund highest bidder
|
||||
if (isAdmin && auction.getBidCount() > 0 && auction.getHighestBidderUuid() != null) {
|
||||
plugin.getEconomyManager().deposit(auction.getHighestBidderUuid(), auction.getCurrentBid());
|
||||
}
|
||||
|
||||
// Update status
|
||||
return plugin.getDatabaseManager().updateAuctionStatus(auctionId, Auction.AuctionStatus.CANCELLED)
|
||||
.thenApply(success -> {
|
||||
if (success) {
|
||||
// Return item to claim storage
|
||||
ClaimItem claimItem = new ClaimItem(
|
||||
auction.getSellerUuid(),
|
||||
@@ -330,6 +324,8 @@ public class AuctionService {
|
||||
plugin.getDatabaseManager().addClaimItem(claimItem);
|
||||
invalidateCache();
|
||||
return CancelResult.SUCCESS;
|
||||
}
|
||||
return CancelResult.FAILED;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -354,23 +350,17 @@ public class AuctionService {
|
||||
*/
|
||||
private CompletableFuture<Void> processAuctionEnd(int auctionId) {
|
||||
return getAuction(auctionId)
|
||||
.thenCompose(optAuction -> {
|
||||
if (optAuction.isEmpty()) return CompletableFuture.<Void>completedFuture(null);
|
||||
.thenAccept(optAuction -> {
|
||||
if (optAuction.isEmpty()) return;
|
||||
|
||||
Auction auction = optAuction.get();
|
||||
|
||||
// Determine terminal status
|
||||
// Update status first
|
||||
Auction.AuctionStatus newStatus = auction.getBidCount() > 0
|
||||
? Auction.AuctionStatus.SOLD
|
||||
: Auction.AuctionStatus.EXPIRED;
|
||||
|
||||
// Atomically claim the auction end: only the caller that flips the row
|
||||
// away from ACTIVE proceeds to credit earnings / deliver the item. This
|
||||
// makes end-processing idempotent and prevents duplication when the
|
||||
// periodic task and a buyout (or two task runs) race on the same auction.
|
||||
return plugin.getDatabaseManager().updateAuctionStatusIfActive(auctionId, newStatus)
|
||||
.thenAccept(claimed -> {
|
||||
if (!claimed) return;
|
||||
plugin.getDatabaseManager().updateAuctionStatus(auctionId, newStatus);
|
||||
|
||||
if (auction.getBidCount() > 0 && auction.getHighestBidderUuid() != null) {
|
||||
// Auction has a winner
|
||||
@@ -443,7 +433,6 @@ public class AuctionService {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -116,19 +116,8 @@ public class ClaimService {
|
||||
if (removed) {
|
||||
// Give item on main thread
|
||||
ItemStack itemToGive = item.getItem();
|
||||
ClaimItem source = item;
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
ItemStack leftover = InventoryUtil.giveItem(player, itemToGive);
|
||||
if (leftover != null) {
|
||||
// Inventory filled up mid-claim: put the remainder back into
|
||||
// claim storage instead of silently destroying the items.
|
||||
plugin.getDatabaseManager().addClaimItem(new ClaimItem(
|
||||
player.getUniqueId(),
|
||||
leftover,
|
||||
source.getReason(),
|
||||
source.getSourceInfo()
|
||||
));
|
||||
}
|
||||
InventoryUtil.giveItem(player, itemToGive);
|
||||
});
|
||||
claimed++;
|
||||
}
|
||||
|
||||
@@ -291,9 +291,8 @@ public class ListingService {
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
|
||||
// Update status atomically (only if still ACTIVE) so a concurrent
|
||||
// purchase/expiry can never both deliver the item AND return it here.
|
||||
return plugin.getDatabaseManager().updateListingStatusIfActive(listingId, Listing.ListingStatus.CANCELLED)
|
||||
// Update status
|
||||
return plugin.getDatabaseManager().updateListingStatus(listingId, Listing.ListingStatus.CANCELLED)
|
||||
.thenApply(success -> {
|
||||
if (success) {
|
||||
// Return item to claim storage
|
||||
@@ -320,9 +319,8 @@ public class ListingService {
|
||||
return plugin.getDatabaseManager().getExpiredListings()
|
||||
.thenAccept(listings -> {
|
||||
for (Listing listing : listings) {
|
||||
// Update status to expired atomically (only if still ACTIVE) so a
|
||||
// concurrent purchase can't both sell the item and return it to claim.
|
||||
plugin.getDatabaseManager().updateListingStatusIfActive(listing.getId(), Listing.ListingStatus.EXPIRED)
|
||||
// Update status to expired
|
||||
plugin.getDatabaseManager().updateListingStatus(listing.getId(), Listing.ListingStatus.EXPIRED)
|
||||
.thenAccept(success -> {
|
||||
if (success) {
|
||||
// Return item to claim storage
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# ============================================
|
||||
|
||||
# Language setting (available: en_US, pt_PT)
|
||||
language: pt_PT
|
||||
language: en_US
|
||||
|
||||
# Database Configuration
|
||||
database:
|
||||
|
||||
@@ -45,16 +45,12 @@ messages:
|
||||
claim-empty: "&eYou have no items to claim."
|
||||
claim-inventory-full: "&cYour inventory is full! Please make space."
|
||||
claim-all-success: "&aClaimed {count} items!"
|
||||
claim-items: "&eYou have &6{count}&e item(s) waiting to be claimed. Use /market to claim them."
|
||||
|
||||
# Earnings Messages
|
||||
earnings-withdrawn: "&aWithdrew {amount}! New balance: {balance}"
|
||||
earnings-empty: "&eYou have no pending earnings."
|
||||
earnings-balance: "&aYour pending earnings: {amount}"
|
||||
|
||||
# Generic
|
||||
failed: "&cSomething went wrong. Please try again."
|
||||
|
||||
# Item Validation
|
||||
invalid-item: "&cPlease select a valid item."
|
||||
item-no-longer-available: "&cThe selected item is no longer in your inventory."
|
||||
@@ -449,8 +445,4 @@ help:
|
||||
- ""
|
||||
- "&7&oTip: All actions are done through GUIs!"
|
||||
- "&7&oJust click on buttons to navigate."
|
||||
tax-title: "&6Tax Information"
|
||||
tax-market: "&7Market Tax: &f{tax}%"
|
||||
tax-auction: "&7Auction Tax: &f{tax}%"
|
||||
tax-note: "&7Taxes are deducted from seller earnings."
|
||||
|
||||
|
||||
@@ -45,16 +45,12 @@ messages:
|
||||
claim-empty: "&eNão tens itens para reclamar."
|
||||
claim-inventory-full: "&cO teu inventário está cheio! Por favor liberta espaço."
|
||||
claim-all-success: "&aReclamaste {count} itens!"
|
||||
claim-items: "&eTens &6{count}&e item(ns) por reclamar. Usa /market para os reclamar."
|
||||
|
||||
# Mensagens de Ganhos
|
||||
earnings-withdrawn: "&aLevantaste {amount}! Novo saldo: {balance}"
|
||||
earnings-empty: "&eNão tens ganhos pendentes."
|
||||
earnings-balance: "&aOs teus ganhos pendentes: {amount}"
|
||||
|
||||
# Genérico
|
||||
failed: "&cAlgo correu mal. Tenta novamente."
|
||||
|
||||
# Validação de Itens
|
||||
invalid-item: "&cPor favor seleciona um item válido."
|
||||
item-no-longer-available: "&cO item selecionado já não está no teu inventário."
|
||||
@@ -449,8 +445,4 @@ help:
|
||||
- ""
|
||||
- "&7&oDica: Todas as ações são feitas através de GUIs!"
|
||||
- "&7&oBasta clicar nos botões para navegar."
|
||||
tax-title: "&6Informação de Taxas"
|
||||
tax-market: "&7Taxa do Mercado: &f{tax}%"
|
||||
tax-auction: "&7Taxa dos Leilões: &f{tax}%"
|
||||
tax-note: "&7As taxas são deduzidas dos ganhos do vendedor."
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ main: pt.henrique.communityMarket.CommunityMarket
|
||||
api-version: '1.21'
|
||||
description: A GUI-only marketplace plugin for fixed-price listings and auctions
|
||||
author: Henrique
|
||||
website: https://github.com/henriquescrrrr/carrageis-communitymarket
|
||||
website: https://github.com/henrique/CommunityMarket
|
||||
|
||||
# Soft dependencies - plugin will detect and use these if available
|
||||
softdepend:
|
||||
@@ -63,5 +63,21 @@ permissions:
|
||||
default: true
|
||||
|
||||
communitymarket.admin:
|
||||
description: Allows access to admin functions (view all, remove listings, reload)
|
||||
description: Allows access to admin functions
|
||||
default: op
|
||||
children:
|
||||
communitymarket.admin.viewall: true
|
||||
communitymarket.admin.remove: true
|
||||
communitymarket.admin.reload: true
|
||||
|
||||
communitymarket.admin.viewall:
|
||||
description: Allows viewing all listings/auctions
|
||||
default: op
|
||||
|
||||
communitymarket.admin.remove:
|
||||
description: Allows removing any listing or auction
|
||||
default: op
|
||||
|
||||
communitymarket.admin.reload:
|
||||
description: Allows reloading configuration
|
||||
default: op
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,15 +4,15 @@ pt/henrique/communityMarket/config/MessageManager.class
|
||||
pt/henrique/communityMarket/model/PendingEarnings.class
|
||||
pt/henrique/communityMarket/gui/AdminGui$AdminListingsGui.class
|
||||
pt/henrique/communityMarket/model/Auction.class
|
||||
pt/henrique/communityMarket/listener/PlayerListener.class
|
||||
pt/henrique/communityMarket/economy/EconomyManager$EconomyAdapter.class
|
||||
pt/henrique/communityMarket/listener/PlayerListener.class
|
||||
pt/henrique/communityMarket/gui/MarketGui.class
|
||||
pt/henrique/communityMarket/service/AuctionService.class
|
||||
pt/henrique/communityMarket/util/ItemSerializer.class
|
||||
pt/henrique/communityMarket/service/EarningsService$WithdrawResult.class
|
||||
pt/henrique/communityMarket/gui/MainMenuGui.class
|
||||
pt/henrique/communityMarket/service/ListingService.class
|
||||
pt/henrique/communityMarket/service/EarningsService$WithdrawResult.class
|
||||
pt/henrique/communityMarket/gui/ConfirmationGui.class
|
||||
pt/henrique/communityMarket/service/ListingService.class
|
||||
pt/henrique/communityMarket/gui/HelpGui.class
|
||||
pt/henrique/communityMarket/db/DatabaseManager.class
|
||||
pt/henrique/communityMarket/gui/QuantitySelectGui$QuantityCallback.class
|
||||
@@ -22,12 +22,12 @@ pt/henrique/communityMarket/model/Bid.class
|
||||
pt/henrique/communityMarket/service/ClaimService.class
|
||||
pt/henrique/communityMarket/task/ExpiredListingTask.class
|
||||
pt/henrique/communityMarket/gui/NumberInputGui$NumberInputCallback.class
|
||||
pt/henrique/communityMarket/service/ClaimService$ClaimResult.class
|
||||
pt/henrique/communityMarket/gui/MyAuctionsGui.class
|
||||
pt/henrique/communityMarket/CommunityMarket.class
|
||||
pt/henrique/communityMarket/service/ClaimService$ClaimResult.class
|
||||
pt/henrique/communityMarket/gui/ConfirmationGui$ConfirmCallback.class
|
||||
pt/henrique/communityMarket/model/ClaimItem$ClaimReason.class
|
||||
pt/henrique/communityMarket/CommunityMarket.class
|
||||
pt/henrique/communityMarket/gui/BrowseMarketGui.class
|
||||
pt/henrique/communityMarket/model/ClaimItem$ClaimReason.class
|
||||
pt/henrique/communityMarket/model/Auction$AuctionStatus.class
|
||||
pt/henrique/communityMarket/util/SoundUtil.class
|
||||
pt/henrique/communityMarket/gui/BrowseMarketGui$1.class
|
||||
@@ -39,13 +39,13 @@ pt/henrique/communityMarket/command/MarketCommand.class
|
||||
pt/henrique/communityMarket/listener/GuiListener$1.class
|
||||
pt/henrique/communityMarket/service/AuctionService$BidResult.class
|
||||
pt/henrique/communityMarket/gui/CreateListingGui.class
|
||||
pt/henrique/communityMarket/model/ClaimItem.class
|
||||
pt/henrique/communityMarket/gui/ClaimGui$1.class
|
||||
pt/henrique/communityMarket/model/ClaimItem.class
|
||||
pt/henrique/communityMarket/util/ItemBuilder.class
|
||||
pt/henrique/communityMarket/gui/NumberInputGui.class
|
||||
pt/henrique/communityMarket/gui/AdminGui.class
|
||||
pt/henrique/communityMarket/gui/BrowseAuctionsGui.class
|
||||
pt/henrique/communityMarket/gui/ItemSelectionGui$SelectionMode.class
|
||||
pt/henrique/communityMarket/gui/BrowseAuctionsGui.class
|
||||
pt/henrique/communityMarket/service/TransactionService$TransactionResult.class
|
||||
pt/henrique/communityMarket/service/EarningsService.class
|
||||
pt/henrique/communityMarket/service/TransactionService$ValidationResult.class
|
||||
@@ -56,8 +56,8 @@ pt/henrique/communityMarket/gui/GuiManager.class
|
||||
pt/henrique/communityMarket/economy/EconomyManager$VaultAdapter.class
|
||||
pt/henrique/communityMarket/gui/ClaimGui.class
|
||||
pt/henrique/communityMarket/economy/EconomyManager$EssentialsAdapter.class
|
||||
pt/henrique/communityMarket/service/ListingService$PurchaseResult.class
|
||||
pt/henrique/communityMarket/gui/EarningsGui.class
|
||||
pt/henrique/communityMarket/service/ListingService$PurchaseResult.class
|
||||
pt/henrique/communityMarket/config/ConfigManager.class
|
||||
pt/henrique/communityMarket/gui/MarketGui$GuiType.class
|
||||
pt/henrique/communityMarket/util/InventoryUtil$ItemCategory.class
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/CommunityMarket.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/command/MarketCommand.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/config/ConfigManager.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/config/MessageManager.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/db/DatabaseManager.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/economy/EconomyManager.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/AdminGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/BrowseAuctionsGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/BrowseMarketGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/ClaimGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/ConfirmationGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/CreateAuctionGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/CreateListingGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/EarningsGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/GuiManager.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/HelpGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/ItemSelectionGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/MainMenuGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/MarketGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/MyAuctionsGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/MyListingsGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/NumberInputGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/gui/QuantitySelectGui.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/listener/GuiListener.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/listener/PlayerListener.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/model/Auction.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/model/Bid.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/model/ClaimItem.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/model/Listing.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/model/PendingEarnings.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/service/AuctionService.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/service/ClaimService.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/service/EarningsService.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/service/ListingService.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/service/TransactionService.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/task/AuctionTask.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/task/ExpiredListingTask.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/util/InventoryUtil.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/util/ItemBuilder.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/util/ItemSerializer.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/util/SoundUtil.java
|
||||
/root/mc-plugins-audit/repos/communitymarket/src/main/java/pt/henrique/communityMarket/util/TextUtil.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/CommunityMarket.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/command/MarketCommand.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/config/ConfigManager.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/config/MessageManager.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/db/DatabaseManager.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/economy/EconomyManager.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/AdminGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/BrowseAuctionsGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/BrowseMarketGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/ClaimGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/ConfirmationGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/CreateAuctionGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/CreateListingGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/EarningsGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/GuiManager.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/HelpGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/ItemSelectionGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/MainMenuGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/MarketGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/MyAuctionsGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/MyListingsGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/NumberInputGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/gui/QuantitySelectGui.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/listener/GuiListener.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/listener/PlayerListener.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/model/Auction.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/model/Bid.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/model/ClaimItem.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/model/Listing.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/model/PendingEarnings.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/service/AuctionService.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/service/ClaimService.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/service/EarningsService.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/service/ListingService.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/service/TransactionService.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/task/AuctionTask.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/task/ExpiredListingTask.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/util/InventoryUtil.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/util/ItemBuilder.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/util/ItemSerializer.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/util/SoundUtil.java
|
||||
/Users/henrique/IdeaProjects/CommunityMarket/src/main/java/pt/henrique/communityMarket/util/TextUtil.java
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user